【发布时间】:2013-12-21 20:02:25
【问题描述】:
我有一个使用 Ant 构建的 Android 项目,使用一些标准目标(调试、发布、安装、清理等)。我发现我可以使用如下命令运行多个目标:
ant clean debug
在这种情况下,它将在项目上运行“clean”,然后运行“debug”构建。这很好用。
我还有一个使用 Ant 构建的项目,我的第一个主项目依赖于它。我正在尝试在预构建步骤中自动构建子项目。到目前为止,我有这个:
<target name="-pre-build">
<subant target="${ant.project.invoked-targets}" failonerror="true">
<fileset dir="../other_project" includes="build.xml" />
</subant>
<!-- (additional steps here) -->
</target>
这适用于一个目标(例如ant debug),但是当我运行多个目标(例如ant clean debug)时,我收到以下错误:
Target "clean,debug" does not exist in the project "com.foo.other_project"
当我真的想为每个目标重新运行 subant 时,显然invoked-targets 是一个逗号分隔的列表。有谁知道如何实现这一目标?有没有办法将目标列表传递给 subant,或者可能遍历列表并为每个目标运行一次 subant?
谢谢!
【问题讨论】: