You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/10/04 17:55:49 UTC

DO NOT REPLY [Bug 40678] New: - [Patch] Allow macrodef to have arbitary xml elements

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40678>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40678

           Summary: [Patch] Allow macrodef to have arbitary xml elements
           Product: Ant
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: peterreilly@apache.org


Currently <macrodef> only allows the creation of new tasks.
This makes it difficult to for example compose conditions
from other conditions - see 
http://marc.theaimsgroup.com/?t=115928538600003&r=1&w=2
for a dicussion.

This patch allows this.
Overview of changes:
<macrodef> to have a new element <fragment>, this can contain
arbitary xml and associate it with a name. The name *has* to
have a '-' in it (this means that the fragment will not be
confused with refection based elements).
If a fragment is used, macrodef will create a MacroFragmentTask
instead of a MacroInstance. This MacroFragmentTask extends MacroInstance
and implements MacroFragment.
MacroInstance has been modified a little so it can be extended.
UnknownElement has been modifed to check if child unknown elements
are MacroInstances and if so expand them by calling MacroFragment.getUnknowns()

Usage:
   <macrodef name="file-sets">
      <fragment>
        <fileset dir="build/a"/>
        <fileset dir="build/b"/>
      </fragment>
    </macrodef>

    <copy todir="build/c">
      <file-sets/>
    </copy>


and:
    <macrodef name="is-empty-file">
      <attribute name="file" />
      <fragment>
        <and>
          <available file="@{file}" type="file" />
          <length file="@{file}" length="0" />
        </and>
      </fragment>
    </macrodef>

    <condition property="build.is.empty">
      <is-empty-file file="build.xml"/>
    </condition>

    <echo>${build.is.empty}</echo>
    <touch file="empty.file"/>

    <condition property="empty.is.empty">
      <is-empty-file file="empty.file"/>
    </condition>

    <echo>${empty.is.empty}</echo>

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40678] - [Patch] Allow macrodef to have arbitary xml elements

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40678>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40678


peterreilly@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #18962|0                           |1
        is obsolete|                            |




------- Additional Comments From peterreilly@apache.org  2007-09-04 04:36 -------
Created an attachment (id=20766)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20766&action=view)
new patch - separate task fragmentdef

This is a new patch that adds a new task - fragmentdef.
It allows the definition of fairly arbitary element sequences
that can be placed in tasks or types. It does not have
the restriction of having a "-" in the name.
Usage:
<fragmentdef name="allfilesets">
  <sequential>
    <fileset dir="a" includes="*.jar"/>
    <fileset dir="b" includes="*.jar"/>
  </sequential>
</fragmentdef>

<javac ..>
   <classpath>
     <allfilesets/>
   </classpath>
</javac>

<jar jarfile="all.jar">
   <allfilesets/>
</jar>


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40678] - [Patch] Allow macrodef to have arbitary xml elements

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40678>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40678





------- Additional Comments From peterreilly@apache.org  2007-09-17 04:04 -------
Created an attachment (id=20833)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20833&action=view)
New patch to enable any marcodef to be used.

This patch allows macrodef to be used
to define any elements to be used.
for example:
<macrodefdef name="allfilesets">
  <sequential>
    <fileset dir="a" includes="*.jar"/>
    <fileset dir="b" includes="*.jar"/>
  </sequential>
</fragmentdef>

<javac ..>
   <classpath>
     <allfilesets/>
   </classpath>
</javac>

<jar jarfile="all.jar">
   <allfilesets/>
</jar>

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40678] - [Patch] Allow macrodef to have arbitary xml elements

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40678>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40678





------- Additional Comments From peterreilly@apache.org  2006-10-04 08:58 -------
Created an attachment (id=18962)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18962&action=view)
patch containing differences and new files


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40678] - [Patch] Allow macrodef to have arbitary xml elements

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40678>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40678





------- Additional Comments From gudnabrsam@yahoo.com  2006-10-05 07:09 -------
1. It kicks ass that you were able to get something working here.
2. It's a little bit of a drawback that a fragment has to have a hyphen in the
name.  :(

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40678] - [Patch] Allow macrodef to have arbitary xml elements

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40678>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40678





------- Additional Comments From peterreilly@apache.org  2006-10-05 15:10 -------
I think that the restiction can be removed.
the code can ask IH if the parent class has
explicit named elements, still we should
highlight that since the fragment can be used
nearly anywhere, one should be carefull with
the choice of name.

One issue outstanding is error reporting,
the location of the use of the fragment is
lost, this may not be an issue for some uses
(the task that has the fragment will be complaining)
but we need to experiment a little.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40678] - [Patch] Allow macrodef to have arbitary xml elements

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40678>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40678





------- Additional Comments From stevel@apache.org  2007-09-04 05:54 -------
+1; much better re-use, but I'm not sure about the name. <datadef>? 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40678] - [Patch] Allow macrodef to have arbitary xml elements

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40678>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40678





------- Additional Comments From peterreilly@apache.org  2007-09-04 06:09 -------
names.....
Another alternative is to allow macrodef to be used like
this. I am a little worried about this (changing macrodef)
as it may effect current scripts, but it is something to
consider.



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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