如何构建build.xml文件来运行bat文件或shell脚本



我有一个bat文件和执行相同操作的shell脚本。现在我已经创建了一个ant build.xml文件,它将执行shell脚本或bat文件。我应该如何编写build.xml或者如何配置它?

选项1:使用条件目标

<condition property="windowsos">
  <os family="windows" />
</condition>
<condition property="linuxos">
  <os family="unix" />
</condition>
<target name="go" depends="go-windows,go-linux"/>
<target name="go-windows" if="windosos">
..
..
</target>
<target name="go-linux" if="windosos">
..
..
</target>

选项2:使用条件执行任务

<target name="go">
  <exec executable="doSomthing.exe" osfamily="windows"/>
  <exec executable="doSomthing" osfamily="unix"/>
</target>