Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Perhaps you can use a couple of <a href="http://ant.apache.org/manual/Tasks/scriptdef.html" rel="nofollow"><code>&lt;scriptdef&gt;</code></a> tasks to help break up those macros.</p> <p>First, one that takes a comma-separated list of directories and generates the <code>&lt;union&gt;</code> from them. You supply the <code>refid</code> you want to use to refer to the union as the <code>id</code> attribute. There are optional includes and excludes.</p> <pre><code>&lt;scriptdef name="dirs2union" language="javascript"&gt; &lt;attribute name="dirs" /&gt; &lt;attribute name="id" /&gt; &lt;attribute name="includes" /&gt; &lt;attribute name="excludes" /&gt; &lt;![CDATA[ var dirs = attributes.get( "dirs" ).split( "," ); var includes = attributes.get( "includes" ); var excludes = attributes.get( "excludes" ); var union = project.createDataType( "union" ); project.addReference( attributes.get( "id" ), union ); for ( var i = 0; i &lt; dirs.length; i++ ) { var fs = project.createDataType( "fileset" ); fs.setDir( new java.io.File( dirs[i] ) ); if ( includes ) fs.setIncludes( includes ); if ( excludes ) fs.setExcludes( excludes ); union.add( fs ); } ]]&gt; &lt;/scriptdef&gt; </code></pre> <p>The second - very similar - script does the equivalent for path generation:</p> <pre><code>&lt;scriptdef name="dirs2path" language="javascript"&gt; &lt;attribute name="dirs" /&gt; &lt;attribute name="id" /&gt; &lt;![CDATA[ var dirs = attributes.get( "dirs" ).split( "," ); var path = project.createDataType( "path" ); project.addReference( attributes.get( "id" ), path ); for ( var i = 0; i &lt; dirs.length; i++ ) { var pe = project.createDataType( "path" ); pe.setLocation( new java.io.File( dirs[i] ) ); path.add( pe ); } ]]&gt; &lt;/scriptdef&gt; </code></pre> <p>An example use might then be something like:</p> <pre><code>&lt;property name="dirs" value="Proj2/src,Proj3/src" /&gt; &lt;dirs2union dirs="${dirs}" id="my.union" includes="**/*.java" /&gt; &lt;dirs2path dirs="${dirs}" id="my.path" /&gt; ... later (e.g.) ... &lt;union refid="my.union" /&gt; &lt;classpath refid="my.path" /&gt; </code></pre> <p>You could then modify your macros to either take the <code>dirs</code> attribute and generate the union and classpath internally, or perhaps generate these once elsewhere and just pass in the references.</p> <p>I've not attempted to include the <code>@{root}</code> directories in this illustration, but it should be possible to adapt the above for that.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload