]> source.dussan.org Git - aspectj.git/commitdiff
various polish to previously mavenized projects to support newer ones
authorAndy Clement <aclement@pivotal.io>
Thu, 31 Jan 2019 20:00:55 +0000 (12:00 -0800)
committerAndy Clement <aclement@pivotal.io>
Thu, 31 Jan 2019 20:00:55 +0000 (12:00 -0800)
org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java
org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java
org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java
org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java

index 8331eb3f4d9dce8c0088a83d446525f6ddf14fc8..bcc4ad1720dca6bc72fb5d10cff86c96a72451b3 100644 (file)
@@ -190,7 +190,7 @@ public abstract class CommandTestCase extends TestCase {
        protected void setUp() throws Exception {
                super.setUp();
 
-               sandbox = Ajc.createEmptySandbox();
+               sandbox = TestUtil.createEmptySandbox();
        }
 
 }
index d8d1621deb146299064f6d3382cc63ed5f46d5da..a60c9d9f7ffb8b2697b7141a9b3ddee84d663be5 100644 (file)
@@ -22,6 +22,7 @@ import org.aspectj.ajdt.ajc.Constants;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.MessageHandler;
 import org.aspectj.bridge.MessageWriter;
+import org.aspectj.testing.util.TestUtil;
 import org.aspectj.tools.ajc.Ajc;
 
 import junit.framework.AssertionFailedError;
