peterreilly 2004/09/30 10:05:38
Modified: . WHATSNEW
src/testcases/org/apache/tools/ant/taskdefs ImportTest.java
src/main/org/apache/tools/ant/helper ProjectHelper2.java
Added: src/etc/testcases/taskdefs/import targetfirst.xml
importtargetfirst.xml
Log:
Fix for execution of top level tasks getting delayed by targets.
PR: 31487
Revision Changes Path
1.668 +3 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.667
retrieving revision 1.668
diff -u -r1.667 -r1.668
--- WHATSNEW 24 Sep 2004 18:55:16 -0000 1.667
+++ WHATSNEW 30 Sep 2004 17:05:37 -0000 1.668
@@ -26,6 +26,9 @@
* Incorrect task name with invalid "javac" task after a "presetdef.
Bugzilla reports 31389 and 29499.
+* Execution of top level tasks in imported files get delayed by targets.
+ Bugzilla report 31487.
+
Other changes:
--------------
1.1 ant/src/etc/testcases/taskdefs/import/targetfirst.xml
Index: targetfirst.xml
===================================================================
<project>
<target name="first"/>
<echo>After target first</echo>
</project>
1.1
ant/src/etc/testcases/taskdefs/import/importtargetfirst.xml
Index: importtargetfirst.xml
===================================================================
<project>
<echo>Importing targetfirst</echo>
<import file="targetfirst.xml"/>
<echo>After importing</echo>
</project>
1.14 +4 -0
ant/src/testcases/org/apache/tools/ant/taskdefs/ImportTest.java
Index: ImportTest.java
===================================================================
RCS file:
/home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/ImportTest.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ImportTest.java 28 Apr 2004 09:01:08 -0000 1.13
+++ ImportTest.java 30 Sep 2004 17:05:38 -0000 1.14
@@ -142,4 +142,8 @@
}
}
+ public void testTargetFirst() {
+
configureProject("src/etc/testcases/taskdefs/import/importtargetfirst.xml");
+ assertLogContaining("Importing targetfirstAfter target firstAfter
importing");
+ }
}
1.48 +3 -0
ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
Index: ProjectHelper2.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- ProjectHelper2.java 24 May 2004 15:09:57 -0000 1.47
+++ ProjectHelper2.java 30 Sep 2004 17:05:38 -0000 1.48
@@ -116,15 +116,18 @@
// we are in an imported file.
context.setIgnoreProjectTag(true);
Target currentTarget = context.getCurrentTarget();
+ Target currentImplicit = context.getImplicitTarget();
try {
Target newCurrent = new Target();
newCurrent.setProject(project);
newCurrent.setName("");
context.setCurrentTarget(newCurrent);
+ context.setImplicitTarget(newCurrent);
parse(project, source, new RootHandler(context,
mainHandler));
newCurrent.execute();
} finally {
context.setCurrentTarget(currentTarget);
+ context.setImplicitTarget(currentImplicit);
}
} else {
// top level file
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]