Skip to content

Commit ae32a21

Browse files
committed
build.sysclasspath is a magic name
1 parent fd1de05 commit ae32a21

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

src/main/org/apache/tools/ant/AntClassLoader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ public void setThreadContextLoader() {
448448
if (LoaderUtils.isContextLoaderAvailable()) {
449449
savedContextLoader = LoaderUtils.getContextClassLoader();
450450
ClassLoader loader = this;
451-
if (project != null && "only".equals(project.getProperty("build.sysclasspath"))) {
451+
if (project != null && "only".equals(project.getProperty(MagicNames.BUILD_SYSCLASSPATH))) {
452452
loader = this.getClass().getClassLoader();
453453
}
454454
LoaderUtils.setContextClassLoader(loader);

src/main/org/apache/tools/ant/taskdefs/Classloader.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ public Path createClasspath() {
158158
public void execute() {
159159
try {
160160
// Gump friendly - don't mess with the core loader if only classpath
161-
if ("only".equals(getProject().getProperty("build.sysclasspath"))
161+
if ("only".equals(getProject().getProperty(MagicNames.BUILD_SYSCLASSPATH))
162162
&& (name == null || SYSTEM_LOADER_REF.equals(name))) {
163-
log("Changing the system loader is disabled by build.sysclasspath=only",
164-
Project.MSG_WARN);
163+
log("Changing the system loader is disabled by "
164+
+ MagicNames.BUILD_SYSCLASSPATH + "=only", Project.MSG_WARN);
165165
return;
166166
}
167167

src/main/org/apache/tools/ant/taskdefs/Javac.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1350,9 +1350,9 @@ protected void checkParameters() throws BuildException {
13501350
+ destDir
13511351
+ "\" does not exist or is not a directory", getLocation());
13521352
}
1353-
if (includeAntRuntime == null && getProject().getProperty("build.sysclasspath") == null) {
1354-
log(getLocation()
1355-
+ "warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds",
1353+
if (includeAntRuntime == null && getProject().getProperty(MagicNames.BUILD_SYSCLASSPATH) == null) {
1354+
log(getLocation() + "warning: 'includeantruntime' was not set, defaulting to "
1355+
+ MagicNames.BUILD_SYSCLASSPATH + "=last; set to false for repeatable builds",
13561356
Project.MSG_WARN);
13571357
}
13581358
}

src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public void testJarWithManifestInDirWithSpace() {
7575
String extjarstring = buildRule.getProject().getProperty("ext.jar");
7676
Path myPath = new Path(buildRule.getProject());
7777
myPath.setLocation(new File(mainjarstring));
78-
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
78+
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
7979
loader = buildRule.getProject().createClassLoader(myPath);
8080
String path = loader.getClasspath();
8181
assertEquals(mainjarstring + File.pathSeparator + extjarstring, path);
@@ -87,7 +87,7 @@ public void testJarWithManifestInNonAsciiDir() {
8787
String extjarstring = buildRule.getProject().getProperty("ext.jar.nonascii");
8888
Path myPath = new Path(buildRule.getProject());
8989
myPath.setLocation(new File(mainjarstring));
90-
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
90+
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
9191
loader = buildRule.getProject().createClassLoader(myPath);
9292
String path = loader.getClasspath();
9393
assertEquals(mainjarstring + File.pathSeparator + extjarstring, path);
@@ -135,7 +135,7 @@ public void testGetPackage() throws Exception {
135135
buildRule.executeTarget("prepareGetPackageTest");
136136
Path myPath = new Path(buildRule.getProject());
137137
myPath.setLocation(new File(buildRule.getProject().getProperty("test.jar")));
138-
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
138+
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
139139
loader = buildRule.getProject().createClassLoader(myPath);
140140
assertNotNull("should find class", loader.findClass("org.example.Foo"));
141141
assertNotNull("should find package",
@@ -148,7 +148,7 @@ public void testCodeSource() throws Exception {
148148
Path myPath = new Path(buildRule.getProject());
149149
File testJar = new File(buildRule.getProject().getProperty("test.jar"));
150150
myPath.setLocation(testJar);
151-
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
151+
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
152152
loader = buildRule.getProject().createClassLoader(myPath);
153153
Class<?> foo = loader.findClass("org.example.Foo");
154154
URL codeSourceLocation =
@@ -164,7 +164,7 @@ public void testSignedJar() throws Exception {
164164

165165
Path myPath = new Path(buildRule.getProject());
166166
myPath.setLocation(jar);
167-
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
167+
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
168168
loader = buildRule.getProject().createClassLoader(myPath);
169169
Class<?> foo = loader.findClass("org.example.Foo");
170170

@@ -188,7 +188,7 @@ public void testInvalidZipException() {
188188

189189
Path myPath = new Path(buildRule.getProject());
190190
myPath.setLocation(jar);
191-
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
191+
buildRule.getProject().setUserProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
192192
loader = buildRule.getProject().createClassLoader(myPath);
193193
PrintStream sysErr = System.err;
194194
try {

src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void setUp() {
5353
if (System.getProperty(MagicTestNames.TEST_ROOT_DIRECTORY) != null) {
5454
project.setBasedir(System.getProperty(MagicTestNames.TEST_ROOT_DIRECTORY));
5555
}
56-
project.setProperty("build.sysclasspath", "ignore");
56+
project.setProperty(MagicNames.BUILD_SYSCLASSPATH, "ignore");
5757
cloneVm = System.getProperty("ant.build.clonevm");
5858
if (cloneVm != null) {
5959
System.setProperty("ant.build.clonevm", "false");

0 commit comments

Comments
 (0)