Browse Source

Only override subbuild's basedir if inheritall has been set to false.

Submitted by:	Craeg K. Strong <cstrong@arielpartners.com>

Get rid of annoying warning that <property> has been redefined in
<ant> and <antcall>.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269816 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
8c8d8c5f27
2 changed files with 16 additions and 4 deletions
  1. +5
    -0
      WHATSNEW
  2. +11
    -4
      src/main/org/apache/tools/ant/taskdefs/Ant.java

+ 5
- 0
WHATSNEW View File

@@ -20,6 +20,9 @@ Other changes:
* Ant's testcases require JUnit 3.7 or above as they now use the new * Ant's testcases require JUnit 3.7 or above as they now use the new
assertTrue method instead of assert. assertTrue method instead of assert.


* <taskdef> and <typedef> will now emit a warning if a task/type of
the given name already exists.

Fixed bugs: Fixed bugs:
----------- -----------


@@ -28,6 +31,8 @@ Fixed bugs:


* <propertyfile> would not close the original property file. * <propertyfile> would not close the original property file.


* <ant> will no longer override a subbuilds basedir with inheritall="true".

Changes from Ant 1.4 to Ant 1.4.1 Changes from Ant 1.4 to Ant 1.4.1
=========================================== ===========================================




+ 11
- 4
src/main/org/apache/tools/ant/taskdefs/Ant.java View File

@@ -160,6 +160,10 @@ public class Ant extends Task {
Enumeration et = taskdefs.keys(); Enumeration et = taskdefs.keys();
while (et.hasMoreElements()) { while (et.hasMoreElements()) {
String taskName = (String) et.nextElement(); String taskName = (String) et.nextElement();
if (taskName.equals("property")) {
// we have already added this taskdef in #init
continue;
}
Class taskClass = (Class) taskdefs.get(taskName); Class taskClass = (Class) taskdefs.get(taskName);
newProject.addTaskDefinition(taskName, taskClass); newProject.addTaskDefinition(taskName, taskClass);
} }
@@ -224,15 +228,18 @@ public class Ant extends Task {
reinit(); reinit();
} }
if (dir == null) {
if ( (dir == null) && (inheritAll == true) )
dir = project.getBaseDir();

if (dir != null) {
newProject.setBaseDir(dir);
newProject.setUserProperty("basedir" , dir.getAbsolutePath());
} else {
dir = project.getBaseDir(); dir = project.getBaseDir();
} }


initializeProject(); initializeProject();


newProject.setBaseDir(dir);
newProject.setUserProperty("basedir" , dir.getAbsolutePath());
// Override with local-defined properties // Override with local-defined properties
Enumeration e = properties.elements(); Enumeration e = properties.elements();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {


Loading…
Cancel
Save