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: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to