git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@388848 13f79535-47bb-0310-9956-ffa450edef68master
@@ -263,6 +263,9 @@ public final class Diagnostics { | |||||
ignoreThrowable(e); | ignoreThrowable(e); | ||||
out.println("optional tasks : not available"); | out.println("optional tasks : not available"); | ||||
} | } | ||||
header(out, "ANT PROPERTIES"); | |||||
doReportAntProperties(out); | |||||
header(out, "ANT_HOME/lib jar listing"); | header(out, "ANT_HOME/lib jar listing"); | ||||
doReportAntHomeLibraries(out); | doReportAntHomeLibraries(out); | ||||
@@ -328,6 +331,18 @@ public final class Diagnostics { | |||||
} | } | ||||
} | } | ||||
/** | |||||
* Report the content of ANT_HOME/lib directory | |||||
* @param out the stream to print the content to | |||||
*/ | |||||
private static void doReportAntProperties(PrintStream out) { | |||||
Project p = new Project(); | |||||
p.initProperties(); | |||||
out.println(MagicNames.ANT_VERSION + ": " + p.getProperty(MagicNames.ANT_VERSION)); | |||||
out.println(MagicNames.ANT_JAVA_VERSION + ": " + p.getProperty(MagicNames.ANT_JAVA_VERSION)); | |||||
out.println(MagicNames.ANT_LIB + ": " + p.getProperty(MagicNames.ANT_LIB)); | |||||
out.println(MagicNames.ANT_HOME + ": " + p.getProperty(MagicNames.ANT_HOME)); | |||||
} | |||||
/** | /** | ||||
* Report the content of ANT_HOME/lib directory | * Report the content of ANT_HOME/lib directory | ||||
@@ -106,14 +106,22 @@ public final class MagicNames { | |||||
/** | /** | ||||
* Property used to store the java version ant is running in. | * Property used to store the java version ant is running in. | ||||
* @since Ant 1.7 | |||||
*/ | */ | ||||
public static final String ANT_JAVA_VERSION = "ant.java.version"; | public static final String ANT_JAVA_VERSION = "ant.java.version"; | ||||
/** | /** | ||||
* Property used to store the location of ant. | * Property used to store the location of ant. | ||||
* @since Ant 1.7 | |||||
*/ | */ | ||||
public static final String ANT_HOME = "ant.home"; | public static final String ANT_HOME = "ant.home"; | ||||
/** | |||||
* Property used to store the location of the ant library (typically the ant.jar file.) | |||||
* @since Ant 1.7 | |||||
*/ | |||||
public static final String ANT_LIB = "ant.core.lib"; | |||||
/** | /** | ||||
* property for regular expression implementation. | * property for regular expression implementation. | ||||
* Value: {@value} | * Value: {@value} | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
* Copyright 2000-2005 The Apache Software Foundation | |||||
* Copyright 2000-2006 The Apache Software Foundation | |||||
* | * | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
@@ -638,7 +638,6 @@ public class Main implements AntMain { | |||||
project.init(); | project.init(); | ||||
project.setUserProperty(MagicNames.ANT_VERSION, getAntVersion()); | |||||
// set user-define properties | // set user-define properties | ||||
Enumeration e = definedProps.keys(); | Enumeration e = definedProps.keys(); | ||||
@@ -193,7 +193,7 @@ public class Project implements ResourceFactory { | |||||
* @deprecated | * @deprecated | ||||
*/ | */ | ||||
public static final String ANT_JAVA_VERSION = MagicNames.ANT_JAVA_VERSION; | public static final String ANT_JAVA_VERSION = MagicNames.ANT_JAVA_VERSION; | ||||
/** | /** | ||||
* Set the input handler. | * Set the input handler. | ||||
* | * | ||||
@@ -282,14 +282,29 @@ public class Project implements ResourceFactory { | |||||
* @exception BuildException if the default task list cannot be loaded. | * @exception BuildException if the default task list cannot be loaded. | ||||
*/ | */ | ||||
public void init() throws BuildException { | public void init() throws BuildException { | ||||
setJavaVersionProperty(); | |||||
initProperties(); | |||||
ComponentHelper.getComponentHelper(this).initDefaultDefinitions(); | ComponentHelper.getComponentHelper(this).initDefaultDefinitions(); | ||||
} | |||||
/** | |||||
* Initializes the properties. | |||||
* @exception BuildException if an vital property could not be set. | |||||
* @since Ant 1.7 | |||||
*/ | |||||
public void initProperties() throws BuildException { | |||||
setJavaVersionProperty(); | |||||
setSystemProperties(); | setSystemProperties(); | ||||
setPropertyInternal(MagicNames.ANT_VERSION, Main.getAntVersion()); | |||||
setAntLib(); | |||||
} | } | ||||
private void setAntLib() { | |||||
File antlib = org.apache.tools.ant.launch.Locator.getClassSource(Project.class); | |||||
if (antlib != null) { | |||||
setPropertyInternal(MagicNames.ANT_LIB, antlib.getAbsolutePath()); | |||||
} | |||||
} | |||||
/** | /** | ||||
* Factory method to create a class loader for loading classes from | * Factory method to create a class loader for loading classes from | ||||
* a given path. | * a given path. | ||||