Gradually upgrade the oldest Bazel version supported
This CL updates the oldest Bazel version supported to [1.2.0](https://docs.bazel.build/versions/1.2.0/command-line-reference.html#flag--experimental_run_validations) when the flag `experimental_run_validations` is introduced.
@@ -20,6 +20,7 @@ import com.google.idea.blaze.base.model.BlazeVersionData;
import com.google.idea.blaze.base.scope.BlazeContext;
import com.google.idea.blaze.base.scope.output.IssueOutput;
import com.google.idea.blaze.base.settings.BuildSystemName;
+import com.google.idea.common.experiments.FeatureRolloutExperiment;
/** Verifies that the available Bazel version is supported by this plugin. */
public class BazelVersionChecker implements BuildSystemVersionChecker {
@@ -28,12 +29,23 @@ public class BazelVersionChecker implements BuildSystemVersionChecker {
// See: https://github.com/bazelbuild/bazel/issues/7298
private static final BazelVersion OLDEST_SUPPORTED_VERSION = new BazelVersion(0, 23, 0);
+ // version 1.2.0 introduced experimental_run_validations flag which is used in
+ // {@code BlazeIdeInterfaceAspectsImpl}
+ private static final BazelVersion NEW_OLDEST_SUPPORTED_VERSION = new BazelVersion(1, 2, 0);
+
+ static final FeatureRolloutExperiment NEW_OLDEST_BAZEL_VERSION_ENABLED =
+ new FeatureRolloutExperiment("new.oldest.bazel.version.enabled");
+
@Override
public boolean versionSupported(BlazeContext context, BlazeVersionData version) {
if (version.buildSystem() != BuildSystemName.Bazel) {
return true;
}
- if (version.bazelIsAtLeastVersion(OLDEST_SUPPORTED_VERSION)) {
+ BazelVersion oldestBazelVersion = OLDEST_SUPPORTED_VERSION;
+ if (NEW_OLDEST_BAZEL_VERSION_ENABLED.isEnabled()) {
+ oldestBazelVersion = NEW_OLDEST_SUPPORTED_VERSION;
+ }
+ if (version.bazelIsAtLeastVersion(oldestBazelVersion)) {
return true;
}
IssueOutput.error(
@@ -41,7 +53,7 @@ public class BazelVersionChecker implements BuildSystemVersionChecker {
"Bazel version %s is not supported by this version of the Bazel plugin. "
+ "Please upgrade to Bazel version %s+.\n"
+ "Upgrade instructions are available at https://bazel.build",
- version, OLDEST_SUPPORTED_VERSION))
+ version, oldestBazelVersion))
.submit(context);
return false;
}
