I have the following target:
<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>
In another target, I'd like to conditionally copy a file depending on whether or not the copy.file property is set. Is this possible? Is there some other way to accomplish it?
Here's what I came up with based on ChrisH's response.
<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>
Thanks!
You probably want something like:
<target name="mycopy" if="copy.file">
   <!-- do copy -->
</target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With