use of com.google.devtools.build.lib.skyframe.TestSuiteExpansionValue.TestSuiteExpansion in project bazel by bazelbuild.
the class TestSuiteExpansionFunction method compute.
@Override
public SkyValue compute(SkyKey key, Environment env) throws InterruptedException {
TestSuiteExpansion expansion = (TestSuiteExpansion) key.argument();
ResolvedTargets<Target> targets = labelsToTargets(env, expansion.getTargets(), false);
List<SkyKey> testsInSuitesKeys = new ArrayList<>();
for (Target target : targets.getTargets()) {
if (TargetUtils.isTestSuiteRule(target)) {
testsInSuitesKeys.add(TestsInSuiteValue.key(target, true));
}
}
Map<SkyKey, SkyValue> testsInSuites = env.getValues(testsInSuitesKeys);
if (env.valuesMissing()) {
return null;
}
Set<Target> result = new LinkedHashSet<>();
boolean hasError = targets.hasError();
for (Target target : targets.getTargets()) {
if (TargetUtils.isTestRule(target)) {
result.add(target);
} else if (TargetUtils.isTestSuiteRule(target)) {
TestsInSuiteValue value = (TestsInSuiteValue) testsInSuites.get(TestsInSuiteValue.key(target, true));
if (value != null) {
result.addAll(value.getTargets().getTargets());
hasError |= value.getTargets().hasError();
}
} else {
result.add(target);
}
}
if (env.valuesMissing()) {
return null;
}
// any filtered targets.
return new TestSuiteExpansionValue(new ResolvedTargets<Target>(result, hasError));
}
Aggregations