ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: conditional fileset
Date Thu, 05 Sep 2002 18:35:38 GMT
It's not pretty, but you could use Ant-contrib <tryCatch> which would
reference the <fileset> internally, and if that throws an exception, then
the <fileset> was not defined:

<trycatch property="fileset.notdefined">
  <try>
    <fileset refid="ID of fileset that may exist" />
  </try>
  <catch />
</trycatch>

I'm not sure whether that's what you want, or whether the <catch> block
needs to contain a task. --DD

-----Original Message-----
From: Ilja Preuß [mailto:preuss@disy.net] 
Sent: Thursday, September 05, 2002 3:26 AM
To: Ant Users List
Subject: Re: conditional fileset

> > The problem I am facing is that that target should be executed
> > automatically from some other targets [...] but
> > *only* if the fileset is defined (obviously...).
>
> If by "defined" you mean contains files:

No, by "defined" I mean - well, defined... :-)

The projects scripts need to define wether something needs to be copied, and
if so, which files.

The files can easily be defined through a fileset. Obviously, if nothing
needs to be copied, you don't need to define the fileset, so I thought to
use the *existence* of the fileset as the trigger to copy the files.

That is, I have a generic target

<target name="copyConfig" if="???">
   <copy toDir="${cadenza.dist}/config">
      <fileset refid="resources.config"/>
   </copy>
</target>

So, if a project defines a fileset "resources.config", those files should
get copied. If there is no fileset associated to that id, the target should
be skipped.

Is it possible to somehow check for the existence of a fileset? (Mhh,
checking wether a specific ID is in use would in fact suffice, I guess...)

Thanks for your help, Ilja


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

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


Mime
View raw message