diff options
author | wisberg <wisberg> | 2003-04-03 01:26:49 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-04-03 01:26:49 +0000 |
commit | c17bf50311c2c9eaeace21bd7477acfb7e0e6c9b (patch) | |
tree | 63ec9b3a8f3826a7d80139785d73dca6b97abaab /build | |
parent | fc985209fc8002a141300da7f1c24d3177d03a19 (diff) | |
download | aspectj-c17bf50311c2c9eaeace21bd7477acfb7e0e6c9b.tar.gz aspectj-c17bf50311c2c9eaeace21bd7477acfb7e0e6c9b.zip |
- if a module has no source files, rather than aborting, create a minimal file for the module jar.
- if a required module has exported libraries, add those to the compile classpath of the requiring module.
Diffstat (limited to 'build')
-rw-r--r-- | build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java | 51 |
1 files changed, 38 insertions, 13 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 0cfd097b7..233adce1e 100644 --- a/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java +++ b/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java @@ -12,6 +12,8 @@ package org.aspectj.internal.tools.ant.taskdefs; import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -207,11 +209,32 @@ public class AntBuilder extends Builder { // I suspect it requires the proper adapter setup. Javac javac = new Javac(); setupTask(javac, "javac"); + javac.setDestdir(classesDir); + if (!classesDir.mkdirs()) { + errors.add("unable to create classes directory"); + return false; + } // -- source paths Path path = new Path(project); + boolean hasSourceDirectories = false; for (Iterator iter = module.getSrcDirs().iterator(); iter.hasNext();) { File file = (File) iter.next(); path.createPathElement().setLocation(file); + if (!hasSourceDirectories) { + hasSourceDirectories = true; + } + } + if (!hasSourceDirectories) { // none - dump minimal file and exit + File minFile = new File(classesDir, module.name); + try { + FileWriter fw = new FileWriter(minFile); + fw.write(module.name); + fw.close(); + } catch (IOException e) { + // ignore + } + // XXX signal? + return true; // nothing to compile - ok } javac.setSrcdir(path); path = null; @@ -219,21 +242,28 @@ public class AntBuilder extends Builder { // -- classpath Path classpath = new Path(project); boolean hasLibraries = false; - // modules - for (Iterator iter = module.getRequired().iterator(); iter.hasNext();) { - Module required = (Module) iter.next(); - classpath.createPathElement().setLocation(required.getModuleJar()); + // required libraries + for (Iterator iter = module.getLibJars().iterator(); iter.hasNext();) { + File file = (File) iter.next(); + classpath.createPathElement().setLocation(file); if (!hasLibraries) { hasLibraries = true; } } - // libraries - for (Iterator iter = module.getLibJars().iterator(); iter.hasNext();) { - File file = (File) iter.next(); - classpath.createPathElement().setLocation(file); + // required modules and their exported libraries + for (Iterator iter = module.getRequired().iterator(); iter.hasNext();) { + Module required = (Module) iter.next(); + classpath.createPathElement().setLocation(required.getModuleJar()); if (!hasLibraries) { hasLibraries = true; } + // also put on classpath libraries exported from required module + // XXX exported modules not supported + for (Iterator iterator = required.getExportedLibJars().iterator(); + iterator.hasNext(); + ) { + classpath.createPathElement().setLocation((File) iterator.next()); + } } // need to add system classes?? boolean inEclipse = true; // XXX detect, fork only in eclipse @@ -244,11 +274,6 @@ public class AntBuilder extends Builder { // -- set output directory classpath.createPathElement().setLocation(classesDir); javac.setClasspath(classpath); - javac.setDestdir(classesDir); - if (!classesDir.mkdirs()) { - errors.add("unable to create classes directory"); - return false; - } // misc javac.setDebug(true); // compile |