mirror of
https://github.com/sbt/sbt.git
synced 2026-09-01 10:37:54 +02:00
Drop ForkTestDefinition in favor of TaskDef
This commit is contained in:
@@ -39,26 +39,6 @@ public class ForkMain {
|
||||
public boolean isModule() { return isModule; }
|
||||
public String annotationName() { return annotationName; }
|
||||
}
|
||||
public static class ForkTestDefinition implements Serializable {
|
||||
public String name;
|
||||
public Fingerprint fingerprint;
|
||||
public boolean explicitlySpecified;
|
||||
public Selector[] selectors;
|
||||
|
||||
public ForkTestDefinition(String name, Fingerprint fingerprint, boolean explicitlySpecified, Selector[] selectors) {
|
||||
this.name = name;
|
||||
if (fingerprint instanceof SubclassFingerprint) {
|
||||
this.fingerprint = new SubclassFingerscan((SubclassFingerprint) fingerprint);
|
||||
} else {
|
||||
this.fingerprint = new AnnotatedFingerscan((AnnotatedFingerprint) fingerprint);
|
||||
}
|
||||
this.explicitlySpecified = explicitlySpecified;
|
||||
int length = selectors.length;
|
||||
this.selectors = new Selector[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
this.selectors[i] = forkSelector(selectors[i]);
|
||||
}
|
||||
}
|
||||
static class ForkError extends Exception {
|
||||
private String originalMessage;
|
||||
private ForkError cause;
|
||||
@@ -158,7 +138,7 @@ public class ForkMain {
|
||||
}
|
||||
void runTests(ObjectInputStream is, final ObjectOutputStream os) throws Exception {
|
||||
final boolean ansiCodesSupported = is.readBoolean();
|
||||
final ForkTestDefinition[] tests = (ForkTestDefinition[]) is.readObject();
|
||||
final TaskDef[] tests = (TaskDef[]) is.readObject();
|
||||
int nFrameworks = is.readInt();
|
||||
Logger[] loggers = {
|
||||
new Logger() {
|
||||
@@ -195,10 +175,10 @@ public class ForkMain {
|
||||
|
||||
ArrayList<TaskDef> filteredTests = new ArrayList<TaskDef>();
|
||||
for (Fingerprint testFingerprint : framework.fingerprints()) {
|
||||
for (ForkTestDefinition test : tests) {
|
||||
for (TaskDef test : tests) {
|
||||
// TODO: To pass in correct explicitlySpecified and selectors
|
||||
if (matches(testFingerprint, test.fingerprint))
|
||||
filteredTests.add(new TaskDef(test.name, test.fingerprint, test.explicitlySpecified, test.selectors));
|
||||
if (matches(testFingerprint, test.fingerprint()))
|
||||
filteredTests.add(new TaskDef(test.fullyQualifiedName(), test.fingerprint(), test.explicitlySpecified(), test.selectors()));
|
||||
}
|
||||
}
|
||||
final Runner runner = framework.runner(frameworkArgs, remoteFrameworkArgs, getClass().getClassLoader());
|
||||
|
||||
@@ -202,7 +202,8 @@ class RunnerWrapper implements Runner {
|
||||
public boolean isModule() { return subclassFingerprint.isModule(); }
|
||||
public String superClassName() { return subclassFingerprint.superclassName(); }
|
||||
};
|
||||
runner.run(fullyQualifiedName, oldFingerprint, new EventHandlerWrapper(eventHandler, fullyQualifiedName, subclassFingerprint), args);
|
||||
final String name = taskDef.fullyQualifiedName();
|
||||
runner.run(name, oldFingerprint, new EventHandlerWrapper(eventHandler, name, subclassFingerprint), args);
|
||||
}
|
||||
|
||||
private void runRunner2(org.scalatools.testing.Runner2 runner, Fingerprint fingerprint, EventHandler eventHandler) {
|
||||
@@ -221,7 +222,8 @@ class RunnerWrapper implements Runner {
|
||||
public String annotationName() { return annotatedFingerprint.annotationName(); }
|
||||
};
|
||||
}
|
||||
runner.run(fullyQualifiedName, oldFingerprint, new EventHandlerWrapper(eventHandler, fullyQualifiedName, fingerprint), args);
|
||||
final String name = taskDef.fullyQualifiedName();
|
||||
runner.run(name, oldFingerprint, new EventHandlerWrapper(eventHandler, name, fingerprint), args);
|
||||
}
|
||||
|
||||
public Task[] execute(EventHandler eventHandler, Logger[] loggers) {
|
||||
@@ -231,7 +233,8 @@ class RunnerWrapper implements Runner {
|
||||
oldLoggers[i] = createOldLogger(loggers[i]);
|
||||
}
|
||||
|
||||
org.scalatools.testing.Runner runner = oldFramework.testRunner(testClassLoader, oldLoggers);
|
||||
final org.scalatools.testing.Runner runner = oldFramework.testRunner(testClassLoader, oldLoggers);
|
||||
final Fingerprint fingerprint = taskDef.fingerprint();
|
||||
if (runner instanceof org.scalatools.testing.Runner2) {
|
||||
runRunner2((org.scalatools.testing.Runner2) runner, fingerprint, eventHandler);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user