I am trying to compile a Flex 4 project using Ant. I can compile the main application, and I can compile some of my modules in order. Any module that has dependencies in a subcomplex does not say Error: Type was not found or was not a compile-time constant. I am doing all my development on Windows using Flash Builder 4, so I can compile everything, but I need to compile to a headless Linux-based server (where Ant is located).
I created a simple project to test my problem:
src-> Main.mxml
|->modules
|-> module1-> Module1.mxml
|-> module2-> Module2.mxml
|-> subPackage-> SubClass.as
There are no classes in module 1 except Flex classes, where Module2 has an instance of SubClass. Compiling the main application is working fine, as well as Module1. When he tries to compile Module2, I get an error message Error: Type was not found or was not a compile-time constant: SubClass..
My full Ant script:
<project name="Test" basedir=".">
<property file="build.properties" />
<target name="properties">
<fail unless="mxmlc">The "mxmlc" property must be set in build.properties.</fail>
</target>
<target name="build-app" depends="properties">
<exec executable="${mxmlc}" dir="${src.dir}" failonerror="true">
<arg line="${app.name}.mxml" />
<arg line="-debug=false" />
<arg line="-optimize=true" />
<arg line="-incremental=false" />
<arg line="-output '${build.dir}/${app.name}.swf'" />
<arg line="-link-report='${temp.dir}/link-report.xml'"/>
</exec>
</target>
<target name="build-modules" description="Build Modules">
<build.module dir="${module.dir}/module1" file="Module1"/>
<build.module dir="${module.dir}/module2" file="Module2"/>
</target>
<macrodef name="build.module">
<attribute name="dir" />
<attribute name="file" />
<sequential>
<echo>@{file}</echo>
<exec executable="${mxmlc}" dir="${src.dir}" failonerror="true">
<arg line="'@{dir}/@{file}.mxml'" />
<arg line="-debug=false" />
<arg line="-optimize=true" />
<arg line="-incremental=false" />
<arg line="-output '${module.build.dir}/@{file}.swf'" />
<arg line="-load-externs='${temp.dir}/link-report.xml'"/>
</exec>
</sequential>
</macrodef>
, .
,
-