Package your code with ant
April 23rd, 2008
I recently commented on how ant is by far the most versatile and flexible way to compile your Flex applications, take for example this sample swc compiler project.
I keep this project handy in my workspace, and if I ever need to compile or package my source code into a swc file (pronounced swik for the noobs) I do the following:
- Copy my source code into the source directory
- Open up build.properties and set the parameters
flex-sdk-dir=C:/tools/flex3_sdk output-name=pixelate.swc src-dir=src bin-dir=bin
- And open up build.xml in the Eclipse Ant view
- Now I am good to go
- Finally to build my project simply double click the “compile-swc” task in my Ant view.
This is obviously a very basic example, but consider how useful this becomes if you are developing a third-party api for a team of developers.
You can distribute your code in a neat tidy package and be safe in the knowledge that if anyone decides tinker with your code they only have access to available public members.
Don’t even consider compiling a swc file and expecting it to be completely secure and inaccessible, because where there’s a will there is a way. The point is that you have a working tool that you can distribute and safe guard yourself against bugs caused by other developers.
Download the above mentioned swccompiler.