bodewig 01/10/23 05:15:46
Modified: . WHATSNEW
src/main/org/apache/tools/ant/taskdefs Ant.java
Log:
Only override subbuild's basedir if inheritall has been set to false.
Submitted by: Craeg K. Strong <[EMAIL PROTECTED]>
Get rid of annoying warning that <property> has been redefined in
<ant> and <antcall>.
Revision Changes Path
1.158 +5 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -r1.157 -r1.158
--- WHATSNEW 2001/10/23 11:49:45 1.157
+++ WHATSNEW 2001/10/23 12:15:46 1.158
@@ -20,6 +20,9 @@
* Ant's testcases require JUnit 3.7 or above as they now use the new
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:
-----------
@@ -27,6 +30,8 @@
in ant/antcall tasks when inheritall="false" is set.
* <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
===========================================
1.29 +11 -4
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
Index: Ant.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- Ant.java 2001/09/30 13:21:53 1.28
+++ Ant.java 2001/10/23 12:15:46 1.29
@@ -160,6 +160,10 @@
Enumeration et = taskdefs.keys();
while (et.hasMoreElements()) {
String taskName = (String) et.nextElement();
+ if (taskName.equals("property")) {
+ // we have already added this taskdef in #init
+ continue;
+ }
Class taskClass = (Class) taskdefs.get(taskName);
newProject.addTaskDefinition(taskName, taskClass);
}
@@ -224,15 +228,18 @@
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();
}
initializeProject();
- newProject.setBaseDir(dir);
- newProject.setUserProperty("basedir" , dir.getAbsolutePath());
-
// Override with local-defined properties
Enumeration e = properties.elements();
while (e.hasMoreElements()) {