我有以下目标:
<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>
Run Code Online (Sandbox Code Playgroud)
在另一个目标中,我想根据是否设置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>
Run Code Online (Sandbox Code Playgroud)
谢谢!
你可能想要这样的东西:
<target name="mycopy" if="copy.file">
<!-- do copy -->
</target>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3049 次 |
| 最近记录: |