}
} 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(".");
// 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);
&& 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")
);
}
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);
* 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();
result.add(f);
}
}
+ if (includeOutput && (null != classesDir)
+ && (!readable || classesDir.canRead())) {
+ result.add(classesDir);
+ }
return (File[]) result.toArray(new File[0]);
}