views:

52

answers:

1

I'm trying to figure out why when I compile my Flex 4 Library swc using a simple ANT tasks, it compiles to about three times the size of the swc that's compiled by FlashBuilder.

Here is my ANT script to compile my swc

<target name="compileSWC" description="compiles the Library">
<echo>Compiling Library SWC To Deploy SWC Folder</echo>
    <compc debug="false
        output="${bin.dir}/${Library.name}-${timeVersion}.swc"
        incremental="true"
        optimize="true"
        headless-server="true"
        verbose-stacktraces="true"
        default-frame-rate="24">
        <source-path path-element="${src.dir}" />
        <include-sources dir="${src.dir}" includes="*"/>
        <source-path path-element="${src.dir}" />
        <compiler.library-path dir="${basedir}/" append="true">
        <include name="${library.dir}" />
        </compiler.library-path>
    </compc>
<echo>Compiled Library SWC To Deploy SWC Folder</echo>
</target>

This yields a swc that is 1,980 KB. This library file has custom components, some skins and images, so I was ok with the file size. But when I use the FlashBuilder to link my Library project to other Flex projects, the compiled swc is only 532 KB.

I am able to move the FlashBuilder compiled swc to any project and it works just fine.

So I'm wondering what is FlashBuilder doing different than my ANT build script to get that file size down? I tried adding 'static-link-runtime-shared-libraries="true"' to my ANT script, but I had the same results.

Thanks.

A: 

Have you tried spitting out the config from the FB compile and using that in the ant task? You can use the compiler option

-dump-config fb_config.xml

And then use the load-config tag to pull it into your ant task.

Here's a KB article that runs through it: http://kb2.adobe.com/cps/404/kb404341.html

Hope that helps, Ruprict

Ruprict
That was a big help! I used the config file, had to update some path names and it compiled to a tiny 403 KB swc that works. Only problem is now my argument names are missing.For example, setValue(myObject:Object) is now setValue(arg0:Object)But I'm sure I'm on the right track now. Next step I think I'm going to go through each setting in the config file and add them manually to my ANT script.Thanks!
odoenet
I solved the above argument issue by just adding my config to my original ANT script<load-config filename="${basedir}/build/my_config.xml" /> instead of only loading my config.Thanks again!
odoenet