apache-flexantmxmlccompc

Flex Compilation - Strange Behavior of metadata tags


I'm trying to move the build of a Flex Builder workspace from the IDE into an Ant task, and I'm having some trouble with the behavior of some custom metadata tags in the projects.

I have one library project which is compiled as a .swc, which includes several classes that read metadata off of classes passed to them. An application depends on this library, and several classes in the application use metadata tags that should be read by the library.

This configuration works fine when compiling in Flex Builder, but when moved over to a task that compiles the library with compc and the application with mxmlc, the library is unable to read the metadata tags in the app.

Is there a parameter to compc or mxmlc that I'm missing?

The compc call looks something like this:

    <compc 
        include-classes="lots of classes here"
        output="${APP_ROOT}\libs\${libraryname}.swc">
        <source-path path-element="${localpath}\workspace\HolisticLib\src"/>
    </compc>

And the mxmlc call looks like this:

    <mxmlc file="${APP_ROOT}\src\${MXMLname}" 
           output="${swflocation}" 
           keep-generated-actionscript="true"
           services="${servicesconfig}">
        <load-config filename="${FLEX_HOME}\frameworks\flex-config.xml"/>
        <source-path path-element="${FLEX_HOME}\frameworks" />
        <compiler.library-path dir="${APP_ROOT}" append="true">
            <include name="**\*.swc" />
        </compiler.library-path>
    </mxmlc>

Solution

  • You have to tell the compiler not to discard your custom metadata on compilation, by adding flags.

    <keep-as3-metadata name="CustomMeta"/>
    <keep-as3-metadata name="OtherCustomMeta"/>