From 41a5b8077d1bfc1b7fd4fa614baabd0cd38e0873 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Fri, 20 Oct 2017 12:46:00 -0700 Subject: [PATCH] wip allowing flexibility in test infra for using modules with subdirs --- .../testsrc/org/aspectj/tools/ajc/Ajc.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java index 53b89e3d8..eeb6136a5 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java @@ -366,14 +366,14 @@ public class Ajc { if (FileUtil.hasSourceSuffix(args[i])) { File f = new File(args[i]); // newArgs[i] = new File(baseDir,args[i]).getAbsolutePath(); // might be quicker? - newArgs[i] = adjustFileOrDir(f, doCopy).getAbsolutePath(); + newArgs[i] = adjustFileOrDir(f, doCopy, false).getAbsolutePath(); } else if (args[i].endsWith(".xml") && !args[i].startsWith("-")) { if (i > 0 && args[i - 1].equals("-outxmlfile")) { // dont adjust it } else { File f = new File(args[i]); // newArgs[i] = new File(baseDir,args[i]).getAbsolutePath(); // might be quicker? - newArgs[i] = adjustFileOrDir(f, doCopy).getAbsolutePath(); + newArgs[i] = adjustFileOrDir(f, doCopy, false).getAbsolutePath(); } } else { if ((args[i].equals("-aspectpath") || args[i].equals("-inpath") || args[i].equals("-injars") @@ -387,10 +387,11 @@ public class Ajc { copyThisTime = false; hasOutdir = true; } + boolean isOutjar = args[i].equals("-outjar"); StringTokenizer strTok = new StringTokenizer(args[++i], File.pathSeparator); while (strTok.hasMoreTokens()) { File f = new File(strTok.nextToken()); - buff.append(adjustFileOrDir(f, copyThisTime).getAbsolutePath()); + buff.append(adjustFileOrDir(f, copyThisTime, isOutjar).getAbsolutePath()); if (strTok.hasMoreTokens()) buff.append(File.pathSeparator); } @@ -404,7 +405,7 @@ public class Ajc { // could be resource file File f = new File(args[i]); if (f.exists()) { - newArgs[i] = adjustFileOrDir(f, doCopy).getAbsolutePath(); + newArgs[i] = adjustFileOrDir(f, doCopy, false).getAbsolutePath(); } } } @@ -426,7 +427,7 @@ public class Ajc { return newArgs; } - private File adjustFileOrDir(File from, boolean doCopy) throws IOException { + private File adjustFileOrDir(File from, boolean doCopy, boolean ensureDirsExist) throws IOException { File to = from; File ret = from; if (!from.isAbsolute()) { @@ -435,6 +436,10 @@ public class Ajc { String relativeToPath = (fromParent != null) ? (fromParent.getPath() + File.separator) : ""; if (baseDir != null) { from = new File(baseDir, from.getPath()); +// if (ensureDirsExist) { +// File toMkdir = (ret.getPath().endsWith(".jar") || ret.getPath().endsWith(".zip"))?ret.getParentFile():ret; +// toMkdir.mkdirs(); +// } } if (!from.exists()) return ret; -- 2.39.5