Browse Source

Try to harmonize bootclasspath and build.sysclasspath a bit more, there are still some more tasks to handle

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277348 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 20 years ago
parent
commit
6d857af2bf
2 changed files with 30 additions and 32 deletions
  1. +5
    -0
      WHATSNEW
  2. +25
    -32
      src/main/org/apache/tools/ant/types/CommandlineJava.java

+ 5
- 0
WHATSNEW View File

@@ -10,6 +10,11 @@ Changes that could break older environments:
to upgrade to a newer version of log4j.
Bugzilla Report 31951.

* build.sysclasspath now also affects the bootclasspath handling of
spawned Java VMs. If you set build.sysclasspath to anything other
than "ignore" (or leave it unset, since "ignore" is the default when
it comes to bootclasspath handling), then the bootclasspath of the
VM running Ant will be added to the bootclasspath you've specified.

Fixed bugs:
-----------


+ 25
- 32
src/main/org/apache/tools/ant/types/CommandlineJava.java View File

@@ -386,13 +386,11 @@ public class CommandlineJava implements Cloneable {
}

//boot classpath
if (haveBootclasspath(true)) {
listIterator.add("-Xbootclasspath:" + bootclasspath.toString());
} else if (cloneBootclasspath()) {
listIterator.add("-Xbootclasspath:"
+ Path.systemBootClasspath.toString());
Path bcp = calculateBootclasspath(true);
if (bcp.size() > 0) {
listIterator.add("-Xbootclasspath:" + bcp.toString());
}
//main classpath
if (haveClasspath()) {
listIterator.add("-classpath");
@@ -493,7 +491,7 @@ public class CommandlineJava implements Cloneable {
size += 2;
}
// bootclasspath is "-Xbootclasspath:<classpath>" -> 1 arg
if (haveBootclasspath(true) || cloneBootclasspath()) {
if (calculateBootclasspath(true).size() > 0) {
size++;
}
// jar execution requires an additional -jar option
@@ -622,37 +620,32 @@ public class CommandlineJava implements Cloneable {
* @since Ant 1.6
*/
protected boolean haveBootclasspath(boolean log) {
if (bootclasspath != null
&& bootclasspath.toString().trim().length() > 0) {

if (!bootclasspath.toString()
.equals(bootclasspath.concatSystemClasspath("ignore")
.toString())) {
if (log) {
bootclasspath.log("Ignoring bootclasspath as "
+ "build.sysclasspath has been set.");
}
} else if (vmVersion.startsWith("1.1")) {
if (log) {
bootclasspath.log("Ignoring bootclasspath as "
+ "the target VM doesn't support it.");
}
} else {
return true;
}
}
return false;
return calculateBootclasspath(log).size() > 0;
}

/**
* Should a bootclasspath argument be created to clone the current
* VM settings?
* Calculate the bootclasspath based on the bootclasspath
* specified, the build.sysclasspath and build.clonevm magic
* properties as well as the cloneVm attribute.
*
* @since Ant 1.7
*/
private boolean cloneBootclasspath() {
return isCloneVm() && !vmVersion.startsWith("1.1")
&& Path.systemBootClasspath.size() > 0;
private Path calculateBootclasspath(boolean log) {
if (vmVersion.startsWith("1.1")) {
if (bootclasspath != null && log) {
bootclasspath.log("Ignoring bootclasspath as "
+ "the target VM doesn't support it.");
}
} else {
if (bootclasspath != null) {
return bootclasspath.concatSystemBootClasspath(isCloneVm()
? "last"
: "ignore");
} else if (isCloneVm()) {
return Path.systemBootClasspath;
}
}
return new Path(null);
}

/**


Loading…
Cancel
Save