gpt4 book ai didi

flash - 如何构建 Ant 脚本以根据我的目标输出进行不同的编译。 AIR VS 瑞士法郎?

转载 作者:行者123 更新时间:2023-12-04 06:10:08 25 4
gpt4 key购买 nike

如何构建一个 Ant 脚本来输出 swfs vs air 包,并在编译期间根据我想要的目标使用不同的类?

例如,我正在构建一个适用于网络、移动设备和桌面的应用程序。在某些情况下,我的类将只使用 AIR 组件。我希望能够创建在为 web 输出 swf 时不包含这些类的 ANT 构建脚本。我该怎么做呢?

最佳答案

这是我为类似情况所做的:

<target name="define.compile.task" depends="initflex">
<presetdef name="flex.build">
<mxmlc file="${src.dir}/${src.file.path}"
output="${output.dir}/${output.file.path}" ...>
<compiler.source-path path-element="${src.dir}"/>
...
</mxmlc>
</presetdef>
</target>

<target name="parametrized.web.build" depends="define.compile.task">
<flex.build>
<compiler.define name="CONFIG::AllowAirComponents" value="false" />
</flex.build>
</target>


<target name="parametrized.air.build" depends="define.compile.task">
<flex.build configname="airmobile">
<compiler.define name="CONFIG::AllowAirComponents" value="true" />
</flex.build>
</target>

然后,我可以定义像
<target name="buildwebclass1">
<antcall target="parametrized.web.build">
<param name="src.file.path" value="path/to/MyClass.as"/>
<param name="output.file.path" value="MyClass.swf"/>
</antcall>
</target>

或者:
<target name="buildairclass1">
<antcall target="parametrized.air.build">
<param name="src.file.path" value="path/to/MyAirClass.as"/>
<param name="output.file.path" value="MyAirClass.swf"/>
</antcall>
<exec executable="${FLEX_HOME}/bin/adt" failonerror="true">
... (adt arguments)
</exec>
</target>

如果我有一些通用代码工厂,只在必要时实例化空气类,我用 CONFIG::AllowAirComponents { ... } 包装它。所以我的 AIR 特定类不会干扰 Web 构建。

希望这可以帮助!

关于flash - 如何构建 Ant 脚本以根据我的目标输出进行不同的编译。 AIR VS 瑞士法郎?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7865442/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com