diff options
author | wisberg <wisberg> | 2005-02-11 05:10:10 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2005-02-11 05:10:10 +0000 |
commit | b3d5619b56d379bb732839ae04c18102595e243f (patch) | |
tree | 990ed894c04fba4e2c9bf45a72811eb1ec6e21bf | |
parent | ed0ceb76f0e86109035a3328427bac4a4d9da983 (diff) | |
download | aspectj-b3d5619b56d379bb732839ae04c18102595e243f.tar.gz aspectj-b3d5619b56d379bb732839ae04c18102595e243f.zip |
Module aliases in a .properties file
-rw-r--r-- | build/src/org/aspectj/internal/tools/build/Builder.java | 45 | ||||
-rw-r--r-- | build/src/org/aspectj/internal/tools/build/Builder.properties | 7 |
2 files changed, 34 insertions, 18 deletions
diff --git a/build/src/org/aspectj/internal/tools/build/Builder.java b/build/src/org/aspectj/internal/tools/build/Builder.java index 84a6a837d..88dcd7553 100644 --- a/build/src/org/aspectj/internal/tools/build/Builder.java +++ b/build/src/org/aspectj/internal/tools/build/Builder.java @@ -15,11 +15,13 @@ package org.aspectj.internal.tools.build; import java.io.File; import java.io.FileFilter; +import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.ListIterator; +import java.util.Properties; import org.apache.tools.ant.BuildException; @@ -99,6 +101,31 @@ public abstract class Builder { /** disable copy filter semantics */ protected static final boolean FILTER_OFF = false; + private static final String ERROR_KEY = "error loading properties"; + private static final Properties PROPS; + static { + PROPS = new Properties(); + String name = Builder.class.getName().replace('.', '/') + ".properties"; + try { + InputStream in = Builder.class.getClassLoader().getResourceAsStream(name); + PROPS.load(in); + } catch (Throwable t) { + String m = "unable to load " + name + ": " + t.getClass() + " " + t; + PROPS.setProperty(ERROR_KEY, m); + } + } + /** + * Map delivered-jar name to created-module name + * @param jarName the String (lowercased) of the jar/zip to map + */ + private String moduleAliasFor(String jarName) { + String result = PROPS.getProperty("alias." + jarName, jarName); + if (verbose && result.equals(jarName)) { + String m = "expected alias for " + jarName; + handler.error(m + PROPS.getProperty(ERROR_KEY, "")); + } + return result; + } protected final Messager handler; protected boolean buildingEnabled; @@ -489,24 +516,6 @@ public abstract class Builder { return (ProductModule[]) results.toArray(new ProductModule[0]); } - /** - * Map delivered-jar name to created-module name - * @param jarName the String (lowercased) of the jar/zip to map - */ - protected String moduleAliasFor(String jarName) { - if ("aspectjtools.jar".equals(jarName)) { // XXXFileLiteral - return "ajbrowser-all.jar"; - } else if ("aspectjrt.jar".equals(jarName)) { - return "runtime.jar"; - } else if ("aspectjweaver.jar".equals(jarName)) { - return "weaver-all.jar"; - } else if ("aspectjlib.jar".equals(jarName)) { - return "org.aspectj.lib.jar"; - } else { - return jarName; - } - } - /** * @return String[] names of modules to build for this module */ diff --git a/build/src/org/aspectj/internal/tools/build/Builder.properties b/build/src/org/aspectj/internal/tools/build/Builder.properties new file mode 100644 index 000000000..1069112ae --- /dev/null +++ b/build/src/org/aspectj/internal/tools/build/Builder.properties @@ -0,0 +1,7 @@ + +# alias product/dist/lib/{name} to project jar +# used by Builder.moduleAliasFor(String) +alias.aspectjtools.jar=ajbrowser-all.jar +alias.aspectjrt.jar=aspectj5rt-all.jar +alias.aspectjweaver.jar=weaver-all.jar +alias.aspectjlib.jar=org.aspectj.lib.jar |