views:

9

answers:

1

I'm very new to ANT and have started using it in a Flash Builder project.

When I run the compiler I need to pass in some library paths. The whole thing looks like this:

    <mxmlc 
        file="${SOURCE_DIR}/com/${PACKAGE_NAME}/Main.as"
        output="${RELEASE_DIR}/assets/swf/${IDENTIFIER}/main.swf"
        locale="${LOCALE}"
        static-rsls="false"
        accessible="true"
    >
        <compiler.debug>false</compiler.debug>
        <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
        <source-path path-element="${SOURCE_DIR}"/>
        <external-library-path file="${FLEX_HOME}/frameworks/libs/player/10.0/playerglobal.swc" append="true"/>
        <library-path file="${FLEX_HOME}/frameworks/libs/flash-integration.swc" append="true"/>
        <library-path file="${FLEX_HOME}/frameworks/libs/flex.swc" append="true"/>
        <library-path file="${FLEX_HOME}/frameworks/libs/utilities.swc" append="true"/>
        <library-path dir="${basedir}/libs" includes="*" append="true"/>

    </mxmlc>

Basically everything after the output= part could be stored in some fashion and reused for all the other compilations. Is there some way to store a big block of xml in ANT and just call it through a variable reference or something..?

Thank you!

+1  A: 

You can use macrodef to solve this problem. Simply define a new macro as the above invocation, but taking file and output as arguments.

Brian Agnew