bodewig 2004/12/21 07:44:51
Modified: src/main/org/apache/tools/ant/taskdefs/compilers
DefaultCompilerAdapter.java Jikes.java
src/main/org/apache/tools/ant/types Path.java
Log:
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.
Revision Changes Path
1.52 +24 -7
ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
Index: DefaultCompilerAdapter.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- DefaultCompilerAdapter.java 22 Nov 2004 09:23:30 -0000 1.51
+++ DefaultCompilerAdapter.java 21 Dec 2004 15:44:51 -0000 1.52
@@ -213,12 +213,12 @@
// as well as "bootclasspath" and "extdirs"
if (assumeJava11()) {
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) {
cp.addExtdirs(extdirs);
}
@@ -237,10 +237,13 @@
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().setPath(bootclasspath);
+ cmd.createArgument().setPath(bp);
}
+
if (extdirs != null && extdirs.size() > 0) {
cmd.createArgument().setValue("-extdirs");
cmd.createArgument().setPath(extdirs);
@@ -523,5 +526,19 @@
&& 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");
+ }
}
1.30 +4 -13
ant/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java
Index: Jikes.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Jikes.java 10 Dec 2004 17:29:04 -0000 1.29
+++ Jikes.java 21 Dec 2004 15:44:51 -0000 1.30
@@ -35,7 +35,7 @@
* Performs a compile using the Jikes compiler from IBM.
* Mostly of this code is identical to doClassicCompile()
* 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
* what they should do.
*
@@ -46,12 +46,6 @@
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)
// so we'll emulate it for compatibility and convenience.
classpath.addExtdirs(extdirs);
@@ -203,13 +197,10 @@
int firstFileName = cmd.size();
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().setPath(Path.systemBootClasspath);
+ cmd.createArgument().setPath(boot);
}
return
1.67 +20 -3 ant/src/main/org/apache/tools/ant/types/Path.java
Index: Path.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/Path.java,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- Path.java 16 Dec 2004 14:01:37 -0000 1.66
+++ Path.java 21 Dec 2004 15:44:51 -0000 1.67
@@ -530,7 +530,24 @@
* if ${build.sysclasspath} has not been set.
*/
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());
String order = defValue;
@@ -543,11 +560,11 @@
if (order.equals("only")) {
// only: the developer knows what (s)he is doing
- result.addExisting(Path.systemClasspath, true);
+ result.addExisting(p, true);
} else if (order.equals("first")) {
// first: developer could use a little help
- result.addExisting(Path.systemClasspath, true);
+ result.addExisting(p, true);
result.addExisting(this);
} else if (order.equals("ignore")) {
@@ -562,7 +579,7 @@
}
result.addExisting(this);
- result.addExisting(Path.systemClasspath, true);
+ result.addExisting(p, true);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]