From 9092eca069240e6318976481d0ba6961997977ce Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 7 Aug 2001 11:43:32 +0000 Subject: [PATCH] Make sure system properties as accessible in subbuilds in the inheritAll=false case as well. Submitted by: Craeg K. Strong git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269487 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/Project.java | 18 +++++++++++------- .../org/apache/tools/ant/taskdefs/Ant.java | 4 ++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index 4077314f1..ef3422092 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -212,13 +212,7 @@ public class Project { throw new BuildException("Can't load default datatype list"); } - Properties systemP = System.getProperties(); - Enumeration e = systemP.keys(); - while (e.hasMoreElements()) { - Object name = e.nextElement(); - String value = systemP.get(name).toString(); - this.setProperty(name.toString(), value); - } + setSystemProperties(); } public void setSystemLoader(ClassLoader systemLoader) { @@ -383,6 +377,16 @@ public class Project { log("Detected OS: " + System.getProperty("os.name"), MSG_VERBOSE); } + public void setSystemProperties() { + Properties systemP = System.getProperties(); + Enumeration e = systemP.keys(); + while (e.hasMoreElements()) { + Object name = e.nextElement(); + String value = systemP.get(name).toString(); + this.setProperty(name.toString(), value); + } + } + public void addTaskDefinition(String taskName, Class taskClass) { String msg = " +User task: " + taskName + " " + taskClass.getName(); log(msg, MSG_DEBUG); diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java index 321b283e8..1e66a484f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ant.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java @@ -166,6 +166,10 @@ public class Ant extends Task { } else { prop1 = project.getUserProperties(); + + // set Java built-in properties separately, + // b/c we won't inherit them. + project.setSystemProperties(); } e = prop1.keys();