https://bz.apache.org/bugzilla/show_bug.cgi?id=58908
Bug ID: 58908
Summary: "ant.project.invoked-targets" is not available to top
level tasks
Product: Ant
Version: 1.9.6
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Core
Assignee: [email protected]
Reporter: [email protected]
This property is not yet available to tasks outside of a target. It is
currently set in Project.java:
public void executeTargets(final Vector<String> names) throws
BuildException {
setUserProperty(MagicNames.PROJECT_INVOKED_TARGETS,
CollectionUtils.flattenToString(names));
getExecutor().executeTargets(this, names.toArray(new
String[names.size()]));
}
and should be easily pushed out to the caller, Main.java:
setProperties(project);
...
ProjectHelper.configureProject(project, buildFile);
...
project.executeTargets(targets);
ahead of the configureProject() call which eventually executes the top-level
tasks. I think it can just be appended to the setProperties() method, where it
already does:
project.setUserProperty(MagicNames.ANT_FILE,
buildFile.getAbsolutePath());
project.setUserProperty(MagicNames.ANT_FILE_TYPE,
MagicNames.ANT_FILE_TYPE_FILE);
like:
project.setUserProperty(MagicNames.PROJECT_INVOKED_TARGETS,
CollectionUtils.flattenToString(targets));
Tried:
<project name="test" default="foobar">
<echo message="${ant.project.default-target}" />
<echo message="${ant.project.invoked-targets}" />
<echo message="${ant.file}" />
<echo message="${ant.file.type}" />
<target name="foobar">
</target>
</project>
--
You are receiving this mail because:
You are the assignee for the bug.