]> source.dussan.org Git - aspectj.git/commitdiff
Fixing Harness bug of adding the output directory to the classpath, which conceals...
authorwisberg <wisberg>
Fri, 9 May 2003 07:14:19 +0000 (07:14 +0000)
committerwisberg <wisberg>
Fri, 9 May 2003 07:14:19 +0000 (07:14 +0000)
This change should have no effect on other tests, but I noticed two other failures during normal compiles caused by inability to resolve type names.

testing/src/org/aspectj/testing/harness/bridge/CompilerRun.java
testing/src/org/aspectj/testing/harness/bridge/IncCompilerRun.java
testing/src/org/aspectj/testing/harness/bridge/JavaRun.java
testing/src/org/aspectj/testing/harness/bridge/Sandbox.java

index 3d601128114db6f2a10df019d851cb1d4e5abfcb..853a853dcaea07dcd6542c984a790b995bc88cd7 100644 (file)
@@ -197,18 +197,24 @@ public class CompilerRun implements IAjcRun {
             }
         } else { // staging - copy files
             try {
+                // copy all files, then remove tagged ones
+                // XXX make copyFiles support a filter?
                 srcFiles = FileUtil.copyFiles(testBaseSrcDir, srcPaths, sandbox.stagingDir);
                 if (!LangUtil.isEmpty(spec.sourceroots)) {
                     sourcerootFiles = FileUtil.copyFiles(testBaseSrcDir, spec.sourceroots, sandbox.stagingDir);
                     // delete incremental files in sourceroot after copying // XXX inefficient
                     FileFilter pickIncFiles = new FileFilter() {
-                        // XXX weak rule to find incremental files
+                        // an incremental file has an extra "." in name
+                        // most .java files don't, because they are named after
+                        // the principle type they contain, and simple type names
+                        // have no dots.
                         public boolean accept(File file) {
                             if (file.isDirectory()) { // continue recursion
                                 return true;
                             }
                             String path = file.getPath();
-                            if (!FileUtil.hasSourceSuffix(path)) {
+                            // only source files are relevant to staging
+                            if (!FileUtil.hasSourceSuffix(path)) { 
                                 return false;
                             }
                             int first = path.indexOf(".");
@@ -256,10 +262,9 @@ public class CompilerRun implements IAjcRun {
 
         // save classpath and aspectpath in sandbox for this and other clients
         final boolean checkReadable = true; // hmm - third validation?
-        File[] cp = new File[3 + classFiles.length];
+        File[] cp = new File[2 + classFiles.length];
         System.arraycopy(classFiles, 0, cp, 0, classFiles.length);
         int index = classFiles.length;
-        cp[index++] = sandbox.classesDir;
         cp[index++] = Globals.F_aspectjrt_jar;
         cp[index++] = Globals.F_testingclient_jar;
         sandbox.setClasspath(cp, checkReadable, this);
index ba7a9310afbc3db39628f446acaa786c6dea8641..3c8d4a032bbfc0a22d134ba2fedb612b6bb5275d 100644 (file)
@@ -100,7 +100,6 @@ public class IncCompilerRun implements IAjcRun {
         }
         boolean result = false;
         try {
-            //ArrayList changed = new ArrayList();
             final String toSuffix = ".java";
             final String fromSuffix = "." + spec.tag + toSuffix;
             // copy our tagged generation of files to the staging directory,
index 5c236dbac061d1e9e8ffb0d85ec856efafd3d008..350550f1d4720a7a4c3e3e194a8969bc4c64ff20 100644 (file)
@@ -108,7 +108,7 @@ public class JavaRun implements IAjcRun {
             && validator.canReadDir(sandbox.getTestBaseSrcDir(this), "testBaseSrc dir")
             && validator.canWriteDir(sandbox.runDir, "run dir")
             && validator.canReadFiles(sandbox.getClasspathJars(true, this), "classpath jars")
-            && validator.canReadDirs(sandbox.getClasspathDirectories(true, this), "classpath dirs")
+            && validator.canReadDirs(sandbox.getClasspathDirectories(true, this, true), "classpath dirs")
             );            
         
        }
@@ -126,7 +126,8 @@ public class JavaRun implements IAjcRun {
         try {
             final boolean readable = true;
             File[] libs = sandbox.getClasspathJars(readable, this);
-            File[] dirs = sandbox.getClasspathDirectories(readable, this);
+            boolean includeClassesDir = true;
+            File[] dirs = sandbox.getClasspathDirectories(readable, this, includeClassesDir);
             completedNormally = FORK // || spec.fork
                 ? runInOtherVM(status, libs, dirs)
                 : runInSameVM(status, libs, dirs);
index a9a74210679408d31de33db3ae04a4db33c44dc5..6f03199c4c20558b8e5208f25dfd5a6ebd8867d5 100644 (file)
@@ -403,7 +403,10 @@ public class Sandbox {
      * This ignores aspectpath since it may contain only jar files.
      * @param readable if true, omit non-readable directories 
      */
-    File[] getClasspathDirectories(boolean readable, JavaRun caller) {
+    File[] getClasspathDirectories(
+        boolean readable, 
+        JavaRun caller, 
+        boolean includeOutput) {
         LangUtil.throwIaxIfNull(caller, "caller");
         assertState(null != compileClasspath, "classpath not set");
         ArrayList result = new ArrayList();
@@ -414,6 +417,10 @@ public class Sandbox {
                 result.add(f);
             }
                }
+        if (includeOutput && (null != classesDir) 
+            && (!readable || classesDir.canRead())) {
+            result.add(classesDir);                
+        }
         return (File[]) result.toArray(new File[0]);
     }