我想调用一个目标,两次:第一次除非外部lib名称为“temp.swc”,第二次使用此外部lib。
<target name="build-trinity-client">
<mxmlc
file="${src.dir}/${trinity.project}.mxml"
output="${release.dir}/${trinity-client}.swf"
locale="fr_FR"
static-rsls="true"
accessible="true"
configname="air"
debug="false"
failonerror="true"
fork="true"
maxmemory="512m">
<source-path path-element="${src.dir}"/>
<external-library-path file="${FLEX_HOME}/frameworks/libs/air/airglobal.swc" append="true"/>
<library-path dir="${ivy.cache.dir}" append="true">
<include name="${puremvc.lib}"/>
<include name="${kccalendar.lib}"/>
<include name="${as3commons.lib}"/>
<include name="d:/temp.swc"/>
</library-path>
</mxmlc>
</target>
答案 0 :(得分:1)
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<target name="build-trinity-client">
<if>
<isset property="swc.name"/>
<then>
<mxmlc
file="${src.dir}/${trinity.project}.mxml"
output="${release.dir}/${trinity-client}.swf"
locale="fr_FR"
static-rsls="true"
accessible="true"
configname="air"
debug="false"
failonerror="true"
fork="true"
maxmemory="512m">
<source-path path-element="${src.dir}"/>
<external-library-path file="${FLEX_HOME}/frameworks/libs/air/airglobal.swc" append="true"/>
<library-path dir="${ivy.cache.dir}" append="true">
<include name="${puremvc.lib}"/>
<include name="${kccalendar.lib}"/>
<include name="${as3commons.lib}"/>
<include name="${swc.name}"/>
</library-path>
</mxmlc>
</then>
<else>
<mxmlc
file="${src.dir}/${trinity.project}.mxml"
output="${release.dir}/${trinity-client}.swf"
locale="fr_FR"
static-rsls="true"
accessible="true"
configname="air"
debug="false"
failonerror="true"
fork="true"
maxmemory="512m">
<source-path path-element="${src.dir}"/>
<external-library-path file="${FLEX_HOME}/frameworks/libs/air/airglobal.swc" append="true"/>
<library-path dir="${ivy.cache.dir}" append="true">
<include name="${puremvc.lib}"/>
<include name="${kccalendar.lib}"/>
<include name="${as3commons.lib}"/>
</library-path>
</mxmlc>
</else>
</if>
</target>
<target name="sample_call">
<echo>First call: library name is passing</echo>
<antcall target="build-trinity-client">
<param name="swc.name" value="d:/temp.swc"/>
</antcall>
<echo>Second call: don't use external library</echo>
<antcall target="build-trinity-client">
<param name="swc.name" value=""/>
</antcall>
</target>