ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject MacroDef: use attribute inside another attributes default clause
Date Tue, 21 Oct 2003 09:43:48 GMT
I want to reuse one attribute for setting the default value of another one.
But that is not possible because the name is not resolved on that place.

    <macrodef name="dep">
        <attribute name="root"/>
        <attribute name="file" default="${root}.dep"/>
        <sequential>
        <script language="javascript"> <![CDATA[
            // attribute expansion from macrodef (script can´t reach the
values)
            root     = "${root}";
            filename = "${file}";

Example:  <dep root="foo"/>
The "filename" is not set to "foo.dep" but to "${root}.dep".

Workaround:
Test that behaviour and reset filename:

        <script language="javascript"> <![CDATA[
            // attribute expansion from macrodef (script can´t reach the
values)
            root     = "${root}";
            filename = "${file}";

            // handle the problem that the ${root} is not replaced in the
            // attribute tag. Mask the ${root} string - should not be
replaced
            // in the if-clause.
            if (filename.equals("${ro"+"ot}.dep")) {
                filename = "${root}.dep";
            }
             

Is that a bug (which will be fixed - maybe until 1.6 final) or is it a
bigger problem?


Jan

      

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message