You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mark Lybarger <ml...@gmail.com> on 2005/07/05 16:29:34 UTC

ordered fileset or selective filelist

a filelist is ordered, a fileset is selective but non-ordered. i'd like to 
combine features of each, either an ordered fileset, or a selective filelist 
(don't include non-existant files).

in the example build.xml shown here, the default target doesn't work because 
there is no baz.xml, but the default2 target works fine. 

basically, i'm build war's and ear projects from a main "build all" type 
project. it should build the list of files in the order they're specified if 
they exist. is there anyway to get this functionality?

<!-- build.xml -->
<project name="anttest" default="default">

<target name="default">
<subant>
<filelist dir=".">
<file name="foo.xml"/>
<file name="bar.xml"/> 
<file name="baz.xml"/> 
</filelist>
</subant>
</target>

<target name="default2">
<subant>
<fileset dir=".">
<include name="foo.xml"/>
<include name="bar.xml"/> 
<include name="baz.xml"/> 
</fileset>
</subant>
</target>

</project>

<!-- foo.xml -->
<project name="anttest" default="default">
<target name="default">
<echo> foo.xml </echo>
</target>
</project>

<!-- bar.xml -->
<project name="anttest" default="default">
<target name="default">
<echo> bar.xml </echo>
</target>
</project>

Re: ordered fileset or selective filelist

Posted by Juergen Hermann <jh...@web.de>.
On Wed, 6 Jul 2005 08:59:57 -0400, Mark Lybarger wrote:

>I've got a macrodef, and am calling it as you mentioned, I just can't seem 
>to figure out how to conditionally call the subant only if hte file 
>exists...?

Use a fileset, not a buildpath, if the fileset is empty, subant should be a 
NOP.


Ciao, Jürgen



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


Re: ordered fileset or selective filelist

Posted by Mark Lybarger <ml...@gmail.com>.
I've got a macrodef, and am calling it as you mentioned, I just can't seem 
to figure out how to conditionally call the subant only if hte file 
exists...?

<macrodef name="subproject"> 
<attribute name="filename" default="NOT SET"/> 
<sequential>
<available file="@{filename}" property="file.found"/>
<subant>
<buildpath>
<pathelement location="@{filename}"/>
</buildpath>
</subant>
</sequential> 
</macrodef> 

<target name="default4">
<subproject filename="foo.xml"/>
<subproject filename="bar.xml"/>
<subproject filename="baz.xml"/>
</target>


On 7/5/05, Juergen Hermann <jh...@web.de> wrote:
> 
> On Tue, 5 Jul 2005 10:29:34 -0400, Mark Lybarger wrote:
> ><subant>
> ><filelist dir=".">
> ><file name="foo.xml"/>
> ><file name="bar.xml"/>
> ><file name="baz.xml"/>
> ></filelist>
> ></subant>
> 
> use macrodef (define a <subproject> macro that conditionally calls 
> subant),
> and just list the macro calls in order.
> 
> 
> Ciao, Jürgen
> 
> 
>

RE: ordered fileset or selective filelist

Posted by Dominique Devienne <dd...@gmail.com>.
> From: Mark Lybarger [mailto:mlybarger@gmail.com]
> 
> a filelist is ordered, a fileset is selective but non-ordered. i'd like to
> combine features of each, either an ordered fileset, or a selective
> filelist (don't include non-existant files).
> 
> basically, i'm build war's and ear projects from a main "build all" type
> project. it should build the list of files in the order they're specified
> if they exist. is there anyway to get this functionality?

Then simply use a <path> within subant rather than either a <fileset> or a
<filelist>. A <path> is ordered, and drops non-existent files. --DD

<target name="default2">
  <subant>
    <buildpath>
      <pathelement location="foo.xml"/>
      <pathelement location="bar.xml"/>
      <pathelement location="baz.xml"/>
    </buildpath>
  </subant>
</target>


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


Re: ordered fileset or selective filelist

Posted by Juergen Hermann <jh...@web.de>.
On Tue, 5 Jul 2005 10:29:34 -0400, Mark Lybarger wrote:
><subant>
><filelist dir=".">
><file name="foo.xml"/>
><file name="bar.xml"/> 
><file name="baz.xml"/> 
></filelist>
></subant>

use macrodef (define a <subproject> macro that conditionally calls subant), 
and just list the macro calls in order.


Ciao, Jürgen



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