David, Doug, Vikas,
Thanks for ur input. I got it working.
Anyway David, what is this YMMV ?
j
----- Original Message -----
From: "Harkness, David" <[EMAIL PROTECTED]>
To: "Ant Users List" <[EMAIL PROTECTED]>
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:
[EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
>
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]