2
votes

I need to setup a continuous environment allowing to build air apps, and so I have to setup some ANT script to compile my flash then package it.

I came across the flex task mxmlc which is the base tool to build .swf.

I have setup a base build file using this tool, but my project uses .ANE, and I cannot get them to be included as my swf compiles. I end up with errors as many classes are unknown.

Here is my build file:

<property
    name="AIR_SDK_HOME" value="${basedir}/Flex 4.6.0" />    

<property
    name="FLEX_HOME" value="${basedir}/Flex 4.6.0" />   

<property
    name="FLEX_TASKS" value="${FLEX_HOME}/ant/flexTasks.tasks" />       

<property
    name="ADT" value="${SDK}/bin/adt" />        

<property
    name="MXMLC" value="${SDK}/bin/amxmlc" />   


<taskdef resource="flexTasks.tasks" classpath="flexTasks.jar"/> 


<target name="compile">
    <mxmlc file="${basedir}/src/Main.as"
        output="${basedir}/bin-debug/HR_2012_IPAD.swf"
        locale="en_US"
        static-rsls="true"
        accessible="true"
        configname="airmobile"
        debug="true"
        failonerror="true"
        fork="true"
        maxmemory="512m">
        <source-path path-element="${FLEX_HOME}/frameworks"/>
        <source-path path-element="${basedir}/src"/>
        <source-path path-element="${basedir}/gestouch"/>  
        <compiler.library-path dir="${basedir}/lib" />

        <compiler.external-library-path dir="${basedir}" append="true">
            <include name="lib/*" />
        </compiler.external-library-path>

        <library-path dir="${basedir}/lib" includes="*.swc,*.ane" append="true"/>
        <library-path dir="${SDK}/frameworks/locale/en_US" includes="*.swc" append="true"/>

    </mxmlc>
</target>

If anyone has already managed to successfully include .ane using mxmlc, I would love to hear a solution.

Cheers guys!

1

1 Answers

0
votes

Adding the path, as well as the .ane file name to -external-library-path works for me.

EDIT: In your target you may only have to change this to explicitly look at the .ane file:

<compiler.external-library-path dir="${basedir}" append="true">
   <include name="lib/yourExtension.ane" />
</compiler.external-library-path>

This is how I use it (${compiler.arguments} is optional - you can use it to pass info to the compiler, for example define labels for conditional compilation like this: CONFIG::debug_trace,true):

<target name="build" depends="set build type, copy extension packages, copy files for building">
        <exec executable="${MXMLC}" failonerror="true">
            <arg line="
                ${compiler.arguments}
                +configname=airmobile
                -debug=${build.debug}
                -output ${app.builddir}/${app.name}.swf
                ${app.main.file} 
                -source-path+=${app.sourcedir}
                -external-library-path+=${ext.extensiondir}/${ext.file}
                -library-path+=${app.libs}
                -incremental=true
            "/>
        </exec>
    </target>

This is an excerpt from the continuous environment build scripts I wrote for our book Easy Native Extensions (the goal is to do a build of the ANEs, the app that uses the ANEs and install the app on the device with a single click).