https://bz.apache.org/bugzilla/show_bug.cgi?id=58908master
@@ -77,13 +77,18 @@ ant.project.invoked-targets | |||||
been specified on the command line (the IDE, | been specified on the command line (the IDE, | ||||
an <ant> task ...) when invoking the current | an <ant> task ...) when invoking the current | ||||
project. | project. | ||||
This property is set when the first target is executed. | |||||
So you can't use it in the implicit target (directly | |||||
under the <project> tag). | |||||
This property is set properly when the first target is executed. | |||||
If you use it in the implicit target (directly | |||||
under the <project> tag) the list will be | |||||
empty if no target has been specified while it | |||||
will contain the project's default target in this | |||||
case for tasks nested into targets.. | |||||
ant.java.version the JVM version Ant detected; currently it can hold | ant.java.version the JVM version Ant detected; currently it can hold | ||||
the values "1.7", "1.6", "1.5", | |||||
"1.4", "1.3" and "1.2". | |||||
ant.core.lib the absolute path of the <code>ant.jar</code> file. | |||||
the values "1.9", "1.8", | |||||
"1.7", "1.6", "1.5", | |||||
"1.4", "1.3" and | |||||
"1.2". ant.core.lib the absolute path | |||||
of the <code>ant.jar</code> file. | |||||
</pre> | </pre> | ||||
<p>There is also another property, but this is set by the launcher | <p>There is also another property, but this is set by the launcher | ||||
@@ -45,6 +45,7 @@ import org.apache.tools.ant.listener.SilentLogger; | |||||
import org.apache.tools.ant.property.GetProperty; | import org.apache.tools.ant.property.GetProperty; | ||||
import org.apache.tools.ant.property.ResolvePropertyMap; | import org.apache.tools.ant.property.ResolvePropertyMap; | ||||
import org.apache.tools.ant.util.ClasspathUtils; | import org.apache.tools.ant.util.ClasspathUtils; | ||||
import org.apache.tools.ant.util.CollectionUtils; | |||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import org.apache.tools.ant.util.ProxySetup; | import org.apache.tools.ant.util.ProxySetup; | ||||
@@ -917,6 +918,16 @@ public class Main implements AntMain { | |||||
buildFile.getAbsolutePath()); | buildFile.getAbsolutePath()); | ||||
project.setUserProperty(MagicNames.ANT_FILE_TYPE, | project.setUserProperty(MagicNames.ANT_FILE_TYPE, | ||||
MagicNames.ANT_FILE_TYPE_FILE); | MagicNames.ANT_FILE_TYPE_FILE); | ||||
// this list doesn't contain the build files default target, | |||||
// which may be added later unless targets have been specified | |||||
// on the command line. Therefore the property gets set again | |||||
// in Project#executeTargets when we can be sure the list is | |||||
// complete. | |||||
// Setting it here allows top-level tasks to access the | |||||
// property. | |||||
project.setUserProperty(MagicNames.PROJECT_INVOKED_TARGETS, | |||||
CollectionUtils.flattenToString(targets)); | |||||
} | } | ||||
/** | /** | ||||
@@ -17,7 +17,9 @@ | |||||
--> | --> | ||||
<project xmlns:au="antlib:org.apache.ant.antunit" | <project xmlns:au="antlib:org.apache.ant.antunit" | ||||
name="magicnames-test" | name="magicnames-test" | ||||
default="default target"> | |||||
default="antunit"> | |||||
<import file="../antunit-base.xml" /> | |||||
<target name="default target"/> | <target name="default target"/> | ||||