@@ -61,7 +62,7 @@ public class AjBuildManagerTest extends TestCase {
                BuildArgParser parser = new BuildArgParser(messageWriter);
                String javaClassPath = System.getProperty("java.class.path");
                System.out.println(javaClassPath);
-               String sandboxName = Ajc.createEmptySandbox().getAbsolutePath();
+               String sandboxName = TestUtil.createEmptySandbox().getAbsolutePath();
                AjBuildConfig buildConfig = parser.genBuildConfig(new String[] { "-d", sandboxName, "-1.4", "-classpath", javaClassPath,
                                Constants.TESTDATA_PATH + "/src1/A.java",
                // EajcModuleTests.TESTDATA_PATH + "/src1/Hello.java",
index f4387554131aca148fdb88d5236659881cbd290b..facab0e7e638c4c7b9afb52d12e10ca618e18301 100644 (file)
@@ -35,6 +35,7 @@ import org.aspectj.bridge.IMessageHandler;
 import org.aspectj.bridge.MessageHandler;
 import org.aspectj.bridge.IMessage.Kind;
 import org.aspectj.bridge.context.CompilationAndWeavingContext;
+import org.aspectj.testing.util.TestUtil;
 import org.aspectj.util.FileUtil;
 
 /**
@@ -49,13 +50,19 @@ import org.aspectj.util.FileUtil;
  */
 public class Ajc {
 
-       private static final String SANDBOX_NAME = "ajcSandbox";
-
        private static final String BUILD_OUTPUT_FOLDER = "target";
        
        public static final String outputFolder(String module) {
                return File.pathSeparator + ".." +File.separator + module + File.separator + "target" + File.separator + "classes";
        }
+
+       public static final String outputFolders(String... modules) {
+               StringBuilder s = new StringBuilder();
+               for (String module: modules) {
+                       s.append(File.pathSeparator + ".." +File.separator + module + File.separator + "target" + File.separator + "classes");
+               }
+               return s.toString();
+       }
        
        // ALSO SEE ANTSPEC AND AJCTESTCASE
        private static final String TESTER_PATH = outputFolder("testing-client") + outputFolder("runtime") + outputFolder("bcel-builder") 
@@ -210,7 +217,7 @@ public class Ajc {
 
                try {
                        if (!isIncremental && shouldEmptySandbox) {
-                               sandbox = createEmptySandbox();
+                               sandbox = TestUtil.createEmptySandbox();
                        }
                        args = adjustToSandbox(args, !isIncremental);
                        MessageHandler holder = new MessageHandler();
@@ -291,7 +298,7 @@ public class Ajc {
         */
        public File getSandboxDirectory() {
                if (sandbox == null) {
-                       sandbox = createEmptySandbox();
+                       sandbox = TestUtil.createEmptySandbox();
                }
                return sandbox;
        }
@@ -319,53 +326,6 @@ public class Ajc {
                return false;
        }
 
-       public static File createEmptySandbox() {
-               File sandbox;
-
-               String os = System.getProperty("os.name");
-               File tempDir = null;
-               // AMC - I did this rather than use the JDK default as I hate having to go look
-               // in c:\documents and settings\......... for the results of a failed test.
-               if (os.startsWith("Windows")) {
-                       tempDir = new File("N:\\temp");
-                       if (!tempDir.exists()) {
-                               tempDir = new File("C:\\temp");
-                           if (!tempDir.exists()) {
-                                   tempDir.mkdir();
-                               }
-                       }
-               } else {
-                       tempDir = new File("/tmp");
-               }
-               File sandboxRoot = new File(tempDir, SANDBOX_NAME);
-               if (!sandboxRoot.exists()) {
-                       sandboxRoot.mkdir();
-               }
-
-               try {
-                       File workspace = new File(".." + File.separator);
-                       String workspaceName = workspace.getCanonicalPath();
-                       int index = workspaceName.lastIndexOf(File.separator);
-                       workspaceName = workspaceName.substring(index + 1);
-
-                       File workspaceRoot = new File(sandboxRoot, workspaceName);
-                       if (!workspaceRoot.exists()) {
-                               workspaceRoot.mkdir();
-                       }
-
-                       FileUtil.deleteContents(workspaceRoot);
-
-                       sandbox = File.createTempFile("ajcTest", ".tmp", workspaceRoot);
-                       sandbox.delete();
-                       sandbox.mkdir();
-
-               } catch (IOException ioEx) {
-                       throw new AssertionFailedError("Unable to create sandbox directory for test");
-               }
-
-               return sandbox;
-       }
-
        /**
         * Make every relative file name and dir be absolute under sandbox Add TESTER_PATH to classpath
         */
index 24214cf1718204211100f6b8c1a0a948eefb9813..9ca39ab9d7e87d776b86bce4b1d0edfc58d85ac2 100644 (file)
@@ -64,14 +64,17 @@ public class AjcTestCase extends TestCase {
        protected Ajc ajc;
 
        // see Ajc and AntSpec
-       public static final String DEFAULT_CLASSPATH_ENTRIES = File.pathSeparator + ".." + File.separator + "bridge" + File.separator
-                       + "bin" + File.pathSeparator + ".." + File.separator + "util" + File.separator + "bin" + File.pathSeparator + ".."
-                       + File.separator + "loadtime" + File.separator + "bin" + File.pathSeparator + ".." + File.separator + "weaver"
-                       + File.separator + "bin" + File.pathSeparator + ".." + File.separator + "weaver5" + File.separator + "bin"
-                       + File.pathSeparator + ".." + File.separator + "asm" + File.separator + "bin" + File.pathSeparator + ".."
-                       + File.separator + "testing-client" + File.separator + "bin" + File.pathSeparator + ".." + File.separator + "runtime"
-                       + File.separator + "bin" + File.pathSeparator + ".." + File.separator + "aspectj5rt" + File.separator + "bin"
-                       + File.pathSeparator + ".." + File.separator + "org.aspectj.matcher" + File.separator + "bin" + File.pathSeparator
+       public static final String DEFAULT_CLASSPATH_ENTRIES = 
+                       Ajc.outputFolders("bridge","util","loadtime","weaver","asm","testing-client","runtime","org.aspectj.matcher")
+//                     File.pathSeparator + ".." + File.separator + "bridge" + File.separator
+//                     + "bin" + File.pathSeparator + ".." + File.separator + "util" + File.separator + "bin" + File.pathSeparator + ".."
+//                     + File.separator + "loadtime" + File.separator + "bin" + File.pathSeparator + ".." + File.separator + "weaver"
+//                     + File.separator + "bin" + File.pathSeparator + ".." + File.separator + "weaver5" + File.separator + "bin"
+//                     + File.pathSeparator + ".." + File.separator + "asm" + File.separator + "bin" + File.pathSeparator + ".."
+//                     + File.separator + "testing-client" + File.separator + "bin" + File.pathSeparator + ".." + File.separator + "runtime"
+//                     + File.separator + "bin" + File.pathSeparator + ".." + File.separator + "aspectj5rt" + File.separator + "bin"
+//                     + File.pathSeparator + ".." + File.separator + "org.aspectj.matcher" + File.separator + "bin"
+                       + File.pathSeparator
                        + ".." + File.separator + "lib" + File.separator + "junit" + File.separator
                        + "junit.jar"
                        + File.pathSeparator