git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@663051 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -71,7 +71,8 @@ Other changes: | |||||
| * Fixcrlf now gives better error messages on bad directory attributes. | * Fixcrlf now gives better error messages on bad directory attributes. | ||||
| Bugzilla report 43936 | Bugzilla report 43936 | ||||
| * a new property ant.project.default-target holds the value of the | |||||
| current <project>'s default attribute. | |||||
| Changes from Ant 1.7.0 TO Ant 1.7.1 | Changes from Ant 1.7.0 TO Ant 1.7.1 | ||||
| ============================================= | ============================================= | ||||
| @@ -307,6 +307,10 @@ ant.file the absolute path of the buildfile. | |||||
| ant.version the version of Ant | ant.version the version of Ant | ||||
| ant.project.name the name of the project that is currently executing; | ant.project.name the name of the project that is currently executing; | ||||
| it is set in the name attribute of <project>. | it is set in the name attribute of <project>. | ||||
| ant.project.default-target | |||||
| the name of the currently executing project's | |||||
| default target; it is set via the default | |||||
| attribute of <project>. | |||||
| 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.2", "1.3", "1.4" and "1.5". | the values "1.2", "1.3", "1.4" and "1.5". | ||||
| </pre> | </pre> | ||||
| @@ -202,5 +202,15 @@ public final class MagicNames { | |||||
| */ | */ | ||||
| public static final String PROJECT_NAME = "ant.project.name"; | public static final String PROJECT_NAME = "ant.project.name"; | ||||
| /** | |||||
| * Name of the property holding the default target of the | |||||
| * currently executing project, if one has been specified. | |||||
| * | |||||
| * Value: {@value} | |||||
| * @since Ant 1.8.0 | |||||
| */ | |||||
| public static final String PROJECT_DEFAULT_TARGET | |||||
| = "ant.project.default-target"; | |||||
| } | } | ||||
| @@ -674,7 +674,7 @@ public class Project implements ResourceFactory { | |||||
| * @see #setDefault(String) | * @see #setDefault(String) | ||||
| */ | */ | ||||
| public void setDefaultTarget(String defaultTarget) { | public void setDefaultTarget(String defaultTarget) { | ||||
| this.defaultTarget = defaultTarget; | |||||
| setDefault(defaultTarget); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -694,6 +694,7 @@ public class Project implements ResourceFactory { | |||||
| * no default target. | * no default target. | ||||
| */ | */ | ||||
| public void setDefault(String defaultTarget) { | public void setDefault(String defaultTarget) { | ||||
| setUserProperty(MagicNames.PROJECT_DEFAULT_TARGET, defaultTarget); | |||||
| this.defaultTarget = defaultTarget; | this.defaultTarget = defaultTarget; | ||||
| } | } | ||||
| @@ -0,0 +1,34 @@ | |||||
| <?xml version="1.0"?> | |||||
| <!-- | |||||
| Licensed to the Apache Software Foundation (ASF) under one or more | |||||
| contributor license agreements. See the NOTICE file distributed with | |||||
| this work for additional information regarding copyright ownership. | |||||
| The ASF licenses this file to You under the Apache License, Version 2.0 | |||||
| (the "License"); you may not use this file except in compliance with | |||||
| the License. You may obtain a copy of the License at | |||||
| http://www.apache.org/licenses/LICENSE-2.0 | |||||
| Unless required by applicable law or agreed to in writing, software | |||||
| distributed under the License is distributed on an "AS IS" BASIS, | |||||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| See the License for the specific language governing permissions and | |||||
| limitations under the License. | |||||
| --> | |||||
| <project xmlns:au="antlib:org.apache.ant.antunit" | |||||
| name="magicnames-test" | |||||
| default="default target"> | |||||
| <target name="default target"/> | |||||
| <target name="testProjectName"> | |||||
| <au:assertPropertyEquals | |||||
| name="ant.project.name" value="magicnames-test"/> | |||||
| </target> | |||||
| <target name="testDefaultTarget"> | |||||
| <au:assertPropertyEquals | |||||
| name="ant.project.default-target" value="default target"/> | |||||
| </target> | |||||
| </project> | |||||