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 2004/05/23 00:09:42 UTC

DO NOT REPLY [Bug 29153] New: - macro with element parameter can't call another macro with element parm of same name

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=29153>.
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=29153

macro with element parameter can't call another macro with element parm of same name

           Summary: macro with element parameter can't call another macro
                    with element parm of same name
           Product: Ant
           Version: 1.6.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: shankar@cotagesoft.com


If I want to have two macros, each with an <element> parameter with the same
name (because, say, they have the same semantics - e.g. <wsddfiles>, or
something like that), then I can't one macro from the other.

See the attached test case. Both macro1 and macro2 have the same parameter
element ("<files>"). But there's no way for me to call macro2 from macro1 and
just pass on the <files> that I received.


  <macrodef name="macro1">
    <element name="files"/>
    <sequential>
      <pathconvert property="foo" pathsep=":">
        <path>
          <files/>
        </path>
      </pathconvert>
      <echo message="${foo}"/>
    </sequential>
  </macrodef>

  <macrodef name="macro2">
    <element name="files"/> <!-- same elem parm name as that for macro1 -->
    <sequential>
      <macro1>
        <files/>            <!-- HERE: Trying to pass on the macro parms -->
      </macro1>
      <echo message="${foo}"/>
    </sequential>
  </macrodef>

This causes the error:

C:\Workarea\CSIMain\csi\xx.xml:32: Following error occured while executing this line
C:\Workarea\CSIMain\csi\xx.xml:18: unsupported element fileset

(The line in question is a call to macro2; line 18 is the <macro1> invocation in
<macro2>).

I also tried invoking macro1 in macro2 like this:

      <macro1>
        <files>
          <files/>
        </files>
      </macro1>

That didn't help, either.

It would be nice if ant automatically figured out that I was passing the element
reference directly to another macro, and did not unwrap it right away. Failing
that, if the workaround I attempted above worked, that would be great, too.

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