From ba0d3f2a3e98523d8fd5a9c4e8e2005a901eadc0 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Fri, 29 Dec 2000 14:35:39 +0000 Subject: [PATCH] Control the order in which the system and build classpaths are combined via a new property: build.sysclasspath. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268383 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/taskdefs/Javac.java | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index 4aeafed5b..586f348c6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -372,9 +372,6 @@ public class Javac extends MatchingTask { } } - // XXX - // we need a way to not use the current classpath. - /** * Builds the compilation classpath. * @@ -391,15 +388,38 @@ public class Javac extends MatchingTask { classpath.setLocation(destDir); } - // add our classpath to the mix + // Compine the build classpath with the system classpath, in an + // order determined by the value of build.classpath + + if (compileClasspath == null) { + classpath.addExisting(Path.systemClasspath); + } else { + String order = project.getProperty("build.sysclasspath"); + if (order == null) order="first"; + + if (order.equals("only")) { + // only: the developer knows what (s)he is doing + classpath.addExisting(Path.systemClasspath); - if (compileClasspath != null) { - classpath.addExisting(compileClasspath); + } else if (order.equals("last")) { + // last: don't trust the developer + classpath.addExisting(compileClasspath); + classpath.addExisting(Path.systemClasspath); + + } else if (order.equals("ignore")) { + // ignore: don't trust anyone + classpath.addExisting(compileClasspath); + addRuntime = true; + + } else { + // first: developer could use a little help + classpath.addExisting(Path.systemClasspath); + classpath.addExisting(compileClasspath); + } } - // add the system classpath + // optionally add the runtime classes - classpath.addExisting(Path.systemClasspath); if (addRuntime) { if (System.getProperty("java.vendor").toLowerCase().indexOf("microsoft") >= 0) { // Pull in *.zip from packages directory