aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-04-03 01:24:15 +0000
committerwisberg <wisberg>2003-04-03 01:24:15 +0000
commitfc985209fc8002a141300da7f1c24d3177d03a19 (patch)
treef38ab2913960a5789fd933575b97c55a0e8b44d9 /build
parent17bf8c0fe746e751eee0f43feda6c1629c430d26 (diff)
downloadaspectj-fc985209fc8002a141300da7f1c24d3177d03a19.tar.gz
aspectj-fc985209fc8002a141300da7f1c24d3177d03a19.zip
- a module now may be valid if it contains only references to library jars.
- a module now surfaces its "exported" libraries.
Diffstat (limited to 'build')
-rw-r--r--build/src/org/aspectj/internal/tools/build/Module.java53
1 files changed, 44 insertions, 9 deletions
diff --git a/build/src/org/aspectj/internal/tools/build/Module.java b/build/src/org/aspectj/internal/tools/build/Module.java
index 984c330d8..c98031c54 100644
--- a/build/src/org/aspectj/internal/tools/build/Module.java
+++ b/build/src/org/aspectj/internal/tools/build/Module.java
@@ -145,7 +145,13 @@ public class Module {
private final File assembledJar;
/** File list of library jars */
- private final List libJars;
+ private final List libJars;
+
+ /**
+ * File list of library jars exported to clients
+ * (duplicates some libJars entries)
+ */
+ private final List exportedLibJars;
/** File list of source directories */
private final List srcDirs;
@@ -183,6 +189,7 @@ public class Module {
this.moduleDir = moduleDir;
this.trimTesting = trimTesting;
this.libJars = new ArrayList();
+ this.exportedLibJars = new ArrayList();
this.required = new ArrayList();
this.srcDirs = new ArrayList();
this.properties = new Properties();
@@ -209,6 +216,11 @@ public class Module {
return Collections.unmodifiableList(required);
}
+ /** @return unmodifiable list of exported library files, guaranteed readable */
+ public List getExportedLibJars() {
+ return Collections.unmodifiableList(exportedLibJars);
+ }
+
/** @return unmodifiable list of required library files, guaranteed readable */
public List getLibJars() {
return Collections.unmodifiableList(libJars);
@@ -340,7 +352,7 @@ public class Module {
while (null != (line = reader.readLine())) {
lastKind = parseLine(line, lastKind);
}
- return (0 < srcDirs.size());
+ return (0 < (srcDirs.size() + libJars.size()));
} catch (IOException e) {
messager.logException("IOException reading " + file, e);
} finally {
@@ -414,7 +426,7 @@ public class Module {
return true;
}
- private String parseLine(String line, String lastKind) {
+ private String parseLine(final String line, String lastKind) {
if (null == line) {
return null;
}
@@ -454,7 +466,8 @@ public class Module {
messager.error("unable to create required module: " + moduleName);
}
} else { // src dir
- File srcDir = new File(moduleDir, path);
+ String fullPath = getFullPath(path);
+ File srcDir = new File(fullPath);
if (srcDir.canRead() && srcDir.isDirectory()) {
srcDirs.add(srcDir);
} else {
@@ -462,12 +475,13 @@ public class Module {
}
}
} else if ("lib".equals(kind)) {
- String libPath = path.startsWith("/")
- ? modules.baseDir.getAbsolutePath() + path
- : path;
- File libJar = new File(libPath);
+ String fullPath = getFullPath(path);
+ File libJar= new File(fullPath);
if (libJar.canRead() && libJar.isFile()) {
libJars.add(libJar);
+ if (-1 != line.indexOf("exported=\"true\"")) {
+ exportedLibJars.add(libJar);
+ }
} else {
messager.error("no such library jar " + libJar + " from " + line);
}
@@ -476,7 +490,9 @@ public class Module {
messager.log("cannot handle var yet: " + line);
}
} else if ("con".equals(kind)) {
- messager.log("cannot handle con yet: " + line);
+ if (-1 == line.indexOf("JRE")) { // warn non-JRE containers
+ messager.log("cannot handle con yet: " + line);
+ }
} else if ("out".equals(kind)) {
// ignore output entries
} else {
@@ -484,6 +500,25 @@ public class Module {
}
return null;
}
+ /** resolve path absolutely, assuming / means base of modules dir */
+ private String getFullPath(String path) {
+ String fullPath;
+ if (path.startsWith("/")) {
+ fullPath = modules.baseDir.getAbsolutePath() + path;
+ } else {
+ fullPath = moduleDir.getAbsolutePath() + "/" + path;
+ }
+ // check for absolute paths (untested - none in our modules so far)
+ File testFile = new File(fullPath);
+ //System.out.println("Module.getFullPath: " + fullPath + " - " + testFile.getAbsolutePath());
+ if (! testFile.exists()) {
+ testFile = new File(path);
+ if (testFile.exists() && testFile.isAbsolute()) {
+ fullPath = path;
+ }
+ }
+ return fullPath;
+ }
/** @return List of File of any module or library jar ending with suffix */
private ArrayList findJarsBySuffix(String suffix) {