ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vikas Phonsa <VPho...@suz.com>
Subject RE: How to execute task depending on input from command line
Date Tue, 25 Nov 2003 00:07:54 GMT
Ha ha yeah man I was also wondering what YMMV is ?

-----Original Message-----
From: Jhon [mailto:developer_me@yahoo.com] 
Sent: Monday, November 24, 2003 4:07 PM
To: Ant Users List
Subject: Re: How to execute task depending on input from command line

David, Doug, Vikas,

Thanks for ur input. I got it working.

Anyway David, what is this YMMV ?

j
----- Original Message ----- 
From: "Harkness, David" <DHarkness@sonypictures.com>
To: "Ant Users List" <user@ant.apache.org>
Sent: Monday, November 24, 2003 2:16 PM
Subject: RE: How to execute task depending on input
from command line


> Jhon wrote:
> > I want to execute certain task depending upon
which option
> > has selected by user during execution of
build.xml.
> > 
> > for eg. if user inputs "dev", then I want to do
dev
> > deployment by calling corresponding task. if user
inputs
> > "stage", then I want to do stage deployment by
calling corr. task.
> > 
> > I know I can use <input> task to get user input.
But not able
> > to understand how can I check the condition if
user input is equal 
> > to "dev" or "stage". 
> >
> > Can any body tell me how can I call targets
depending on
> > specific conditions ?
> 
> First, the user can specify the property through the
command line by
> using -D: "ant ... -Denv=dev". Now, to execute
different targets, you
> can use a mix of the "if" condition on targets and
the <condition> task:
> 
>   <target name="build" depends="init, build-dev">
... </target>
> 
>   <target name="init" ...>
>     <condition property="env.is.dev">
>       <equals arg1="${env}" arg2="dev"/>
>     </condition>
>   </target>
> 
>   <target name="build-dev" if="dev.is.env"> ...
</target>
> 
> Another option is to use <antcall> and the "env"
property to call the
> correct target:
> 
>   <antcall target="build-${env}"/>
> 
> I haven't tried either of these completely -- just
various pieces. Our
> build process only reads in different properties
files based on the
> environment, and that's easy:
> 
>   <property file="build-${env}.properties"/>
> 
> So, YMMV. Good luck!
> 
> David Harkness
> Sr. Software Engineer
> Sony Pictures Digital Networks
> (310) 482-4756
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
user-help@ant.apache.org
> 

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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

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


Mime
View raw message