ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "RADEMAKERS Tanguy" <Tanguy.RADEMAK...@swift.com>
Subject RE: Help with running different target based on user input?
Date Fri, 23 Feb 2007 13:41:26 GMT
after a more careful reading of your mail ;P

<?xml version="1.0" encoding="UTF-8"?>
<project name="" default="script3" basedir=".">
    
    <target name="ask_script3">
    
        <input  message="Populate people tables with test data? (run
script3)" 
                validargs="y,n"  
                defaultvalue="n" 
                addproperty="script3.run"/>
        
        <condition property="script3.run.required">
            <equals arg1="y" arg2="${script3.run}"/>
        </condition>
    </target>
    
    <target name="script3" depends="ask_script3"
if="script3.run.required">
        <echo message="running script 3..."/>
    </target> 

</project>

-----

D:\scrap\ant>ant
Buildfile: build.xml

ask_script3:
    [input] Populate people tables with test data? (run script3)(y,n)
n

script3:

BUILD SUCCESSFUL
Total time: 2 seconds

D:\scrap\ant>ant
Buildfile: build.xml

ask_script3:
    [input] Populate people tables with test data? (run script3)(y,n)
y

script3:
     [echo] running script 3...

BUILD SUCCESSFUL
Total time: 1 second
D:\scrap\ant>


/t

>-----Original Message-----
>From: RADEMAKERS Tanguy 
>Sent: Friday, February 23, 2007 2:25 PM
>To: 'Ant Users List'
>Subject: RE: Help with running different target based on user input?
>
>Hello James,
>
>You should put the input tasks within the target blocks that 
>"consume" the inputted info:
>
>
><target name="script3">
>
>	<input  message="Populate people tables with test data? 
>(run script3)" 
>		  validargs="y,n"  
>		  defaultvalue="n" 
>		  addproperty="foo"/>
>	<do something arg="${foo}/>
>
></target>
>
>check out the ant manual page for the input task for some examples.
>
>/t 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message