Browse Source

Jikes supports -bootclasspath

PR: 32609

Make bootclasspath construction in <javac> take build.sysclasspath
into account.  Probably needs to get used in all other tasks
supporting bootclasspath as well.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277259 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 20 years ago
parent
commit
3476b74ca5
3 changed files with 48 additions and 23 deletions
  1. +24
    -7
      src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  2. +4
    -13
      src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java
  3. +20
    -3
      src/main/org/apache/tools/ant/types/Path.java

+ 24
- 7
src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -213,12 +213,12 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter {
// as well as "bootclasspath" and "extdirs" // as well as "bootclasspath" and "extdirs"
if (assumeJava11()) { if (assumeJava11()) {
Path cp = new Path(project); Path cp = new Path(project);
/*
* XXX - This doesn't mix very well with build.systemclasspath,
*/
if (bootclasspath != null) {
cp.append(bootclasspath);

Path bp = getBootClassPath();
if (bp.size() > 0) {
cp.append(bp);
} }

if (extdirs != null) { if (extdirs != null) {
cp.addExtdirs(extdirs); cp.addExtdirs(extdirs);
} }
@@ -237,10 +237,13 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter {
cmd.createArgument().setValue("-target"); cmd.createArgument().setValue("-target");
cmd.createArgument().setValue(target); cmd.createArgument().setValue(target);
} }
if (bootclasspath != null && bootclasspath.size() > 0) {

Path bp = getBootClassPath();
if (bp.size() > 0) {
cmd.createArgument().setValue("-bootclasspath"); cmd.createArgument().setValue("-bootclasspath");
cmd.createArgument().setPath(bootclasspath);
cmd.createArgument().setPath(bp);
} }

if (extdirs != null && extdirs.size() > 0) { if (extdirs != null && extdirs.size() > 0) {
cmd.createArgument().setValue("-extdirs"); cmd.createArgument().setValue("-extdirs");
cmd.createArgument().setPath(extdirs); cmd.createArgument().setPath(extdirs);
@@ -523,5 +526,19 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter {
&& JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_4)); && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_4));
} }


/**
* Combines a user specified bootclasspath with the system
* bootclasspath taking build.sysclasspath into account.
*
* @return a non-null Path instance that combines the user
* specified and the system bootclasspath.
*/
protected Path getBootClassPath() {
Path bp = new Path(project);
if (bootclasspath != null) {
bp.append(bootclasspath);
}
return bp.concatSystemBootClasspath("ignore");
}
} }



+ 4
- 13
src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java View File

@@ -35,7 +35,7 @@ public class Jikes extends DefaultCompilerAdapter {
* Performs a compile using the Jikes compiler from IBM. * Performs a compile using the Jikes compiler from IBM.
* Mostly of this code is identical to doClassicCompile() * Mostly of this code is identical to doClassicCompile()
* However, it does not support all options like * However, it does not support all options like
* bootclasspath, extdirs, deprecation and so on, because
* extdirs, deprecation and so on, because
* there is no option in jikes and I don't understand * there is no option in jikes and I don't understand
* what they should do. * what they should do.
* *
@@ -46,12 +46,6 @@ public class Jikes extends DefaultCompilerAdapter {


Path classpath = new Path(project); Path classpath = new Path(project);


// Jikes doesn't support bootclasspath dir (-bootclasspath)
// so we'll emulate it for compatibility and convenience.
if (bootclasspath != null) {
classpath.append(bootclasspath);
}

// Jikes doesn't support an extension dir (-extdir) // Jikes doesn't support an extension dir (-extdir)
// so we'll emulate it for compatibility and convenience. // so we'll emulate it for compatibility and convenience.
classpath.addExtdirs(extdirs); classpath.addExtdirs(extdirs);
@@ -203,13 +197,10 @@ public class Jikes extends DefaultCompilerAdapter {
int firstFileName = cmd.size(); int firstFileName = cmd.size();
logAndAddFilesToCompile(cmd); logAndAddFilesToCompile(cmd);


// this is a quick hack to make things work in a
// Gump/Kaffe/Jikes combo. I promise I'll explain it later -
// and add a real solution as well ;-) Stefan
if ("true".equals(System.getProperty("build.clonevm"))
&& Path.systemBootClasspath.size() > 0) {
Path boot = getBootClassPath();
if (boot.size() > 0) {
cmd.createArgument().setValue("-bootclasspath"); cmd.createArgument().setValue("-bootclasspath");
cmd.createArgument().setPath(Path.systemBootClasspath);
cmd.createArgument().setPath(boot);
} }


return return


+ 20
- 3
src/main/org/apache/tools/ant/types/Path.java View File

@@ -530,7 +530,24 @@ public class Path extends DataType implements Cloneable {
* if ${build.sysclasspath} has not been set. * if ${build.sysclasspath} has not been set.
*/ */
public Path concatSystemClasspath(String defValue) { public Path concatSystemClasspath(String defValue) {
return concatSpecialPath(defValue, Path.systemClasspath);
}


/**
* Concatenates the system boot class path in the order specified
* by the ${build.sysclasspath} property - using the supplied
* value if ${build.sysclasspath} has not been set.
*/
public Path concatSystemBootClasspath(String defValue) {
return concatSpecialPath(defValue, Path.systemBootClasspath);
}

/**
* Concatenates a class path in the order specified by the
* ${build.sysclasspath} property - using the supplied value if
* ${build.sysclasspath} has not been set.
*/
private Path concatSpecialPath(String defValue, Path p) {
Path result = new Path(getProject()); Path result = new Path(getProject());


String order = defValue; String order = defValue;
@@ -543,11 +560,11 @@ public class Path extends DataType implements Cloneable {


if (order.equals("only")) { if (order.equals("only")) {
// only: the developer knows what (s)he is doing // only: the developer knows what (s)he is doing
result.addExisting(Path.systemClasspath, true);
result.addExisting(p, true);


} else if (order.equals("first")) { } else if (order.equals("first")) {
// first: developer could use a little help // first: developer could use a little help
result.addExisting(Path.systemClasspath, true);
result.addExisting(p, true);
result.addExisting(this); result.addExisting(this);


} else if (order.equals("ignore")) { } else if (order.equals("ignore")) {
@@ -562,7 +579,7 @@ public class Path extends DataType implements Cloneable {
} }


result.addExisting(this); result.addExisting(this);
result.addExisting(Path.systemClasspath, true);
result.addExisting(p, true);
} }






Loading…
Cancel
Save