Skip to content

Commit 31ddd5f

Browse files
hvadehracopybara-github
authored andcommitted
Fix bazel version check in @cc_compatibility_proxy
- Use new rule code only on bazel@head and 9.0.0 onwards - Critically, don't use the new rule code for 9.0.0-prerelease versions Context: a1b0a7c#r165497333 PiperOrigin-RevId: 805284563 Change-Id: Idfcf203160d8a27f0287864fec596bc71e4d5d39
1 parent 9dbc37f commit 31ddd5f

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

.bazelci/presubmit.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,31 @@ tasks:
8888
build_targets: *build_targets
8989
test_targets: *test_targets
9090

91+
# Bazel@rolling
92+
ubuntu2004_rolling:
93+
name: Ubuntu 20.04 (Bazel rolling)
94+
bazel: rolling
95+
platform: ubuntu2004
96+
build_targets: *build_targets
97+
test_targets:
98+
- "//:all"
99+
- "//cc/..."
100+
- "//examples/..."
101+
- "//tests/..."
102+
- "-//tests/rule_based_toolchain/tool_map:_duplicate_action_test_subject" # Intentionally broken rule.
103+
macos_rolling:
104+
name: MacOS (Bazel rolling)
105+
bazel: rolling
106+
platform: macos
107+
build_targets: *build_targets
108+
test_targets: *test_targets
109+
windows_rolling:
110+
name: Windows (Bazel rolling)
111+
bazel: rolling
112+
platform: windows
113+
build_targets: *build_targets
114+
test_targets: *test_targets
115+
91116
# Bazel 6
92117
ubuntu2004_bazel_6:
93118
name: Ubuntu 20.04 (Bazel 6)

cc/extensions.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"""Module extension for cc auto configuration."""
1515

1616
load("@bazel_features//:features.bzl", "bazel_features")
17+
load("@bazel_features//private:util.bzl", _bazel_version_ge = "ge")
1718
load("//cc/private/toolchain:cc_configure.bzl", "cc_autoconf", "cc_autoconf_toolchains")
1819

1920
def _cc_configure_extension_impl(ctx):
@@ -27,8 +28,7 @@ def _cc_configure_extension_impl(ctx):
2728
cc_configure_extension = module_extension(implementation = _cc_configure_extension_impl)
2829

2930
def _compatibility_proxy_repo_impl(rctx):
30-
bazel = native.bazel_version
31-
if not bazel or bazel >= "9":
31+
if _bazel_version_ge("9.0.0"):
3232
rctx.file(
3333
"BUILD",
3434
"""

0 commit comments

Comments
 (0)