diff options
author | acolyer <acolyer> | 2004-03-16 21:51:12 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2004-03-16 21:51:12 +0000 |
commit | b25badd04fe14e6d86b85e59632d357a15233df0 (patch) | |
tree | e62615b199d7c232f6eafe2d974b918ad0c41311 | |
parent | ad1f8449a6c35afac529fa0d966c585c6a3563e9 (diff) | |
download | aspectj-b25badd04fe14e6d86b85e59632d357a15233df0.tar.gz aspectj-b25badd04fe14e6d86b85e59632d357a15233df0.zip |
partial extension of incremental test harness to stage additonal resource types
see Bugzilla Bug 54622
Incremental support ignores resources
-rw-r--r-- | testing/src/org/aspectj/testing/harness/bridge/IncCompilerRun.java | 87 |
1 files changed, 51 insertions, 36 deletions
diff --git a/testing/src/org/aspectj/testing/harness/bridge/IncCompilerRun.java b/testing/src/org/aspectj/testing/harness/bridge/IncCompilerRun.java index dddfbdd5a..f226d00d9 100644 --- a/testing/src/org/aspectj/testing/harness/bridge/IncCompilerRun.java +++ b/testing/src/org/aspectj/testing/harness/bridge/IncCompilerRun.java @@ -19,6 +19,7 @@ import java.io.IOException; //import java.util.*; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; //import java.util.Collections; //import java.util.List; @@ -105,43 +106,14 @@ public class IncCompilerRun implements IAjcRun { final String fromSuffix = "." + spec.tag + toSuffix; // copy our tagged generation of files to the staging directory, // deleting any with ChangedFilesCollector.DELETE_SUFFIX - class intHolder { - int numCopies; - int numDeletes; - int numFails; - } // sigh - delay until after last last-mod-time - final ArrayList copied = new ArrayList(); - final intHolder holder = new intHolder(); - FileFilter deleteOrCount = new FileFilter() { - final String clip = ".delete" + toSuffix; - /** do copy unless file should be deleted */ - public boolean accept(File file) { - boolean doCopy = true; - String path = file.getAbsolutePath(); - if (!path.endsWith(clip)) { - holder.numCopies++; - validator.info("copying file: " + path); - copied.add(file); - } else { - doCopy = false; - path = path.substring(0, path.length()-clip.length()) + toSuffix; - File toDelete = new File(path); - if (toDelete.delete()) { - validator.info("deleted file: " + path); - holder.numDeletes++; - } else { - validator.fail("unable to delete file: " + path); - holder.numFails++; - } - } - return doCopy; - } - - }; - File srcDir = sandbox.getTestBaseSrcDir(this); - File destDir = sandbox.stagingDir; - FileUtil.copyDir(srcDir, destDir, fromSuffix, toSuffix, deleteOrCount); + intHolder holder = new intHolder(); + List copied = new ArrayList(); + doStaging(validator,".java",holder,copied); + doStaging(validator,".jar",holder,copied); + doStaging(validator,".class",holder,copied); + doStaging(validator,".properties",holder,copied); // arbitrary resource extension + doStaging(validator,".xml",holder,copied); // arbitrary resource extension if ((0 == holder.numCopies) && (0 == holder.numDeletes)) { validator.fail("no files changed??"); } else { @@ -158,7 +130,50 @@ public class IncCompilerRun implements IAjcRun { } return result; } + + private void doStaging(final Validator validator, final String toSuffix, + final intHolder holder,final List copied) + throws IOException + { + final String fromSuffix = "." + spec.tag + toSuffix; + final String clip = ".delete" + toSuffix; + FileFilter deleteOrCount = new FileFilter() { + /** do copy unless file should be deleted */ + public boolean accept(File file) { + boolean doCopy = true; + String path = file.getAbsolutePath(); + if (!path.endsWith(clip)) { + holder.numCopies++; + validator.info("copying file: " + path); + copied.add(file); + } else { + doCopy = false; + path = path.substring(0, path.length()-clip.length()) + toSuffix; + File toDelete = new File(path); + if (toDelete.delete()) { + validator.info("deleted file: " + path); + holder.numDeletes++; + } else { + validator.fail("unable to delete file: " + path); + holder.numFails++; + } + } + return doCopy; + } + + }; + File srcDir = sandbox.getTestBaseSrcDir(this); + File destDir = sandbox.stagingDir; + FileUtil.copyDir(srcDir, destDir, fromSuffix, toSuffix, deleteOrCount); + } + + private static class intHolder { + int numCopies; + int numDeletes; + int numFails; + } + /** * @see org.aspectj.testing.run.IRun#run(IRunStatus) */ |