summaryrefslogtreecommitdiff
path: root/src/main/org/apache
diff options
context:
space:
mode:
authorStefan Bodewig <bodewig@apache.org>2002-05-28 14:19:31 +0000
committerStefan Bodewig <bodewig@apache.org>2002-05-28 14:19:31 +0000
commitc09d386575d236bd32d3d4ce78f716e90b5bbdfa (patch)
tree4c5246abcd4f57b47f26a25fe080b4793986415d /src/main/org/apache
parentf9d1c1691c7e9d80b793f5178f6113c949fc2441 (diff)
downloadant-c09d386575d236bd32d3d4ce78f716e90b5bbdfa.tar.gz
Make sure user-properties remain user-properties.
This is a partial merge of Ant.java from the 1.5 branch (only partial, sorry Magesh) that is required to avoid a Gump build failure of avalon-phoenix (which does several nested <ant>'s with varying inheritall values and ends up with relying on a property that has been set on the command line but has disappeared). git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272796 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/main/org/apache')
-rw-r--r--src/main/org/apache/tools/ant/taskdefs/Ant.java50
1 files changed, 31 insertions, 19 deletions
diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java
index 5cc2e07b0..8cb591321 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Ant.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java
@@ -184,6 +184,12 @@ public class Ant extends Task {
if (p.getResource() != null) {
newP.setResource(p.getResource());
}
+ if (p.getRefid() != null) {
+ newP.setRefid(p.getRefid());
+ }
+ if (p.getEnvironment() != null) {
+ newP.setEnvironment(p.getEnvironment());
+ }
properties.setElementAt(newP, i);
}
}
@@ -243,31 +249,37 @@ public class Ant extends Task {
newProject.addDataTypeDefinition(typeName, typeClass);
}
- // set user-defined or all properties from calling project
- Hashtable prop1;
- if (inheritAll) {
- prop1 = project.getProperties();
- } else {
- prop1 = project.getUserProperties();
+ // set user-defined
+ Hashtable props = getProject().getUserProperties();
+ e = props.keys();
+ while (e.hasMoreElements()) {
+ String arg = e.nextElement().toString();
+ String value = props.get(arg).toString();
+ newProject.setUserProperty(arg, value);
+ }
+ if (!inheritAll) {
// set Java built-in properties separately,
// b/c we won't inherit them.
newProject.setSystemProperties();
- }
- e = prop1.keys();
- while (e.hasMoreElements()) {
- String arg = (String) e.nextElement();
- if ("basedir".equals(arg) || "ant.file".equals(arg)) {
- // basedir and ant.file get special treatment in execute()
- continue;
- }
+ } else {
+ // set all properties from calling project
+
+ props = getProject().getProperties();
+ e = props.keys();
+ while (e.hasMoreElements()) {
+ String arg = e.nextElement().toString();
+ if ("basedir".equals(arg) || "ant.file".equals(arg)) {
+ // basedir and ant.file get special treatment in execute()
+ continue;
+ }
- String value = (String) prop1.get(arg);
- if (inheritAll){
- newProject.setProperty(arg, value);
- } else {
- newProject.setUserProperty(arg, value);
+ String value = props.get(arg).toString();
+ if (newProject.getProperty(arg) == null){
+ // no user property
+ newProject.setProperty(arg, value);
+ }
}
}
}