From 30a4d96094c650b25fa1c521619f82d4184631f8 Mon Sep 17 00:00:00 2001 From: Conor MacNeill Date: Fri, 8 Feb 2002 13:44:43 +0000 Subject: [PATCH] Fix up determination of basedir on Antcall git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271221 13f79535-47bb-0310-9956-ffa450edef68 --- .../code/org/apache/ant/antlib/system/Ant.java | 4 +++- .../org/apache/ant/antlib/system/AntBase.java | 18 +++++++++++++++--- .../org/apache/ant/antlib/system/AntCall.java | 3 +++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/Ant.java b/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/Ant.java index b620bc245..3c55c0d0c 100644 --- a/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/Ant.java +++ b/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/Ant.java @@ -55,6 +55,7 @@ package org.apache.ant.antlib.system; import java.io.File; import org.apache.ant.common.service.ExecService; import org.apache.ant.common.util.ExecutionException; +import org.apache.ant.common.service.MagicProperties; /** * The Ant task - used to execute a different build file @@ -112,7 +113,8 @@ public class Ant extends AntBase { antFile = new File(baseDir, "build.xml"); } } - + setProperty(MagicProperties.BASEDIR, baseDir.getAbsolutePath()); + ExecService execService = (ExecService)getCoreService(ExecService.class); diff --git a/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java b/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java index b39742347..3a892ea6c 100644 --- a/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java +++ b/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java @@ -123,7 +123,8 @@ public abstract class AntBase extends AbstractTask { /** * Validate this data type instance * - * @exception ExecutionException if either attribute has not been set + * @exception ExecutionException if either attribute has not been + * set */ public void validateComponent() throws ExecutionException { if (name == null) { @@ -188,7 +189,8 @@ public abstract class AntBase extends AbstractTask { /** * Validate this data type instance * - * @exception ExecutionException if the refid attribute has not been set + * @exception ExecutionException if the refid attribute has not been + * set */ public void validateComponent() throws ExecutionException { if (refId == null) { @@ -288,6 +290,16 @@ public abstract class AntBase extends AbstractTask { properties.put(toId, value); } + /** + * Set a property for the subbuild + * + * @param propertyName the property name + * @param propertyValue the value of the property + */ + protected void setProperty(String propertyName, Object propertyValue) { + properties.put(propertyName, propertyValue); + } + /** * Get the list of targets to be executed * @@ -310,7 +322,7 @@ public abstract class AntBase extends AbstractTask { if (!inheritAll) { return properties; } - + // need to combine existing properties with new ones Map subBuildProperties = dataService.getAllProperties(); subBuildProperties.putAll(properties); diff --git a/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntCall.java b/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntCall.java index 90589fc23..ce47eb21b 100644 --- a/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntCall.java +++ b/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntCall.java @@ -54,6 +54,7 @@ package org.apache.ant.antlib.system; import org.apache.ant.common.service.ExecService; import org.apache.ant.common.util.ExecutionException; +import org.apache.ant.common.service.MagicProperties; /** * The Ant task - used to execute a different build file @@ -68,6 +69,8 @@ public class AntCall extends AntBase { * @exception ExecutionException if the build fails */ public void execute() throws ExecutionException { + setProperty(MagicProperties.BASEDIR, + getContext().getBaseDir().getAbsolutePath()); ExecService execService = (ExecService)getCoreService(ExecService.class);