ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murray, Mike" <...@ptc.com>
Subject RE: Detecting -D on command line
Date Sat, 20 Nov 2004 01:42:19 GMT
Here is another way...

<target name="makeArchive" depends="init">
   <condition property="subDirString" value="_${subDir}"/>
      <isset property="subDir"/>
   </condition>
   <property name="subDirString" value=""/>  <!-- default, if not already set -->
   ...
</target>

-----Original Message-----
From: Robert Mark Bram [mailto:relaxedrob@optusnet.com.au]
Sent: Friday, November 19, 2004 7:32 PM
To: Ant
Subject: Detecting -D on command line 


Hi All!

In a script where you need to respond differently to whether or not a 
command line argument has been set, this is the way I am currently 
responding:

<target name="subDirOn" if="subDir">
    <property name="subDirString" value="_${subDir}" />
</target>
<target name="subDirOff" unless="subDir">
    <property name="subDirString" value="" />
</target>

<target name="makeArchive" depends="init, subDirOn, subDirOff">
  ...
</target>

I do not declare a subDir property declared outside subDirOn or subDirOff 
because I noticed that always triggers subDirOn.

My question?

Is there an easier way to do this? :)

Thanks for any advice!

Rob
:)

-- 
Robert Mark Bram
http://phd.netcomp.monash.edu.au/RobertMarkBram/default.asp
B.Comp.(Systems Development/Business Systems)
B.Net.Comp.(Hons)
Doctor of Philosophy Student

School of Network Computing
Faculty of Information Technology
Monash University
Peninsula Campus
McMahons Rd
Frankston, VIC 3199
AUSTRALIA


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

Mime
View raw message