« Return to Thread: conditional logic and user input

conditional logic and user input

by dave_davis :: Rate this Message:

Reply to Author | View in Thread

Hi,

I want to be able to control my build depending on user input.  I've tried the following code but the ifyes and ifno targets never run.  I'm new to ant so am sure I've missed something fundamental but can't see what it is - all help appreciated!

Cheers

Dave

<project name="test" default="myDefault">

        <target name="myDefault">
                <input message="Enter the value" addproperty="result" />
                <condition property="result.is.yes">
                        <equals arg1="Y" arg2="${result}" />
                </condition>
                <condition property="result.is.no">
                        <equals arg1="N" arg2="${result}" />
                </condition>
                <echo message="${result}"/>
                <echo message="${result.is.yes}"/>
                <echo message="${result.is.no}"/>
                <antcall target="ifyes" />
                <antcall target="ifno" />

        </target>

        <target name="ifyes" if="${result.is.yes}">
                <echo message="I am yes" />
        </target>
        <target name="ifno" if="${result.is.no}">
                <echo message="I am no" />
        </target>
</project>

 « Return to Thread: conditional logic and user input