From: wisberg Date: Wed, 23 Apr 2003 08:33:39 +0000 (+0000) Subject: extracted classpath setup method for testing X-Git-Tag: V1_1_0_RC2~157 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d850ca48e8696e82b319c5b17377d6f19df2b719;p=aspectj.git extracted classpath setup method for testing --- diff --git a/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java b/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java index 233adce1e..80051fd7c 100644 --- a/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java +++ b/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java @@ -241,6 +241,32 @@ public class AntBuilder extends Builder { // -- classpath Path classpath = new Path(project); + boolean hasLibraries = setupClasspath(module, classpath); + // need to add system classes?? + boolean inEclipse = true; // XXX detect, fork only in eclipse + if (hasLibraries && inEclipse) { + javac.setFork(true); // XXX otherwise never releases library jars + } + + // -- set output directory + classpath.createPathElement().setLocation(classesDir); + javac.setClasspath(classpath); + // misc + javac.setDebug(true); + // compile + try { + return executeTask(javac); + } catch (BuildException e) { + String args = "" + Arrays.asList(javac.getCurrentCompilerArgs()); + errors.add("BuildException compiling " + module.toLongString() + args + + ": " + Util.renderException(e)); + return false; + } finally { + javac.init(); // be nice to let go of classpath libraries... + } + } + + public boolean setupClasspath(Module module, Path classpath) { // XXX fix test access boolean hasLibraries = false; // required libraries for (Iterator iter = module.getLibJars().iterator(); iter.hasNext();) { @@ -265,28 +291,7 @@ public class AntBuilder extends Builder { classpath.createPathElement().setLocation((File) iterator.next()); } } - // need to add system classes?? - boolean inEclipse = true; // XXX detect, fork only in eclipse - if (hasLibraries && inEclipse) { - javac.setFork(true); // XXX otherwise never releases library jars - } - - // -- set output directory - classpath.createPathElement().setLocation(classesDir); - javac.setClasspath(classpath); - // misc - javac.setDebug(true); - // compile - try { - return executeTask(javac); - } catch (BuildException e) { - String args = "" + Arrays.asList(javac.getCurrentCompilerArgs()); - errors.add("BuildException compiling " + module.toLongString() + args - + ": " + Util.renderException(e)); - return false; - } finally { - javac.init(); // be nice to let go of classpath libraries... - } + return hasLibraries; } /**