Browse Source

build.sysclasspath is a magic name

master
twogee 5 years ago
parent
commit
ae32a21a7e
5 changed files with 14 additions and 14 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/AntClassLoader.java
  2. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Classloader.java
  3. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Javac.java
  4. +6
    -6
      src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
  5. +1
    -1
      src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java

+ 1
- 1
src/main/org/apache/tools/ant/AntClassLoader.java View File

@@ -448,7 +448,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
if (LoaderUtils.isContextLoaderAvailable()) {
savedContextLoader = LoaderUtils.getContextClassLoader();
ClassLoader loader = this;
if (project != null && "only".equals(project.getProperty("build.sysclasspath"))) {
if (project != null && "only".equals(project.getProperty(MagicNames.BUILD_SYSCLASSPATH))) {
loader = this.getClass().getClassLoader();
}
LoaderUtils.setContextClassLoader(loader);


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Classloader.java View File

@@ -158,10 +158,10 @@ public class Classloader extends Task {
public void execute() {
try {
// Gump friendly - don't mess with the core loader if only classpath
if ("only".equals(getProject().getProperty("build.sysclasspath"))
if ("only".equals(getProject().getProperty(MagicNames.BUILD_SYSCLASSPATH))
&& (name == null || SYSTEM_LOADER_REF.equals(name))) {
log("Changing the system loader is disabled by build.sysclasspath=only",
Project.MSG_WARN);
log("Changing the system loader is disabled by "
+ MagicNames.BUILD_SYSCLASSPATH + "=only", Project.MSG_WARN);
return;
}



+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -1350,9 +1350,9 @@ public class Javac extends MatchingTask {
+ destDir
+ "\" does not exist or is not a directory", getLocation());
}
if (includeAntRuntime == null && getProject().getProperty("build.sysclasspath") == null) {
log(getLocation()
+ "warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds",
if (includeAntRuntime == null && getProject().getProperty(MagicNames.BUILD_SYSCLASSPATH) == null) {
log(getLocation() + "warning: 'includeantruntime' was not set, defaulting to "
+ MagicNames.BUILD_SYSCLASSPATH + "=last; set to false for repeatable builds",
Project.MSG_WARN);
}
}


+ 6
- 6
src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java View File

@@ -75,7 +75,7 @@ public class AntClassLoaderTest {
String extjarstring = buildRule.getProject().getProperty("ext.jar");
Path myPath = new Path(buildRule.getProject());
myPath.setLocation(new File(mainjarstring));
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
loader = buildRule.getProject().createClassLoader(myPath);
String path = loader.getClasspath();
assertEquals(mainjarstring + File.pathSeparator + extjarstring, path);
@@ -87,7 +87,7 @@ public class AntClassLoaderTest {
String extjarstring = buildRule.getProject().getProperty("ext.jar.nonascii");
Path myPath = new Path(buildRule.getProject());
myPath.setLocation(new File(mainjarstring));
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
loader = buildRule.getProject().createClassLoader(myPath);
String path = loader.getClasspath();
assertEquals(mainjarstring + File.pathSeparator + extjarstring, path);
@@ -135,7 +135,7 @@ public class AntClassLoaderTest {
buildRule.executeTarget("prepareGetPackageTest");
Path myPath = new Path(buildRule.getProject());
myPath.setLocation(new File(buildRule.getProject().getProperty("test.jar")));
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
loader = buildRule.getProject().createClassLoader(myPath);
assertNotNull("should find class", loader.findClass("org.example.Foo"));
assertNotNull("should find package",
@@ -148,7 +148,7 @@ public class AntClassLoaderTest {
Path myPath = new Path(buildRule.getProject());
File testJar = new File(buildRule.getProject().getProperty("test.jar"));
myPath.setLocation(testJar);
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
loader = buildRule.getProject().createClassLoader(myPath);
Class<?> foo = loader.findClass("org.example.Foo");
URL codeSourceLocation =
@@ -164,7 +164,7 @@ public class AntClassLoaderTest {

Path myPath = new Path(buildRule.getProject());
myPath.setLocation(jar);
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
loader = buildRule.getProject().createClassLoader(myPath);
Class<?> foo = loader.findClass("org.example.Foo");

@@ -188,7 +188,7 @@ public class AntClassLoaderTest {

Path myPath = new Path(buildRule.getProject());
myPath.setLocation(jar);
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
loader = buildRule.getProject().createClassLoader(myPath);
PrintStream sysErr = System.err;
try {


+ 1
- 1
src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java View File

@@ -53,7 +53,7 @@ public class CommandlineJavaTest {
if (System.getProperty(MagicTestNames.TEST_ROOT_DIRECTORY) != null) {
project.setBasedir(System.getProperty(MagicTestNames.TEST_ROOT_DIRECTORY));
}
project.setProperty("build.sysclasspath", "ignore");
project.setProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
cloneVm = System.getProperty("ant.build.clonevm");
if (cloneVm != null) {
System.setProperty("ant.build.clonevm", "false");


Loading…
Cancel
Save