Added >1 framework class per framework support, this enables sbt to support both old and new framework API at the same time.

This commit is contained in:
cheeseng
2013-04-23 12:00:05 +08:00
parent f38a244d0f
commit a76523a5f6
4 changed files with 46 additions and 29 deletions
+19 -11
View File
@@ -168,6 +168,9 @@ public class ForkMain {
void logError(ObjectOutputStream os, String message) {
write(os, new Object[]{ForkTags.Error, message});
}
void logDebug(ObjectOutputStream os, String message) {
write(os, new Object[]{ForkTags.Debug, message});
}
void writeEvents(ObjectOutputStream os, ForkTestDefinition test, ForkEvent[] events) {
write(os, new Object[]{test.name, events});
}
@@ -187,22 +190,27 @@ public class ForkMain {
};
for (int i = 0; i < nFrameworks; i++) {
final String implClassName = (String) is.readObject();
final String[] implClassNames = (String[]) is.readObject();
final String[] frameworkArgs = (String[]) is.readObject();
final String[] remoteFrameworkArgs = (String[]) is.readObject();
final Framework framework;
try {
Object rawFramework = Class.forName(implClassName).newInstance();
if (rawFramework instanceof Framework)
framework = (Framework) rawFramework;
else
framework = new FrameworkWrapper((org.scalatools.testing.Framework) rawFramework);
} catch (ClassNotFoundException e) {
logError(os, "Framework implementation '" + implClassName + "' not present.");
continue;
Framework framework = null;
for (String implClassName : implClassNames) {
try {
Object rawFramework = Class.forName(implClassName).newInstance();
if (rawFramework instanceof Framework)
framework = (Framework) rawFramework;
else
framework = new FrameworkWrapper((org.scalatools.testing.Framework) rawFramework);
break;
} catch (ClassNotFoundException e) {
logDebug(os, "Framework implementation '" + implClassName + "' not present.");
}
}
if (framework == null)
continue;
ArrayList<ForkTestDefinition> filteredTests = new ArrayList<ForkTestDefinition>();
for (Fingerprint testFingerprint : framework.fingerprints()) {
for (ForkTestDefinition test : tests) {