ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kenneth Olving" <Kenneth.Olv...@frameworx.com>
Subject [PATCH] Support for default ProjectHelper to expand properties in attributes to project/target tags
Date Sun, 04 Jan 2004 22:23:11 GMT
Hoping that I've managed to navigate all the etiquette for posting a patch, here goes:

Change made in brief:
The default ProjectHelper (ProjectHelper2.java) has had two lines changed so when parsing
attributes for the project/target tags, values will be passed through Project.replacePropeties().

Rationale:
Given a build.xml like this:
  <project default="${foo}">
    <target name="bar">
      <echo message="Hello world!"/>
    </target>
  </project>
it allows for running this using something like this:
  ant -Dfoo=bar
and get the expected result. This type of usage isn't very useful of course; my desire for
this functionality
comes from that I'm using Ant embedded in my tool and that tool makes sure there are appropriate
properties set.

Patch (cvs diff -u ...) follows at the bottom.

Thank you,

Kenneth Olving
CM Architect
The Frameworx Company



Index: ProjectHelper2.java
===================================================================
RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java,v
retrieving revision 1.38
diff -u -r1.38 ProjectHelper2.java
--- ProjectHelper2.java	17 Dec 2003 15:36:34 -0000	1.38
+++ ProjectHelper2.java	4 Jan 2004 21:31:41 -0000
@@ -647,7 +647,7 @@
                     continue; // Ignore attributes from unknown uris
                 }
                 String key = attrs.getLocalName(i);
-                String value = attrs.getValue(i);
+                String value = project.replaceProperties(attrs.getValue(i));
 
                 if (key.equals("default")) {
                     if (value != null && !value.equals("")) {
@@ -806,7 +806,7 @@
                     continue; // Ignore attributes from unknown uris
                 }
                 String key = attrs.getLocalName(i);
-                String value = attrs.getValue(i);
+                String value = project.replaceProperties(attrs.getValue(i));
 
                 if (key.equals("name")) {
                     name = value;

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


Mime
View raw message