У меня есть следующая цель:
<target name="promptforchoice">
<input addproperty="choice">
Copy the file?. [Y, n]
</input>
<condition property="copy.file">
<or>
<equals arg1="Y" arg2="${choice}"/>
<equals arg1="y" arg2="${choice}"/>
</or>
</condition>
</target>
В другой цели я бы хотел условно скопировать файл в зависимости от того, установлено или нет свойство copy.file. Возможно ли это? Есть ли другой способ сделать это?
Мое решение
Вот что я придумал, основываясь на ответе ChrisH .
<target name="promptforchoice">
<input addproperty="choice">
Copy the file?. [Y, n]
</input>
<condition property="copy.file">
<or>
<equals arg1="Y" arg2="${choice}"/>
<equals arg1="y" arg2="${choice}"/>
</or>
</condition>
</target>
<target name="copyfile" if="copy.file">
<copy file="file1.cfg" tofile="file2.cfg"/>
</target>
<target name="build" depends="promptforchoice">
<antcall target="copyfile"/>
<!-- Other stuff goes here -->
</target>
Спасибо!