Search code examples
antmxmlc

refractor similar code snippet in ANT files


i have the following code snippet in my ANT File which compiles my project to a swf file :

<target name="my target">
<mxmlc  file="${APPS_DIR}//@{appName}.mxml" 
    output="${DEPLOY_APPS_DIR}/@{appName}.swf" 
    actionscript-file-encoding="UTF-8" 
    keep-generated-actionscript="false" 
    optimize="true" 
    debug="${DEBUG_TF}" 
    locale="en_US"
    static-rsls="false"
    static-link-runtime-shared-libraries="false"
    verify-digests="false"> 
<!-- BEGIN code A -->
...
...
...
<!-- END code A -->
</mxmlc>
</target>

As i have much files that use the code A in similar way, I want to create a separable file which contains this code.

But, how can I call it from the main ant file ?


Solution

  • I found the solution. Answered and asked by myself at the same time. I was found it here.

    You can use XML's way of including external files and let the parser do the job for Ant:

    <?xml version="1.0"?>
    <!DOCTYPE project [
           <!ENTITY common SYSTEM "common.xml">
    ]>
    <project name="test" default="test" basedir=".">
      <target name="setup">
        ...
      </target>
      &common;
      ...   
    </project>