ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/etc/testcases/taskdefs macrodef.xml
Date Mon, 22 Dec 2003 09:46:23 GMT
peterreilly    2003/12/22 01:46:23

  Modified:    docs/manual/CoreTasks macrodef.html
               src/main/org/apache/tools/ant/taskdefs MacroDef.java
                        MacroInstance.java
               src/testcases/org/apache/tools/ant/taskdefs
                        MacroDefTest.java
               src/etc/testcases/taskdefs macrodef.xml
  Log:
  Macrodef can only see lower case attribute names due to its
  use of DynamicConfigurator.
  Fix the doc and the code to at least make this consistent.
  PR: 25687
  Obtained from: Geoffrey Wiseman
  
  Revision  Changes    Path
  1.7       +5 -1      ant/docs/manual/CoreTasks/macrodef.html
  
  Index: macrodef.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/macrodef.html,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- macrodef.html	3 Dec 2003 13:16:01 -0000	1.6
  +++ macrodef.html	22 Dec 2003 09:46:23 -0000	1.7
  @@ -59,7 +59,11 @@
         AT this location").
         The escape sequence @@{x} is used to allow @{x} to be
         placed in the text without substitution of x.
  -      This corresponds to the $${x} escape sequence for properties
  +      This corresponds to the $${x} escape sequence for properties.
  +    </p>
  +    <p>
  +      The case of the attribute is ignored, so @{myAttribute} is treated the
  +      same as @{MyAttribute}.
       </p>
       <h3>Parameters</h3>
       <table border="1" cellpadding="2" cellspacing="0">
  
  
  
  1.15      +2 -1      ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java
  
  Index: MacroDef.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MacroDef.java	3 Dec 2003 13:16:01 -0000	1.14
  +++ MacroDef.java	22 Dec 2003 09:46:23 -0000	1.15
  @@ -57,6 +57,7 @@
   import java.util.ArrayList;
   import java.util.List;
   import java.util.Map;
  +import java.util.Locale;
   import java.util.HashMap;
   
   import org.apache.tools.ant.AntTypeDefinition;
  @@ -293,7 +294,7 @@
                   throw new BuildException(
                       "Illegal name [" + name + "] for attribute");
               }
  -            this.name = name;
  +            this.name = name.toLowerCase(Locale.US);
           }
   
           /**
  
  
  
  1.14      +2 -1      ant/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java
  
  Index: MacroInstance.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- MacroInstance.java	16 Dec 2003 21:13:15 -0000	1.13
  +++ MacroInstance.java	22 Dec 2003 09:46:23 -0000	1.14
  @@ -57,6 +57,7 @@
   import java.util.ArrayList;
   import java.util.List;
   import java.util.Iterator;
  +import java.util.Locale;
   import java.util.Map;
   import java.util.Set;
   import java.util.HashSet;
  @@ -200,7 +201,7 @@
                   case STATE_EXPECT_NAME:
                       if (ch == '}') {
                           state = STATE_NORMAL;
  -                        String name = macroName.toString();
  +                        String name = macroName.toString().toLowerCase(Locale.US);
                           String value = (String) macroMapping.get(name);
                           if (value == null) {
                               ret.append("@{" + name + "}");
  
  
  
  1.6       +6 -0      ant/src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java
  
  Index: MacroDefTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MacroDefTest.java	3 Dec 2003 13:16:01 -0000	1.5
  +++ MacroDefTest.java	22 Dec 2003 09:46:23 -0000	1.6
  @@ -103,5 +103,11 @@
               "double",
               "@{prop} is 'property', value of ${property} is 'A property value'");
       }
  +
  +    public void testIgnoreCase() {
  +        expectLog(
  +            "ignorecase",
  +            "a is ab is b");
  +    }
   }
   
  
  
  
  1.6       +11 -0     ant/src/etc/testcases/taskdefs/macrodef.xml
  
  Index: macrodef.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/macrodef.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- macrodef.xml	3 Dec 2003 13:16:01 -0000	1.5
  +++ macrodef.xml	22 Dec 2003 09:46:23 -0000	1.6
  @@ -75,4 +75,15 @@
       <property name="property" value="A property value"/>
       <double prop="property"/>
     </target>
  +
  +  <target name="ignorecase">
  +    <macrodef name="ignore">
  +      <attribute name="MyAttribute"/>
  +      <sequential>
  +        <echo>@{myattribute} is @{MYATTRIBUTE}</echo>
  +      </sequential>
  +    </macrodef>
  +    <ignore myattribute="a"/>
  +    <ignore Myattribute="b"/>
  +  </target>
   </project>
  
  
  

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


Mime
View raw message