Browse Source

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
master
Conor MacNeill 23 years ago
parent
commit
30a4d96094
3 changed files with 21 additions and 4 deletions
  1. +3
    -1
      proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/Ant.java
  2. +15
    -3
      proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java
  3. +3
    -0
      proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntCall.java

+ 3
- 1
proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/Ant.java View File

@@ -55,6 +55,7 @@ package org.apache.ant.antlib.system;
import java.io.File; import java.io.File;
import org.apache.ant.common.service.ExecService; import org.apache.ant.common.service.ExecService;
import org.apache.ant.common.util.ExecutionException; import org.apache.ant.common.util.ExecutionException;
import org.apache.ant.common.service.MagicProperties;


/** /**
* The Ant task - used to execute a different build file * 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"); antFile = new File(baseDir, "build.xml");
} }
} }

setProperty(MagicProperties.BASEDIR, baseDir.getAbsolutePath());
ExecService execService ExecService execService
= (ExecService)getCoreService(ExecService.class); = (ExecService)getCoreService(ExecService.class);




+ 15
- 3
proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java View File

@@ -123,7 +123,8 @@ public abstract class AntBase extends AbstractTask {
/** /**
* Validate this data type instance * 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 { public void validateComponent() throws ExecutionException {
if (name == null) { if (name == null) {
@@ -188,7 +189,8 @@ public abstract class AntBase extends AbstractTask {
/** /**
* Validate this data type instance * 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 { public void validateComponent() throws ExecutionException {
if (refId == null) { if (refId == null) {
@@ -288,6 +290,16 @@ public abstract class AntBase extends AbstractTask {
properties.put(toId, value); 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 * Get the list of targets to be executed
* *
@@ -310,7 +322,7 @@ public abstract class AntBase extends AbstractTask {
if (!inheritAll) { if (!inheritAll) {
return properties; return properties;
} }
// need to combine existing properties with new ones // need to combine existing properties with new ones
Map subBuildProperties = dataService.getAllProperties(); Map subBuildProperties = dataService.getAllProperties();
subBuildProperties.putAll(properties); subBuildProperties.putAll(properties);


+ 3
- 0
proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntCall.java View File

@@ -54,6 +54,7 @@
package org.apache.ant.antlib.system; package org.apache.ant.antlib.system;
import org.apache.ant.common.service.ExecService; import org.apache.ant.common.service.ExecService;
import org.apache.ant.common.util.ExecutionException; import org.apache.ant.common.util.ExecutionException;
import org.apache.ant.common.service.MagicProperties;


/** /**
* The Ant task - used to execute a different build file * 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 * @exception ExecutionException if the build fails
*/ */
public void execute() throws ExecutionException { public void execute() throws ExecutionException {
setProperty(MagicProperties.BASEDIR,
getContext().getBaseDir().getAbsolutePath());
ExecService execService ExecService execService
= (ExecService)getCoreService(ExecService.class); = (ExecService)getCoreService(ExecService.class);




Loading…
Cancel
Save