Browse Source

Replace ProjectHelper.replaceProperties calls with a new one-arg

method in project.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270128 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
c78d3f894e
8 changed files with 19 additions and 10 deletions
  1. +11
    -0
      src/main/org/apache/tools/ant/Project.java
  2. +2
    -2
      src/main/org/apache/tools/ant/Target.java
  3. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/Echo.java
  4. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/Exit.java
  5. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  6. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Property.java
  7. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java
  8. +1
    -1
      src/main/org/apache/tools/ant/types/PatternSet.java

+ 11
- 0
src/main/org/apache/tools/ant/Project.java View File

@@ -370,6 +370,17 @@ public class Project {
return property; return property;
} }


/**
* Replace ${} style constructions in the given value with the
* string value of the corresponding data types.
*
* @param value the string to be scanned for property references.
*/
public String replaceProperties(String value)
throws BuildException {
return ProjectHelper.replaceProperties(this, value);
}

/** /**
* query a user property. * query a user property.
* @param name the name of the property * @param name the name of the property


+ 2
- 2
src/main/org/apache/tools/ant/Target.java View File

@@ -222,7 +222,7 @@ public class Target implements TaskContainer {
return true; return true;
} }
String test = ProjectHelper.replaceProperties(getProject(), ifCondition);
String test = project.replaceProperties(ifCondition);
return project.getProperty(test) != null; return project.getProperty(test) != null;
} }


@@ -230,7 +230,7 @@ public class Target implements TaskContainer {
if ("".equals(unlessCondition)) { if ("".equals(unlessCondition)) {
return true; return true;
} }
String test = ProjectHelper.replaceProperties(getProject(), unlessCondition);
String test = project.replaceProperties(unlessCondition);
return project.getProperty(test) == null; return project.getProperty(test) == null;
} }




+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/Echo.java View File

@@ -127,8 +127,7 @@ public class Echo extends Task {
* Set a multiline message. * Set a multiline message.
*/ */
public void addText(String msg) { public void addText(String msg) {
message +=
ProjectHelper.replaceProperties(project, msg);
message += project.replaceProperties(msg);
} }


/** /**


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/Exit.java View File

@@ -94,8 +94,7 @@ public class Exit extends Task {
* Set a multiline message. * Set a multiline message.
*/ */
public void addText(String msg) { public void addText(String msg) {
message +=
ProjectHelper.replaceProperties(project, msg);
message += project.replaceProperties(msg);
} }


private boolean testIfCondition() { private boolean testIfCondition() {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -1146,7 +1146,7 @@ public class Javadoc extends Task {
* Convenience method to expand properties. * Convenience method to expand properties.
*/ */
protected String expand(String content) { protected String expand(String content) {
return ProjectHelper.replaceProperties(project, content);
return project.replaceProperties(content);
} }


private String getJavadocExecutableName() private String getJavadocExecutableName()


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Property.java View File

@@ -289,7 +289,7 @@ public class Property extends Task {
String name = (String) e.nextElement(); String name = (String) e.nextElement();
String value = (String) props.getProperty(name); String value = (String) props.getProperty(name);


String v = ProjectHelper.replaceProperties(project, value);
String v = project.replaceProperties(value);
addProperty(name, v); addProperty(name, v);
} }
} }


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -533,7 +533,7 @@ public class SQLExec extends Task {
try{ try{
while ((line=in.readLine()) != null){ while ((line=in.readLine()) != null){
line = line.trim(); line = line.trim();
line = ProjectHelper.replaceProperties(project, line);
line = project.replaceProperties(line);
if (line.startsWith("//")) continue; if (line.startsWith("//")) continue;
if (line.startsWith("--")) continue; if (line.startsWith("--")) continue;
StringTokenizer st = new StringTokenizer(line); StringTokenizer st = new StringTokenizer(line);


+ 1
- 1
src/main/org/apache/tools/ant/types/PatternSet.java View File

@@ -291,7 +291,7 @@ public class PatternSet extends DataType {
String line = patternReader.readLine(); String line = patternReader.readLine();
while (line != null) { while (line != null) {
if (line.length() > 0) { if (line.length() > 0) {
line = ProjectHelper.replaceProperties(p, line);
line = p.replaceProperties(line);
addPatternToList(patternlist).setName(line); addPatternToList(patternlist).setName(line);
} }
line = patternReader.readLine(); line = patternReader.readLine();


Loading…
Cancel
Save