我想简化一下:
<target name="build">
<parallel>
<antcall target="build-A" />
<antcall target="build-B" />
<antcall target="build-C" />
</parallel>
</target>
<target name="build-A">
<exec executable="tool.exe" dir="projects/A">
<arg value="input.xml" />
</exec>
</target>
wherebuild-B
和build-C
做完全相同的事情(仅分别在 dirsB
和C
中),类似于以下内容:
<dirset id="projects" dir="." >
<include name="projects/*" />
</dirset>
<apply executable="tool.exe" parallel="true">
<arg value="input.xml" />
<dirset refid="projects" />
</apply>
这不起作用,因为apply
将执行以下操作之一:
如果parallel
设置为true
,
tool.exe input.xml projects/A projects/B projects/C
或者如果parallel
设置为false
,
tool.exe projects/A/input.xml
...waits for tool.exe to complete...
tool.exe projects/B/input.xml
...etc
即使这样也不正确,因为tool.exe
期望在projects/A
目录中运行。
有没有办法将其并行化,使我得到的输出相当于:
cd project/A
tool.exe input.xml
cd ../B
tool.exe input.xml
cd ../C
tool.exe input.xml
但并行?