-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider RCs equivalent to release for
bazel_compatibility
We want `bazel_compatibiliy = [">=6.4.0"]` to match `6.4.0rc1` so that release candidates are indistinguishable from the actual release via Bazel version compatibility requirements. This allows more realistic testing of releases via RCs without having users to rely on hacks such as `bazel_compatibility = [">=6.3.9999"]`. Along the way change the error message on incompatibility to include the standard module key identifier, which is `<root>` for the root module instead of `<name>@<version>`, both of which can be empty. Closes #19678. PiperOrigin-RevId: 569982709 Change-Id: I7dce89ac1c62c1539d71704f048dca65232c119c
- Loading branch information
1 parent
dd30503
commit 21cd4ef
Showing
3 changed files
with
41 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,7 +162,7 @@ public void testSimpleBazelCompatibilityFailure() throws Exception { | |
|
||
assertThat(result.hasError()).isTrue(); | ||
assertContainsEvent( | ||
"Bazel version 5.1.4 is not compatible with module \"[email protected]\" (bazel_compatibility:" | ||
"Bazel version 5.1.4 is not compatible with module \"<root>\" (bazel_compatibility:" | ||
+ " [>5.1.0, <5.1.4])"); | ||
} | ||
|
||
|
@@ -180,7 +180,7 @@ public void testBazelCompatibilityWarning() throws Exception { | |
|
||
assertThat(result.hasError()).isFalse(); | ||
assertContainsEvent( | ||
"Bazel version 5.1.4 is not compatible with module \"[email protected]\" (bazel_compatibility:" | ||
"Bazel version 5.1.4 is not compatible with module \"<root>\" (bazel_compatibility:" | ||
+ " [>5.1.0, <5.1.4])"); | ||
} | ||
|
||
|
@@ -198,7 +198,7 @@ public void testDisablingBazelCompatibility() throws Exception { | |
|
||
assertThat(result.hasError()).isFalse(); | ||
assertDoesNotContainEvent( | ||
"Bazel version 5.1.4 is not compatible with module \"[email protected]\" (bazel_compatibility:" | ||
"Bazel version 5.1.4 is not compatible with module \"<root>\" (bazel_compatibility:" | ||
+ " [>5.1.0, <5.1.4])"); | ||
} | ||
|
||
|
@@ -227,6 +227,36 @@ public void testBazelCompatibilityFailure() throws Exception { | |
+ " [<=5.1.4, -5.1.2])"); | ||
} | ||
|
||
@Test | ||
public void testRcIsCompatibleWithReleaseRequirement() throws Exception { | ||
scratch.file( | ||
rootDirectory.getRelative("MODULE.bazel").getPathString(), | ||
"module(name='mod', version='1.0', bazel_compatibility=['>=6.4.0'])"); | ||
|
||
embedBazelVersion("6.4.0rc1"); | ||
EvaluationResult<BazelModuleResolutionValue> result = | ||
evaluator.evaluate(ImmutableList.of(BazelModuleResolutionValue.KEY), evaluationContext); | ||
|
||
assertThat(result.hasError()).isFalse(); | ||
} | ||
|
||
@Test | ||
public void testPrereleaseIsNotCompatibleWithReleaseRequirement() throws Exception { | ||
scratch.file( | ||
rootDirectory.getRelative("MODULE.bazel").getPathString(), | ||
"module(name='mod', version='1.0', bazel_compatibility=['>=6.4.0'])"); | ||
|
||
embedBazelVersion("6.4.0-pre-1"); | ||
reporter.removeHandler(failFastHandler); | ||
EvaluationResult<BazelModuleResolutionValue> result = | ||
evaluator.evaluate(ImmutableList.of(BazelModuleResolutionValue.KEY), evaluationContext); | ||
|
||
assertThat(result.hasError()).isTrue(); | ||
assertContainsEvent( | ||
"Bazel version 6.4.0-pre-1 is not compatible with module \"<root>\" (bazel_compatibility:" | ||
+ " [>=6.4.0])"); | ||
} | ||
|
||
private void embedBazelVersion(String version) { | ||
// Double-get version-info to determine if it's the cached instance or not, and if not cache it. | ||
BlazeVersionInfo blazeInfo1 = BlazeVersionInfo.instance(); | ||
|