PR: 31487 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276905 13f79535-47bb-0310-9956-ffa450edef68master
@@ -26,6 +26,9 @@ Fixed bugs: | |||||
* Incorrect task name with invalid "javac" task after a "presetdef. | * Incorrect task name with invalid "javac" task after a "presetdef. | ||||
Bugzilla reports 31389 and 29499. | Bugzilla reports 31389 and 29499. | ||||
* Execution of top level tasks in imported files get delayed by targets. | |||||
Bugzilla report 31487. | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
@@ -0,0 +1,5 @@ | |||||
<project> | |||||
<echo>Importing targetfirst</echo> | |||||
<import file="targetfirst.xml"/> | |||||
<echo>After importing</echo> | |||||
</project> |
@@ -0,0 +1,4 @@ | |||||
<project> | |||||
<target name="first"/> | |||||
<echo>After target first</echo> | |||||
</project> |
@@ -116,15 +116,18 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
// we are in an imported file. | // we are in an imported file. | ||||
context.setIgnoreProjectTag(true); | context.setIgnoreProjectTag(true); | ||||
Target currentTarget = context.getCurrentTarget(); | Target currentTarget = context.getCurrentTarget(); | ||||
Target currentImplicit = context.getImplicitTarget(); | |||||
try { | try { | ||||
Target newCurrent = new Target(); | Target newCurrent = new Target(); | ||||
newCurrent.setProject(project); | newCurrent.setProject(project); | ||||
newCurrent.setName(""); | newCurrent.setName(""); | ||||
context.setCurrentTarget(newCurrent); | context.setCurrentTarget(newCurrent); | ||||
context.setImplicitTarget(newCurrent); | |||||
parse(project, source, new RootHandler(context, mainHandler)); | parse(project, source, new RootHandler(context, mainHandler)); | ||||
newCurrent.execute(); | newCurrent.execute(); | ||||
} finally { | } finally { | ||||
context.setCurrentTarget(currentTarget); | context.setCurrentTarget(currentTarget); | ||||
context.setImplicitTarget(currentImplicit); | |||||
} | } | ||||
} else { | } else { | ||||
// top level file | // top level file | ||||
@@ -142,4 +142,8 @@ public class ImportTest extends BuildFileTest { | |||||
} | } | ||||
} | } | ||||
public void testTargetFirst() { | |||||
configureProject("src/etc/testcases/taskdefs/import/importtargetfirst.xml"); | |||||
assertLogContaining("Importing targetfirstAfter target firstAfter importing"); | |||||
} | |||||
} | } |