aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-04-23 08:33:39 +0000
committerwisberg <wisberg>2003-04-23 08:33:39 +0000
commitd850ca48e8696e82b319c5b17377d6f19df2b719 (patch)
tree32594ffa887148bc1314359071597423bfad8fe0
parent90b260074423dc1fbafc3a33764606a58cb78f90 (diff)
downloadaspectj-d850ca48e8696e82b319c5b17377d6f19df2b719.tar.gz
aspectj-d850ca48e8696e82b319c5b17377d6f19df2b719.zip
extracted classpath setup method for testing
-rw-r--r--build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java49
1 files changed, 27 insertions, 22 deletions
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;
}
/**