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 34574] New: - macros don't work well together with antcall.
Date Fri, 22 Apr 2005 12:01:54 GMT
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=34574>.
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=34574

           Summary: macros don't work well together with antcall.
           Product: Ant
           Version: 1.6.2
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: janssk1@hotmail.com


Hello, 

First of all, i know it is not a recommended practice to use antcall in a 
macro, but i don't see many other options to achieve my goals. What i actually 
want to do is to do some conditional things inside a macro. I have a macro that 
generates hibernate files using xdoclet, but only if the hibernate mapping 
files are not up to date. This conditional logic is (in standard ant) only 
possible though the use of conditional targets ( if/unless attributes). This 
means that i have to call a target inside a macro, leading to the antcall. 

The problem if i define in my macro eg a patternset with a macro element as 
content, this patternset cannot be used in the target called by antcall. It 
seems that the macro elements are not replaced correctly anymore after a call 
to antcall. 

This stripped down build file shows the problem. 

<project name="test">

    <target name="doclet_check">
        <uptodate property="doclet.uptodate" value="true" 
targetfile="${basedir}">
            <srcfiles dir="${basedir}">
                <patternset refid="doclet.src.pattern"/> <!-- reference to a 
pattern defined by the macro.. -->
            </srcfiles>
        </uptodate>
    </target>

    <target name="doclet" depends="doclet_check" unless="doclet.uptodate">
    </target>

    <macrodef name="docletmacro">
        <element name="optionalpatterns" implicit="yes"/>
        <sequential>
            <patternset id="doclet.src.pattern">
                <optionalpatterns/>
            </patternset>
            <antcall target="doclet" inheritRefs="true">
            </antcall>
        </sequential>
    </macrodef>

    <target name="test">
        <docletmacro>
            <include name="*.java"/>
        </docletmacro>
    </target>

</project>


executing the 'test' target leads to the following exception:

C:\views\janssk1_hp\elisa_dev\ni\components\test\testbuild.xml:26: The 
following error occurred whil
e executing this line:
C:\views\janssk1_hp\elisa_dev\ni\components\test\testbuild.xml:20: The 
following error occurred whil
e executing this line:
C:\views\janssk1_hp\elisa_dev\ni\components\test\testbuild.xml:4: The 
<patternset> type doesn't supp
ort the nested "optionalpatterns" element.

-- 
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


Mime
View raw message