--- "Romain.Rouvoy" <[EMAIL PROTECTED]> wrote:
> When I call a specific target, I want to put eventually an optional
> property to true.
> But in the body of this target, this option has to be interpreted to
> give an special option !
> I wonder if I could do this with the <condition> task and how could I do
> ?
Yes. (See example below yours.)
> I will give you an example :
> * If you consider the target :
>
> <target name="idl2java" depends="init">
> <echo message=" Compiling the OMG IDL file ${file}" />
> <exec executable="${idl2java.compiler}" os="SunOS" >
> <env key="LD_LIBRARY_PATH"
> path="${ORB.lib.dir}:${env.LD_LIBRARY_PATH}" />
> <arg line="--auto-package --tie --output-dir ${destdir} ${flags}
> ${file}" />
> </exec>
> </target>
>
> * If I put the property auto-package to yes or by default, I want to
> execute :
> <arg line="--auto-package --tie --output-dir ${destdir} ${flags}
> ${file}" />
>
> * And If I put it to No :
> <arg line="--tie --output-dir ${destdir} ${flags} ${file}" />
Use ${auto-package} in your <arg line=.../>, with its value set
conditionally:
<property name="autopkgflag" value="yes"/>
<target name="idl2java">
<condition property="auto-package" value="--auto-package">
<equals arg1="${autopkgflag}" arg2="yes"/>
</condition>
<condition property="auto-package" value="">
<equals arg1="${autopkgflag}" arg2="no"/>
</condition>
<exec executable="echo">
<arg line="idl2java ${auto-package} --tie ..."/>
</exec>
</target>
Note: I used 'echo' because I don't have 'idl2java' (or any IDL files, for
that matter :), but hopefully you get the idea:
$ ant idl2java
idl2java:
[exec] idl2java --auto-package --tie ...
$ ant -Dautopkgflag=no idl2java
idl2java:
[exec] idl2java --tie ...
Diane
=====
([EMAIL PROTECTED])
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>