summaryrefslogtreecommitdiffstats
path: root/build/src
diff options
context:
space:
mode:
authorwisberg <wisberg>2005-05-05 06:48:52 +0000
committerwisberg <wisberg>2005-05-05 06:48:52 +0000
commitcdede6da8be04746b9958a47e3ccdfe67bd0cd5a (patch)
treecf8276308749aece8e0d99a2097022ac91f0ad31 /build/src
parent126357c353aa710b0191daa51d70b41edfc7351e (diff)
downloadaspectj-cdede6da8be04746b9958a47e3ccdfe67bd0cd5a.tar.gz
aspectj-cdede6da8be04746b9958a47e3ccdfe67bd0cd5a.zip
nit - consolidating "/" and File.separator
Diffstat (limited to 'build/src')
-rw-r--r--build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java11
-rw-r--r--build/src/org/aspectj/internal/tools/build/Builder.java4
-rw-r--r--build/src/org/aspectj/internal/tools/build/Module.java32
-rw-r--r--build/src/org/aspectj/internal/tools/build/Util.java17
4 files changed, 26 insertions, 38 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 40c6bb3c9..8b3021ab8 100644
--- a/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java
+++ b/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java
@@ -587,8 +587,8 @@ public class AntBuilder extends Builder {
libDirs[i] = project.getProperty(libDirNames[i]);
}
if (null != libDirs[i]) {
- libDirs[i] += File.separator + "lib";
- result = new Path(project, libDirs[i] + File.separator + name);
+ libDirs[i] = Util.path(libDirs[i], "lib");
+ result = new Path(project, Util.path(libDirs[i], name));
String path = result.toString();
if (new File(path).canRead()) {
return result;
@@ -705,13 +705,12 @@ class ProductBuilder extends AntBuilder {
private static String getProductInstallResourcesSrc(BuildSpec buildSpec) {
final String resourcesName = "installer-resources"; // XXXFileLiteral
File dir = buildSpec.productDir.getParentFile();
-// String result = null;
if (null == dir) {
- return "../../" + resourcesName;
+ return Util.path(new String[] {"..", "..", resourcesName});
}
dir = dir.getParentFile();
if (null == dir) {
- return "../" + resourcesName;
+ return Util.path("..", resourcesName);
} else {
dir = new File(dir, resourcesName);
return dir.getPath();
@@ -842,7 +841,7 @@ class ProductBuilder extends AntBuilder {
// copy binaries associated with module flag files
for (int i = 0; i < productModules.length; i++) {
ProductModule product = productModules[i];
- String targPath = targDirPath + "/" + product.relativePath;
+ String targPath = Util.path(targDirPath, product.relativePath);
File jarFile = (product.assembleAll
? product.module.getAssembledJar()
: product.module.getModuleJar() );
diff --git a/build/src/org/aspectj/internal/tools/build/Builder.java b/build/src/org/aspectj/internal/tools/build/Builder.java
index dbb0c40fe..b9303ffb8 100644
--- a/build/src/org/aspectj/internal/tools/build/Builder.java
+++ b/build/src/org/aspectj/internal/tools/build/Builder.java
@@ -466,11 +466,11 @@ public abstract class Builder {
FILTER_OFF)) {
return false;
}
-
+ // duplicate code?
// copy binaries associated with module flag files
for (int i = 0; i < productModules.length; i++) {
ProductModule product = productModules[i];
- String targPath = targDirPath + "/" + product.relativePath;
+ String targPath = Util.path(targDirPath, product.relativePath);
File jarFile =
(product.assembleAll
? product.module.getAssembledJar()
diff --git a/build/src/org/aspectj/internal/tools/build/Module.java b/build/src/org/aspectj/internal/tools/build/Module.java
index 28cdbd35d..8aea24dff 100644
--- a/build/src/org/aspectj/internal/tools/build/Module.java
+++ b/build/src/org/aspectj/internal/tools/build/Module.java
@@ -113,33 +113,6 @@ public class Module {
}
}
-// /** XXX gack explicitly skip Ant, sun tools.jar except for testing... modules */
-// private static boolean skipLibraryJarAntecedant(Module module, File libJar) {
-// if (null == libJar) {
-// return true;
-// }
-// if (!module.name.startsWith("testing")) {
-// String path = libJar.getPath().replace('\\', '/');
-// path = path.replace(File.separatorChar, '/');
-// if (-1 != path.indexOf("/lib/ant/lib/")) {
-// return true;
-// } else if (-1 != path.indexOf("/tools.jar")) {
-// return true;
-// }
-// }
-// return false;
-// }
-//
-// /** XXX gack explicitly skip runtime */
-// private static boolean skipModuleJarAntecedant(File requiredJar) {
-// if (null == requiredJar) {
-// return true;
-// } else {
-// //return "runtime.jar".equals(requiredJar.getName());
-// return false;
-// }
-// }
-
/**@return true if this is a source file */
private static boolean isSourceFile(File file) {
String path = file.getPath();
@@ -376,7 +349,6 @@ public class Module {
String line;
XMLEntry entry = new XMLEntry("classpathentry", ATTS);
-// String lastKind = null;
while (null != (line = reader.readLine())) {
// we assume no internal spaces...
entry.acceptTokens(line);
@@ -429,11 +401,11 @@ public class Module {
path = path.substring(JAVA_HOME.length());
String home = System.getProperty("java.home");
if (null != home) {
- libPath = home + File.separator + path;
+ libPath = Util.path(home, path);
File f = new File(libPath);
if (!f.exists() && home.endsWith("jre")) {
f = new File(home).getParentFile();
- libPath = f.getPath() + File.separator + path;
+ libPath = Util.path(f.getPath(), path);
}
}
}
diff --git a/build/src/org/aspectj/internal/tools/build/Util.java b/build/src/org/aspectj/internal/tools/build/Util.java
index 563a5c195..806154c20 100644
--- a/build/src/org/aspectj/internal/tools/build/Util.java
+++ b/build/src/org/aspectj/internal/tools/build/Util.java
@@ -136,6 +136,23 @@ public class Util {
return (null != dir) && dir.canWrite() && dir.isDirectory();
}
+ public static String path(String first, String second) {
+ return first + File.separator + second;
+ }
+
+ public static String path(String[] segments) {
+ StringBuffer sb = new StringBuffer();
+ if ((null != segments)) {
+ for (int i = 0; i < segments.length; i++) {
+ if (0 < i) {
+ sb.append(File.separator);
+ }
+ sb.append(segments[i]);
+ }
+ }
+ return sb.toString();
+ }
+
/** @return true if dir is a readable directory */
public static boolean canReadDir(File dir) {
return (null != dir) && dir.canRead() && dir.isDirectory();