You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2003/09/23 15:55:53 UTC

cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs MacroDefTest.java

peterreilly    2003/09/23 06:55:52

  Modified:    docs/manual/CoreTasks macrodef.html
               src/etc/testcases/taskdefs macrodef.xml
               src/main/org/apache/tools/ant/taskdefs MacroDef.java
                        MacroInstance.java
               src/testcases/org/apache/tools/ant/taskdefs
                        MacroDefTest.java
  Log:
  remove attributestyle attribute from macrodef
  
  Revision  Changes    Path
  1.3       +0 -33     ant/docs/manual/CoreTasks/macrodef.html
  
  Index: macrodef.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/macrodef.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- macrodef.html	15 Aug 2003 09:33:45 -0000	1.2
  +++ macrodef.html	23 Sep 2003 13:55:52 -0000	1.3
  @@ -38,17 +38,6 @@
           </td>
           <td valign="top" align="center">No</td>
         </tr>
  -      <tr>
  -        <td valign="top">attributestyle</td>
  -        <td valign="top">
  -          <em>Temporary</em>
  -          this attribute specifies if the attribute is in ant style
  -          (i.e. ${attributeName}) or xpath style (i.e @attributeName).
  -          Valid values are "ant" and "xpath". The default value
  -          is "ant".
  -        </td>
  -        <td valign="top" align="center">No</td>
  -      </tr>
       </table>
         <h3>Parameters specified as nested elements</h3>
       <h4>attribute</h4>
  @@ -63,11 +52,6 @@
         task using the ant property notation - ${attribute name}.
         Note that is not an actual ant property.
       </p>
  -    <p>
  -      If the attribute style is set to "xpath", the attribute is
  -      specified in the body of the template task by prefixing the
  -      name with a "@".
  -    </p>
       <h3>Parameters</h3>
       <table border="1" cellpadding="2" cellspacing="0">
         <tr>
  @@ -138,23 +122,6 @@
         &lt;echo&gt;this is a test&lt;/echo&gt;
      &lt;/some-tasks&gt;
   &lt;/testing&gt;
  -      </pre>
  -    </blockquote>
  -    <p>
  -      The following fragment sets the attribute style to "xpath"
  -      for the macro definition &lt;testing&gt; and calls the
  -      macro. The fragment should output "attribute is this is a test".
  -    </p>
  -    <blockquote>
  -      <pre>
  -&lt;macrodef name="testing" attributestyle="xpath"&gt;
  -   &lt;attribute name="abc"/&gt;
  -   &lt;sequential&gt;
  -      &lt;echo&gt;attribute is @abc&lt;/echo&gt;
  -   &lt;/sequential&gt;
  -&lt;/macrodef&gt;
  -
  -&lt;testing abc="this is a test"/&gt;
         </pre>
       </blockquote>
       <p>
  
  
  
  1.3       +0 -10     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- macrodef.xml	15 Aug 2003 09:33:45 -0000	1.2
  +++ macrodef.xml	23 Sep 2003 13:55:52 -0000	1.3
  @@ -45,14 +45,4 @@
       </nested>
     </target>
   
  -  <target name="xpathstyle">
  -    <macrodef name="testing" attributestyle="xpath">
  -      <attribute name="abc"/>
  -      <sequential>
  -        <echo>attribute is @abc@abc</echo>
  -      </sequential>
  -    </macrodef>
  -
  -    <testing abc="this is a test"/>
  -  </target>
   </project>
  
  
  
  1.8       +0 -44     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MacroDef.java	22 Sep 2003 08:58:58 -0000	1.7
  +++ MacroDef.java	23 Sep 2003 13:55:52 -0000	1.8
  @@ -81,7 +81,6 @@
       private String     name;
       private List       attributes = new ArrayList();
       private Map        elements = new HashMap();
  -    private int        attributeStyle = AttributeStyle.ANT;
   
       /**
        * Name of the definition
  @@ -92,46 +91,6 @@
       }
   
       /**
  -     * Enumerated type for attributeStyle attribute
  -     *
  -     * @see EnumeratedAttribute
  -     */
  -    public static class AttributeStyle extends EnumeratedAttribute {
  -        /** Enumerated values */
  -        public static final int ANT = 0, XPATH = 1;
  -
  -        /**
  -         * get the values
  -         * @return an array of the allowed values for this attribute.
  -         */
  -        public String[] getValues() {
  -            return new String[] {"ant", "xpath"};
  -        }
  -    }
  -
  -    /**
  -     * <em>Experimental</em>
  -     * I am uncertain at the moment how to encode attributes
  -     * using ant style ${attribute} or xpath style @attribute.
  -     * The first may get mixed up with ant properties and
  -     * the second may get mixed up with xpath.
  -     * The default at the moment is ant s
  -     *
  -     * @param style an <code>AttributeStyle</code> value
  -     */
  -    public void setAttributeStyle(AttributeStyle style) {
  -        attributeStyle = style.getIndex();
  -    }
  -
  -    /**
  -     * <em>Experimental</em>
  -     * @return the attribute style
  -     */
  -    public int getAttributeStyle() {
  -        return attributeStyle;
  -    }
  -
  -    /**
        * Set the class loader.
        * Not used
        * @param classLoader a <code>ClassLoader</code> value
  @@ -435,9 +394,6 @@
               }
           }
   
  -        if (attributeStyle != other.attributeStyle) {
  -            return false;
  -        }
           if (!nestedTask.similar(other.nestedTask)) {
               return false;
           }
  
  
  
  1.6       +1 -54     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MacroInstance.java	15 Sep 2003 16:55:01 -0000	1.5
  +++ MacroInstance.java	23 Sep 2003 13:55:52 -0000	1.6
  @@ -146,7 +146,7 @@
           }
       }
   
  -    private String macroSubsAnt(String s, Map macroMapping) {
  +    private String macroSubs(String s, Map macroMapping) {
           StringBuffer ret = new StringBuffer();
           StringBuffer macroName = new StringBuffer();
           boolean inMacro = false;
  @@ -177,59 +177,6 @@
           }
   
           return ret.toString();
  -    }
  -
  -    private String macroSubsXPath(String s, Map macroMapping) {
  -        StringBuffer ret = new StringBuffer();
  -        StringBuffer macroName = new StringBuffer();
  -        boolean inMacro = false;
  -        for (int i = 0; i < s.length(); ++i) {
  -            char c = s.charAt(i);
  -            if (!inMacro) {
  -                if (c == '@') {
  -                    inMacro = true;
  -                } else {
  -                    ret.append(c);
  -                }
  -            } else {
  -                if (MacroDef.isValidNameCharacter(c)) {
  -                    macroName.append(c);
  -                } else {
  -                    inMacro = false;
  -                    String name = macroName.toString();
  -                    String value = (String) macroMapping.get(name);
  -                    if (value == null) {
  -                        ret.append("@" + name);
  -                    } else {
  -                        ret.append(value);
  -                    }
  -                    if (c == '@') {
  -                        inMacro = true;
  -                    } else {
  -                        ret.append(c);
  -                    }
  -                    macroName = new StringBuffer();
  -                }
  -            }
  -        }
  -        if (inMacro) {
  -            String name = macroName.toString();
  -            String value = (String) macroMapping.get(name);
  -            if (value == null) {
  -                ret.append("@" + name);
  -            } else {
  -                ret.append(value);
  -            }
  -        }
  -        return ret.toString();
  -    }
  -
  -    private String macroSubs(String s, Map macroMapping) {
  -        if (macroDef.getAttributeStyle() == MacroDef.AttributeStyle.ANT) {
  -            return macroSubsAnt(s, macroMapping);
  -        } else {
  -            return macroSubsXPath(s, macroMapping);
  -        }
       }
   
       private UnknownElement copy(UnknownElement ue) {
  
  
  
  1.3       +0 -3      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MacroDefTest.java	15 Aug 2003 09:33:45 -0000	1.2
  +++ MacroDefTest.java	23 Sep 2003 13:55:52 -0000	1.3
  @@ -86,8 +86,5 @@
           expectLog("nested", "A nested element");
       }
   
  -    public void testXPathStyle() {
  -        expectLog("xpathstyle", "attribute is this is a testthis is a test");
  -    }
   }
   
  
  
  

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