You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by warhero <be...@gmail.com> on 2007/07/24 03:17:10 UTC
help with some conditional logic..
<?xml version="1.0" encoding="utf-8" />
<project name="testing" default="test2" basedir="./">
<property file="build.properties" />
<target name="test1">
<!-- if props.someprop --> ##how use some logic based on a property from
the props file that will either execute the "exec" or just pass it?
<exec executable"myExecutable" >
<arg line="-some-command" />
</exec>
<!-- end -->
</target>
<target name="test2" depends="test1">
<exec executable="anotherExecutable">
<arg line="-some-command" />
</exec>
<target>
</project>
So what im trying to do is only execute if a property is true.. Obviously
some pretty simple logic but doing that in ant?
thanks
--
View this message in context: http://www.nabble.com/help-with-some-conditional-logic..-tf4133302.html#a11755475
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: help with some conditional logic..
Posted by aaron smith <be...@gmail.com>.
That's perfect. Thanks much.
Re: help with some conditional logic..
Posted by warhero <be...@gmail.com>.
Hey Wascal,
Thanks, this is good. I've got another question if you don't mind me asking.
I've been looking into installation steps, and I'm looking for a way I can
use these jar's without actually having to update any ant installation /
configuration.
We're distributing build systems to developers and I don't want to have to
force ant updates.. How can I reference and use these jars in build.xml?
I've tried a couple different things::
<taskdef resource="com.idaremedia.antx"
classpath="${basedir}/build/jar/AntX_tasks.jar" />
<taskdef resource="com.idaremedia.antx"
classpath="${basedir}/build/jar/JWare_apis.jar" />
I define that in my "project", but then when using the "do" task it comes up
as not found..
Any ideas?
Thanks much
Aaron
Wascally Wabbit wrote:
>
> Try the flow control tasks that are in the AntXtras third party
> package @ antxtras.sf.net.
>
> For your example:
> <do if="props.someprop">
> <exec.../>
> </do>
>
> If you'd like to make sure the property is "true" use:
> <do ifTrue="props.someprop">
> <exec.../>
> </do>
>
> For multiple properties something like:
> <do ifall="prop1,prop2,prop3">
> <exec.../>
> </do>
>
> HTH,
> -The Wabbit
>
>
> warhero wrote:
>> <?xml version="1.0" encoding="utf-8" />
>> <project name="testing" default="test2" basedir="./">
>>
>> <property file="build.properties" />
>>
>> <target name="test1">
>> <!-- if props.someprop --> ##how use some logic based on a property
>> from
>> the props file that will either execute the "exec" or just pass it?
>> <exec executable"myExecutable" >
>> <arg line="-some-command" />
>> </exec>
>> <!-- end -->
>> </target>
>>
>> <target name="test2" depends="test1">
>> <exec executable="anotherExecutable">
>> <arg line="-some-command" />
>> </exec>
>> <target>
>>
>> </project>
>>
>> So what im trying to do is only execute if a property is true.. Obviously
>> some pretty simple logic but doing that in ant?
>>
>> thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/help-with-some-conditional-logic..-tf4133302.html#a11756178
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: help with some conditional logic..
Posted by Wascally Wabbit <wa...@earthling.net>.
Try the flow control tasks that are in the AntXtras third party
package @ antxtras.sf.net.
For your example:
<do if="props.someprop">
<exec.../>
</do>
If you'd like to make sure the property is "true" use:
<do ifTrue="props.someprop">
<exec.../>
</do>
For multiple properties something like:
<do ifall="prop1,prop2,prop3">
<exec.../>
</do>
HTH,
-The Wabbit
warhero wrote:
> <?xml version="1.0" encoding="utf-8" />
> <project name="testing" default="test2" basedir="./">
>
> <property file="build.properties" />
>
> <target name="test1">
> <!-- if props.someprop --> ##how use some logic based on a property from
> the props file that will either execute the "exec" or just pass it?
> <exec executable"myExecutable" >
> <arg line="-some-command" />
> </exec>
> <!-- end -->
> </target>
>
> <target name="test2" depends="test1">
> <exec executable="anotherExecutable">
> <arg line="-some-command" />
> </exec>
> <target>
>
> </project>
>
> So what im trying to do is only execute if a property is true.. Obviously
> some pretty simple logic but doing that in ant?
>
> thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: help with some conditional logic..
Posted by Dominique Devienne <dd...@gmail.com>.
On 7/23/07, warhero <be...@gmail.com> wrote:
> bill/wilandra wrote:
> > Create a target named init which will define/set props.someprop to any
> > value.
> > <target name="test1" depends="init" if="props.someprop">
> This would kind of work. But this will fail to execute all commands in a
> "depends" chain. if one of the if tests isn't met then subsequent target's
> won't execute.
FTR, that's not quite true. An if/unless on a target affects only that
target's content, and the dependency chain is always executed before
the if/unless is evaluated, which is why the target that sets or not
the property tested is listed as a dependency. --DD
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: help with some conditional logic..
Posted by warhero <be...@gmail.com>.
bill/wilandra wrote:
>
> Create a target named init which will define/set props.someprop to any
> value.
> <target name="test1" depends="init" if="props.someprop">
>
> HTH Bill
>
> --
> This would kind of work. But this will fail to execute all commands in a
> "depends" chain. if one of the if tests isn't met then subsequent target's
> won't execute.
>
> Aaron
>
>
> warhero wrote:
>> <?xml version="1.0" encoding="utf-8" />
>> <project name="testing" default="test2" basedir="./">
>>
>> <property file="build.properties" />
>>
>> <target name="test1">
>> <!-- if props.someprop --> ##how use some logic based on a property
>> from
>> the props file that will either execute the "exec" or just pass it?
>> <exec executable"myExecutable" >
>> <arg line="-some-command" />
>> </exec>
>> <!-- end -->
>> </target>
>>
>> <target name="test2" depends="test1">
>> <exec executable="anotherExecutable">
>> <arg line="-some-command" />
>> </exec>
>> <target>
>>
>> </project>
>>
>> So what im trying to do is only execute if a property is true.. Obviously
>> some pretty simple logic but doing that in ant?
>>
>> thanks
>>
>
>
--
View this message in context: http://www.nabble.com/help-with-some-conditional-logic..-tf4133302.html#a11756516
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: help with some conditional logic..
Posted by Bill Rich <bi...@wilandra.com>.
Create a target named init which will define/set props.someprop to any
value.
<target name="test1" depends="init" if="props.someprop">
HTH Bill
warhero wrote:
> <?xml version="1.0" encoding="utf-8" />
> <project name="testing" default="test2" basedir="./">
>
> <property file="build.properties" />
>
> <target name="test1">
> <!-- if props.someprop --> ##how use some logic based on a property from
> the props file that will either execute the "exec" or just pass it?
> <exec executable"myExecutable" >
> <arg line="-some-command" />
> </exec>
> <!-- end -->
> </target>
>
> <target name="test2" depends="test1">
> <exec executable="anotherExecutable">
> <arg line="-some-command" />
> </exec>
> <target>
>
> </project>
>
> So what im trying to do is only execute if a property is true.. Obviously
> some pretty simple logic but doing that in ant?
>
> thanks
>