ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <>
Subject Re: AW: how to access/iterate id in <script>
Date Thu, 04 Jan 2007 09:53:45 GMT
On 1/4/07, <> wrote:
> Quoting
> > project.getProperty("source.dirs");
> source.dirs is an id, not a property. i assume the distinction is important,
> since getProperty returns null (which is correct but unhelpful).
You need to use project.getReference("source.dirs"),
however you need to do more things as "source.dirs" is a DirSet which extends
AbstractFileSet. - see the <script> manual page for an example.
The following may work (not tested).
     var fs = project.getReference("source.dirs");
      // Get the  (array) of that fileset
      ds = fs.getDirectoryScanner(project);
      srcDirs = ds.getIncludedDirectories();

Personally I would just use ant-contrib's <for> task to do
the iteration - it understands filesets/dirsets and paths.

<project default="test" xmlns:ac="antlib:net.sf.antcontrib">
  <typedef uri="antlib:net.sf.antcontrib">
      <fileset dir="${user.home}/apps/ant-contrib"
  <target name="test">
    <dirset id="source.dirs" dir=".."/>
    <ac:for param="dir">
      <dirset refid="source.dirs"/>
        <echo>dir is @{dir}</echo>

> - p
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message