aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/config
diff options
context:
space:
mode:
authorGravatar kush <kush@google.com>2017-03-30 18:48:10 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2017-03-31 17:10:22 +0200
commit20c41d03ea798ced1e9f873e040a52b28974bb18 (patch)
treef7d452464dd875ccd283b4e454577322fcec802e /src/main/java/com/google/devtools/build/lib/analysis/config
parent9175f07151c3ea0870d29643e1b68c9b5f6479a4 (diff)
Change the tag experimental_testrunner into a couple of flags.
Note 1) Explanation of the flags: --explicit_java_test_deps: This is a flag independent of the others, and forces users to specify the JUnit deps. We should try to make this flag default to true in a future release, irrespective of the work around persistent java tests. --experimental_testrunner: Bazel-only flag affecting switching from the BazelTestRunner to the ExperimentalTestRunner which will run the tests in a separate classloader. --explicit_java_test_deps is desired for this to ensure once we split the classpaths of the TestRunner and the TestTarget, the TestTarget does not hit a ClassNotFoundException, due to missing JUnit deps. --test_strategy=experimental_worker: This is the existing flag, which in turn depends on --experimental_testrunner flag, since only the ExperimentalTestRunner is capable to running java tests persistently. Note 2) There was no clean way to check for the flags defined in JavaOptions within TestActionBuilder (as I was checking the "tag=experimental_testrunner" before), without making TeasActionBuilder's build rules depend on java rules (yikes!). Hence, I created a new method compatibleWithStrategy() within each fragment, so I could check if WorkerTestStrategy could be compatible with the user specified flags. Thanks to Greg for suggesting this approach! RELNOTES: None PiperOrigin-RevId: 151729869
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/config')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
index 6efa2d1c6e..9561e2324d 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
@@ -16,6 +16,7 @@ package com.google.devtools.build.lib.analysis.config;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
+import com.google.common.base.Predicate;
import com.google.common.base.Splitter;
import com.google.common.base.Verify;
import com.google.common.collect.ArrayListMultimap;
@@ -193,6 +194,14 @@ public final class BuildConfiguration {
public ImmutableSet<String> configurationEnabledFeatures(RuleContext ruleContext) {
return ImmutableSet.of();
}
+
+ /**
+ * @return false if a Fragment understands that it won't be able to work with a given strategy,
+ * or true otherwise.
+ */
+ public boolean compatibleWithStrategy(String strategyName) {
+ return true;
+ }
}
private static final Label convertLabel(String input) throws OptionsParsingException {
@@ -1304,6 +1313,20 @@ public final class BuildConfiguration {
}
/**
+ * @return false if any of the fragments don't work well with the supplied strategy.
+ */
+ public boolean compatibleWithStrategy(final String strategyName) {
+ return Iterables.all(
+ fragments.values(),
+ new Predicate<Fragment>() {
+ @Override
+ public boolean apply(@Nullable Fragment fragment) {
+ return fragment.compatibleWithStrategy(strategyName);
+ }
+ });
+ }
+
+ /**
* Compute the shell environment, which, at configuration level, is a pair consisting of the
* statically set environment variables with their values and the set of environment variables to
* be inherited from the client environment.