ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 24411] New: - odd presetdef behavior with "additive" task parameters like javac srcdir
Date Tue, 04 Nov 2003 22:05:36 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24411>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24411

odd presetdef behavior with "additive" task parameters like javac srcdir

           Summary: odd presetdef behavior with "additive" task parameters
                    like javac srcdir
           Product: Ant
           Version: 1.6Beta
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: jmlennon@us.ibm.com


If you use presetdef to create a new task definition,
and you supply a default value to a "cumulative" parameter
like javac's "srcdir", users of that new definition
cannot override that default value, they can only add
to it.  I find this behavior surprising, and I feel that
it seriously limits the usefulness of "presetdef".

Many tasks have cumulative parameters like this, e.g.:

   javac: srcdir, *classpath, extdirs, ...
   javadoc: sourcepath, packagenames, ...
   jar:  includes, excludes, ...

I suspect that users of presetdef will find it much more
useful if default values of these cumulative parameters
can be overridden, not just supplemented.

BTW, aside from this nit, "presetdef" is a wonderful
addition to Ant.  THanks!

The following build file illustrates the problem

========= CUT HERE ================================

<?xml version="1.0"?>

<!--
######################################################################
 To reproduce:
 1.  Create two empty files:
       default/empty.java
       override/empty.java

 2. Execute this build file with Ant v1.6
       C:\temp>ant
       Buildfile: build.xml

       all:
        [my.javac] Compiling 2 source files
        [my.javac] [parsing started C:\temp\default\empty.java]
        [my.javac] [parsing completed 31ms]
        [my.javac] [parsing started C:\temp\override\empty.java]
        [my.javac] [parsing completed 0ms]
        [my.javac] [total 391ms]

       BUILD SUCCESSFUL
       Total time: 1 second
       C:\temp>ant -version
       Apache Ant version 1.6beta2 compiled on October 31 2003
       C:\temp>

     Note that *both* files got compiled.

######################################################################-->

<project name="presetdef" default="all">

  <presetdef name="my.javac">
    <!-- Provide default value for source directory. -->
    <javac srcdir="default" verbose="true"/>
  </presetdef>

  <target name="all">
    <!-- I expected the following task to compile just the contents of
         the directory "override", but (surprisingly) it also compiles
         the contents of "default". -->
    <my.javac srcdir="override"/>
  </target>

</project>

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


Mime
View raw message