ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject RE: condition in 1.3
Date Thu, 06 Sep 2001 18:49:58 GMT
--- "Zanabria, Moises" <Moises_Zanabria@bmc.com> wrote:
> I made a build.xml with different targets names, i.e. release build,
> daily build or default build , I call my ant script with:
> 
> ant -Dtag="%TAG%" 
> 
> The target name depend on $TAG value, so I would like to compare the
> $TAG value with tag values in my build.xml.
>
> Diane could you please more extensive in this part, I'll really
> appreciate.
> 
> >>you could try seeing whether it relies on anything else that's
> >>changed, and if doesn't, you could just pick it up and add it to
> >>your 1.3.

Sorry, but I just tried adding the <condition> task to my 1.3, and it
turns out it depends on lots of other changes to 1.4, so that's not going
to be an option for you afterall (but given what you're asking to do, I
don't think the <condition> task would've saved you all that much anyway).
For 1.3, you can do something like the following (just a skeleton
example):

<project name="projname" default="build" basedir=".">
  <property name="${tag}.build" value="true"/>
  <target name="build" depends="release, daily, default"/>
  <target name="release" if="release.build">
    <echo message="Running release build..."/>
  </target>
  <target name="daily" if="daily.build">
    <echo message="Running daily build..."/>
  </target>
  <target name="default" if="default.build">
    <echo message="Running default build..."/>
  </target>
</project>

Then run:

$ ant -Dtag=release     # or build or default

I'd also recommend you run with org.apache.tools.ant.NoBannerLogger as
your logger, so you don't get the targets that don't run printing out as
well (personally, I think NoBannerLogger should be the default logger).
Instead of typing all that every time you run 'ant', you can stick it in
an env var and then just reference that var on the command-line (eg.,
export ANT_ARGS="-logger org.apache.tools.ant.NoBannerLogger", then run
'ant -Dtag=release $ANT_ARGS'). (Hmm, come to think of it, maybe I should
put a change through on the wrapper scripts to pass a $ANT_ARGS.)
 
Hope this helps,
Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

Mime
View raw message