ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <sflo...@nc.rr.com>
Subject Re: Passing list of classes to exclude from build as macrodef attribute
Date Fri, 09 Mar 2012 13:20:00 GMT

Why not just use a child element for the macrodef?  Something like:

<macrodef name="jpp-javac-convert">
     <element name="additions" implicit="yes"/>

     <sequential>
         <javac srcdir="${src}" destdir="${class}">
             <additions/>
         </javac>
    </sequential>
</macrodef>

Then you can do things like:

<jpp-javac-convert>
     <exclude name="**/Foo.java"/>
     <exclude name="**/Bar.java"/>
</jpp-javac-convert>


On Thu, 8 Mar 2012, Noam Postavsky wrote:

> I have a build.xml with some targets that are identical except for
> some excluded classes. Currently I'm passing each class name as an
> argument to macrodef like so:
>
>  <macrodef name="jpp-javac-convert">
>
>    <attribute name="exclude1" default="" description="class name (no
> extension) to exclude from cap"/>
>    <attribute name="exclude2" default="" description="class name (no
> extension) to exclude from cap"/>
>    <attribute name="exclude3" default="" description="class name (no
> extension) to exclude from cap"/>
>    <attribute name="exclude4" default="" description="class name (no
> extension) to exclude from cap"/>
>    <sequential>
>
>      <javac srcdir="${src}"
>             destdir="${class}"
>             >
>        <exclude name="**/@{exclude1}.java"/>
>        <exclude name="**/@{exclude2}.java"/>
>        <exclude name="**/@{exclude3}.java"/>
>        <exclude name="**/@{exclude4}.java"/>
>      </javac>
>
>      <delete file="${class}/package/path/@{exclude1}.class" />
>      <delete file="${class}/package/path/@{exclude2}.class" />
>      <delete file="${class}/package/path/@{exclude3}.class" />
>      <delete file="${class}/package/path/@{exclude4}.class" />
>
>
> Is there a way to pass a list of excluded classes as a single
> parameter to macrodef? It seems like it should be possible with
> fileset, or filelist, or patternset, or ... something? I'm just not
> sure how it all fits together.
>
> thanks, Noam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Scot P. Floess             RHCT  (Certificate Number 605010084735240)
Chief Architect FlossWare  http://sourceforge.net/projects/flossware
                            http://flossware.sourceforge.net
                            https://github.com/organizations/FlossWare

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


Mime
View raw message