1

I have a small framework that I would like to put out there. I would love to export these classes as a single file.

I know there is a SWC format, but there is not much recent information on how to export build this and I have a feeling this format might be outdated.

nizzle
  • 1,036
  • 2
  • 10
  • 23
  • It's not outdated, it is the way to precompile and distribute libraries. And afaik, there is no other format for that. What editor are you using? – Cay May 18 '11 at 08:48
  • I'm using FlashDevelop for Flash, I _do_ have the Flash IDE to compile. I use FlashBuilder for Flex. – nizzle May 18 '11 at 08:59
  • There is a plugin for FlashDevelop http://sourceforge.net/projects/exportswc/ – DanielB May 18 '11 at 12:58

1 Answers1

8

A SWC file is just a ZIP file (with the extension renamed) which, at minimum contains a single SWF movie (the compiled bytecode for your library) and an XML file which provides hinting about the contents of the SWF. However, as a SWC file is just a ZIP file you can add additional information; the most common being including ASDoc output which can then be parsed by IDEs (such as Flash Builder 4) and displayed as in-line documentation.

SWC files are preferred by developers because they are self-contained build dependencies. This makes them easy to manage as you only need to drop a single SWC file into a project to get it to compile. They are also preferred because they discourage junior developers from attempting to make any modifications to the libraries source code (at which point it stops being a 3rd party library).

SWC files can be compiled using the Adobe COMPC utility; most Flash IDE's (Flash Builder, FDT, and FlashDevelop) support compilation of SWCs from the GUI; but you can also compile SWCs from the Command Line, ANT, or Maven.

One thing to watch out for when creating your Framework's SWC file is to externalise any build dependencies that your project has. For example, let's assume that your Framework makes use of the GreenSock Library; instead of compiling your entire framework, including the GreenSock code into a single SWC file, you should instead compile your SWC, excluding all the code contained in your project's dependencies (ie: greensock.swc) and then distribute both your libraries' SWC file and the greensock.swc file - this way, developers that make use of your Framework won't be forced to use the version of the GreenSock Library you compiled against. An example of this practice in action can be found in the RobotLegs framework which distributes both robotlegs.swc and swiftsuspenders.swc.

I've written a blog post about managing build dependencies which may provide related reading on the topic.

Finally, I would reccomend hosting your Libraries source code on a public SCM solution; such at GitHub or Google Code, that way developers can read (and checkout) the source code if they require a reference - it also provides a good central location for issue management and documentation.

Community
  • 1
  • 1
JonnyReeves
  • 6,119
  • 2
  • 26
  • 28