git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278534 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -93,6 +93,12 @@ public class ComponentHelper { | |||
| public static final String COMPONENT_HELPER_REFERENCE = "ant.ComponentHelper"; | |||
| private static final String ANTLIB_PREFIX = "antlib:"; | |||
| /** | |||
| * string used to control build.syspath policy {@value} | |||
| */ | |||
| private static final String BUILD_SYSCLASSPATH_ONLY = "only"; | |||
| private static final String ANT_PROPERTY_TASK = "property"; | |||
| /** | |||
| * Find a project component for a specific project, creating | |||
| * it if it does not exist. | |||
| @@ -435,10 +441,10 @@ public class ComponentHelper { | |||
| */ | |||
| public Task createTask(String taskType) throws BuildException { | |||
| Task task = createNewTask(taskType); | |||
| if (task == null && taskType.equals("property")) { | |||
| if (task == null && taskType.equals(ANT_PROPERTY_TASK)) { | |||
| // quick fix for Ant.java use of property before | |||
| // initializing the project | |||
| addTaskDefinition("property", | |||
| addTaskDefinition(ANT_PROPERTY_TASK, | |||
| org.apache.tools.ant.taskdefs.Property.class); | |||
| task = createNewTask(taskType); | |||
| } | |||
| @@ -676,7 +682,7 @@ public class ComponentHelper { | |||
| private void initTasks() { | |||
| ClassLoader classLoader = null; | |||
| if (project.getCoreLoader() != null | |||
| && !("only".equals(project.getProperty("build.sysclasspath")))) { | |||
| && !(BUILD_SYSCLASSPATH_ONLY.equals(project.getProperty(MagicNames.BUILD_SYSCLASSPATH)))) { | |||
| classLoader = project.getCoreLoader(); | |||
| } | |||
| String dataDefs = MagicNames.TASKDEF_PROPERTIES_RESOURCE; | |||
| @@ -721,7 +727,7 @@ public class ComponentHelper { | |||
| private void initTypes() { | |||
| ClassLoader classLoader = null; | |||
| if (project.getCoreLoader() != null | |||
| && !("only".equals(project.getProperty("build.sysclasspath")))) { | |||
| && !(BUILD_SYSCLASSPATH_ONLY.equals(project.getProperty(MagicNames.BUILD_SYSCLASSPATH)))) { | |||
| classLoader = project.getCoreLoader(); | |||
| } | |||
| String dataDefs = MagicNames.TYPEDEFS_PROPERTIES_RESOURCE; | |||
| @@ -24,14 +24,19 @@ package org.apache.tools.ant; | |||
| * @since Ant 1.6 | |||
| */ | |||
| public final class MagicNames { | |||
| private MagicNames() { | |||
| } | |||
| /** | |||
| * Ant version property. {@value} | |||
| */ | |||
| public static final String ANT_VERSION = "ant.version"; | |||
| private MagicNames() { | |||
| } | |||
| /** | |||
| * System classpath policy. {@value} | |||
| */ | |||
| public static final String BUILD_SYSCLASSPATH = "build.sysclasspath"; | |||
| /** | |||
| * The name of the script repository used by the script repo task | |||
| @@ -41,25 +41,41 @@ public class Launcher { | |||
| /** The Ant Library Directory property */ | |||
| public static final String ANTLIBDIR_PROPERTY = "ant.library.dir"; | |||
| /** The directory name of the per-user ant directory */ | |||
| /** | |||
| * The directory name of the per-user ant directory | |||
| * {@value} | |||
| */ | |||
| public static final String ANT_PRIVATEDIR = ".ant"; | |||
| /** | |||
| * The location of a per-user library directory | |||
| * The name of a per-user library directory | |||
| * {@value} | |||
| */ | |||
| public static final String ANT_PRIVATELIB = "lib"; | |||
| /** The location of a per-user library directory */ | |||
| /** The location of a per-user library directory | |||
| * {@value} | |||
| */ | |||
| public static final String USER_LIBDIR = | |||
| ANT_PRIVATEDIR + File.separatorChar + ANT_PRIVATELIB; | |||
| /** The startup class that is to be run */ | |||
| /** | |||
| * The startup class that is to be run | |||
| * {@value} | |||
| */ | |||
| public static final String MAIN_CLASS = "org.apache.tools.ant.Main"; | |||
| /** | |||
| * system property with user home directory | |||
| * {@value} | |||
| */ | |||
| public static final String USER_HOMEDIR = "user.home"; | |||
| /** | |||
| * System property of | |||
| * {@value} | |||
| */ | |||
| private static final String JAVA_CLASS_PATH = "java.class.path"; | |||
| /** | |||
| * Entry point for starting command line Ant | |||
| * | |||
| @@ -228,7 +244,7 @@ public class Launcher { | |||
| // now update the class.path property | |||
| StringBuffer baseClassPath | |||
| = new StringBuffer(System.getProperty("java.class.path")); | |||
| = new StringBuffer(System.getProperty(JAVA_CLASS_PATH)); | |||
| if (baseClassPath.charAt(baseClassPath.length() - 1) | |||
| == File.pathSeparatorChar) { | |||
| baseClassPath.setLength(baseClassPath.length() - 1); | |||
| @@ -239,7 +255,7 @@ public class Launcher { | |||
| baseClassPath.append(Locator.fromURI(jars[i].toString())); | |||
| } | |||
| System.setProperty("java.class.path", baseClassPath.toString()); | |||
| System.setProperty(JAVA_CLASS_PATH, baseClassPath.toString()); | |||
| URLClassLoader loader = new URLClassLoader(jars); | |||
| Thread.currentThread().setContextClassLoader(loader); | |||