Actionscript 3 Ant:宏定义中的条件执行
我已经创建了一个宏来编译Actionscript 3 Ant:宏定义中的条件执行,actionscript-3,ant,Actionscript 3,Ant,我已经创建了一个宏来编译.swf,它来自.as源代码(Flash项目): 为了避免每次编译我的App1,我在中添加了任务: <macrodef name="compile"> <sequential> <uptodate property="swf.uptodate" targetfile="@{output}"> <srcfiles dir="@{src}" includes="**/*.as"/> </up
.swf
,它来自.as
源代码(Flash项目):
为了避免每次编译我的App1
,我在
中添加了任务
:
<macrodef name="compile">
<sequential>
<uptodate property="swf.uptodate" targetfile="@{output}">
<srcfiles dir="@{src}" includes="**/*.as"/>
</uptodate>
<mxmlc file="@{input}" output="@{output}"/>
</sequential>
</macrodef>
不需要antcontrib,使用ant>=1.9.1(更好地使用ant 1.9.3,因为ant 1.9.1中存在错误)
要激活该功能,您需要名称空间声明,如以下代码段所示:
<project
xmlns:if="ant:if"
xmlns:unless="ant:unless"
>
<macrodef name="compile">
<sequential>
<uptodate property="swf.uptodate" targetfile="@{output}">
<srcfiles dir="@{src}" includes="**/*.as"/>
</uptodate>
<mxmlc file="@{input}" output="@{output}" unless:true="${swf.uptodate}"/>/>
</sequential>
</macrodef>
</project>
/>
否则在使用ant时
<macrodef name="compile">
<sequential>
<uptodate property="swf.uptodate" targetfile="@{output}">
<srcfiles dir="@{src}" includes="**/*.as"/>
</uptodate>
<mxmlc file="@{input}" output="@{output}"/>
</sequential>
</macrodef>
IF NOT swf.uptodate
EXECUTE mxmlc
ELSE
do nothing.
<project
xmlns:if="ant:if"
xmlns:unless="ant:unless"
>
<macrodef name="compile">
<sequential>
<uptodate property="swf.uptodate" targetfile="@{output}">
<srcfiles dir="@{src}" includes="**/*.as"/>
</uptodate>
<mxmlc file="@{input}" output="@{output}" unless:true="${swf.uptodate}"/>/>
</sequential>
</macrodef>
</project>