ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@bost.de>
Subject Re: A question about "available" and doing conditionals in a build xml file.
Date Wed, 17 May 2000 15:25:02 GMT
>>>>> "KW" == Ken Wood <kwood@i2.com> writes:

 KW> I don't seem to find much in the documentation on the use of
 KW> properties set by 'available' to do conditional things in the
 KW> ".xml" file.

Actually the documentation is missing some more of the newer changes
to Ant (for some value of newer). You won't find the nested <exclude>
element inside the <javac> element at all.

The best documentation you can get is the source and the build files
of the Jakarta projects I'm afraid. Contributions to the documentation
are welcome.

 KW> Well, I never saw "unless" in any of the documentation....

Neither did I. AFAIK the only things supporting unless are the sub elements
named include and exclude inside tasks derived from
org.apache.tools.ant.taskdefs.MatchingTask - all(?) tasks working on
multiple files that is.

This is the current situation and I don't know whether an unless will
be added to Target or whether it will be dropped from MatchingTask
again because a better way to achieve the same has been found.

 KW> For example, I'm building a target to bundle up the files for a
 KW> distribution, and on Unix I need to copy some "sh" files into the
 KW> 'bin' directory, but on windows I need to copy some "bat" files
 KW> into the bin directory.

copydir is derived from MatchingTask, maybe you can use something like

  <available file="C:\AUTOEXEC.BAT" property="os.is.windows" />

  <copy src="src/bin" dest="dest/bin">
      <exclude name="**/*.bat" unless="os.is.windows" />
      <exclude name="**/*.sh" if="os.is.windows" />
  </copy>

Or you could use exec tasks and set the os attribute - which would
mean an exec task for every flavour of Unix you want to support.

HTH

        Stefan

Mime
View raw message