Skip to content

Commit 4864d63

Browse files
authored
deps: updates for bazel 8 compatibility (bazel-contrib#2379)
Various changes to support Bazel 8. An important note is dependencies have forced us to change the versions of Bazel we support. Summary of changes: * rules_cc 0.0.14: Releases after 0.0.9 have some Bazel 8 fixes, but also broke some things. Things seemed to have settled by 0.0.14. * protobuf 29.0-rc1: Technically 28.0 works, however: 1. 29.0-rc1 is coming via a transitive dependency anyways, and 2. In protobuf 28.0, compile warnings are treated as errors, which our Debian CI respects (and thus fails), while other platforms ignore. * stardoc 0.7.1: Fixes an issue with Bazel 8 and stardoc using empty globs. * Bazel 7.4 is now the minimum supported Bazel version. This requirements comes via dependencies. * Drop Bazel 6 bzlmod support. This requirement comes via dependencies. * Add a presubmit job for `last_rc` Bazel (currently the 8.x RC). * Use a local patch so Gazelle works with Bazel 8. This can be removed once bazel-contrib/bazel-gazelle#1959 is fixed and released. * Fix a `$(rpathlocation)` call in bootstrap tests. * Update bzl_library deps after upgrading deps: the set of targets that provide bzl sources changed in rules_cc and protobuf in these newer versions. Sorting this all out and finding the right combination of dependency versions was fairly involved. The details of that are in bazel-contrib#2378. Work towards bazel-contrib#2378, bazel-contrib#2387
1 parent 4e61031 commit 4864d63

File tree

14 files changed

+16278
-5344
lines changed

14 files changed

+16278
-5344
lines changed

.bazelci/presubmit.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ buildifier:
1818
# Use a specific version to avoid skew issues when new versions are released.
1919
version: 6.1.0
2020
warnings: "all"
21+
# NOTE: Minimum supported version is 6.x for workspace; 7.x for bzlmod
2122
.minimum_supported_version: &minimum_supported_version
2223
# For testing minimum supported version.
2324
# NOTE: Keep in sync with //:version.bzl
@@ -39,10 +40,12 @@ buildifier:
3940
test_flags:
4041
- "--test_tag_filters=-integration-test"
4142
.common_workspace_flags_min_bazel: &common_workspace_flags_min_bazel
42-
test_flags:
43-
- "--noenable_bzlmod"
4443
build_flags:
4544
- "--noenable_bzlmod"
45+
- "--build_tag_filters=-integration-test"
46+
test_flags:
47+
- "--noenable_bzlmod"
48+
- "--test_tag_filters=-integration-test"
4649
.common_workspace_flags: &common_workspace_flags
4750
test_flags:
4851
- "--noenable_bzlmod"
@@ -120,16 +123,22 @@ tasks:
120123
<<: *common_workspace_flags_min_bazel
121124
name: "Default: Ubuntu, workspace, minimum Bazel"
122125
platform: ubuntu2004
126+
123127
ubuntu_min_bzlmod:
124128
<<: *minimum_supported_version
125129
<<: *reusable_config
126130
name: "Default: Ubuntu, bzlmod, minimum Bazel"
127131
platform: ubuntu2004
132+
bazel: 7.x
128133
ubuntu:
129134
<<: *reusable_config
130135
name: "Default: Ubuntu"
131136
platform: ubuntu2004
132-
137+
ubuntu_upcoming:
138+
<<: *reusable_config
139+
name: "Default: Ubuntu, upcoming Bazel"
140+
platform: ubuntu2004
141+
bazel: last_rc
133142
pystar_ubuntu_workspace:
134143
<<: *reusable_config
135144
<<: *pystar_base
@@ -171,6 +180,7 @@ tasks:
171180
<<: *reusable_config
172181
name: "RBE: Ubuntu, minimum Bazel"
173182
platform: rbe_ubuntu2004
183+
bazel: 7.x
174184
build_flags:
175185
# BazelCI sets --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1,
176186
# which prevents cc toolchain autodetection from working correctly
@@ -232,24 +242,28 @@ tasks:
232242
name: "examples/bzlmod: Ubuntu, minimum Bazel"
233243
working_directory: examples/bzlmod
234244
platform: ubuntu2004
245+
bazel: 7.x
235246
integration_test_bzlmod_ubuntu:
236247
<<: *reusable_build_test_all
237248
<<: *coverage_targets_example_bzlmod
238249
name: "examples/bzlmod: Ubuntu"
239250
working_directory: examples/bzlmod
240251
platform: ubuntu2004
252+
bazel: 7.x
241253
integration_test_bzlmod_debian:
242254
<<: *reusable_build_test_all
243255
<<: *coverage_targets_example_bzlmod
244256
name: "examples/bzlmod: Debian"
245257
working_directory: examples/bzlmod
246258
platform: debian11
259+
bazel: 7.x
247260
integration_test_bzlmod_macos:
248261
<<: *reusable_build_test_all
249262
<<: *coverage_targets_example_bzlmod
250263
name: "examples/bzlmod: macOS"
251264
working_directory: examples/bzlmod
252265
platform: macos
266+
bazel: 7.x
253267
integration_test_bzlmod_windows:
254268
<<: *reusable_build_test_all
255269
# coverage is not supported on Windows
@@ -262,6 +276,7 @@ tasks:
262276
name: "examples/bzlmod: Ubuntu with lockfile"
263277
working_directory: examples/bzlmod
264278
platform: ubuntu2004
279+
bazel: 7.x
265280
shell_commands:
266281
# Update the lockfiles and fail if it is different.
267282
- "../../tools/private/update_bzlmod_lockfiles.sh"
@@ -272,6 +287,7 @@ tasks:
272287
name: "examples/bzlmod: macOS with lockfile"
273288
working_directory: examples/bzlmod
274289
platform: macos
290+
bazel: 7.x
275291
shell_commands:
276292
# Update the lockfiles and fail if it is different.
277293
- "../../tools/private/update_bzlmod_lockfiles.sh"
@@ -284,6 +300,7 @@ tasks:
284300
name: "examples/bzlmod_build_file_generation: Ubuntu, minimum Bazel"
285301
working_directory: examples/bzlmod_build_file_generation
286302
platform: ubuntu2004
303+
bazel: 7.x
287304
integration_test_bzlmod_generation_build_files_ubuntu:
288305
<<: *reusable_build_test_all
289306
<<: *coverage_targets_example_bzlmod_build_file_generation
@@ -350,15 +367,16 @@ tasks:
350367
<<: *minimum_supported_version
351368
<<: *common_workspace_flags_min_bazel
352369
<<: *reusable_build_test_all
353-
name: "examples/pip_parse: Ubuntu, workspace, minimum supporte Bazel version"
370+
name: "examples/pip_parse: Ubuntu, workspace, minimum supported Bazel version"
354371
working_directory: examples/pip_parse
355372
platform: ubuntu2004
356373
integration_test_pip_parse_ubuntu_min_bzlmod:
357374
<<: *minimum_supported_version
358375
<<: *reusable_build_test_all
359-
name: "examples/pip_parse: Ubuntu, bzlmod, minimum supporte Bazel version"
376+
name: "examples/pip_parse: Ubuntu, bzlmod, minimum supported Bazel version"
360377
working_directory: examples/pip_parse
361378
platform: ubuntu2004
379+
bazel: 7.x
362380
integration_test_pip_parse_ubuntu:
363381
<<: *reusable_build_test_all
364382
name: "examples/pip_parse: Ubuntu"
@@ -393,6 +411,7 @@ tasks:
393411
name: "examples/pip_parse_vendored: Ubuntu, bzlmod, minimum Bazel"
394412
working_directory: examples/pip_parse_vendored
395413
platform: ubuntu2004
414+
bazel: 7.x
396415
integration_test_pip_parse_vendored_ubuntu:
397416
<<: *reusable_build_test_all
398417
name: "examples/pip_parse_vendored: Ubuntu"
@@ -573,6 +592,7 @@ tasks:
573592
name: "compile_pip_requirements_test_from_external_repo: Ubuntu, bzlmod, minimum Bazel"
574593
working_directory: tests/integration/compile_pip_requirements_test_from_external_repo
575594
platform: ubuntu2004
595+
bazel: 7.x
576596
shell_commands:
577597
# Assert that @compile_pip_requirements//:requirements_test does the right thing.
578598
- "bazel test @compile_pip_requirements//..."

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ A brief description of the categories of changes:
2828
{#v0-0-0-changed}
2929
### Changed
3030
* (deps) bazel_skylib 1.6.1 -> 1.7.1
31+
* (deps) rules_cc 0.0.9 -> 0.0.14
32+
* (deps) protobuf 24.4 -> 29.0-rc2
33+
* (deps) rules_proto 6.0.0-rc1 -> 6.0.2
34+
* (deps) stardoc 0.6.2 -> 0.7.1
35+
* For bzlmod, Bazel 7.4 is now the minimum Bazel version.
3136
* (toolchains) Use the latest indygreg toolchain release [20241016] for Python versions:
3237
* 3.9.20
3338
* 3.10.15
@@ -48,6 +53,7 @@ A brief description of the categories of changes:
4853

4954
{#v0-0-0-added}
5055
### Added
56+
* Bazel 8 is now supported.
5157
* (toolchain) Support for freethreaded Python toolchains is now available. Use
5258
the config flag `//python/config_settings:py_freethreaded` to toggle the
5359
selection of the free-threaded toolchains.
@@ -56,7 +62,7 @@ A brief description of the categories of changes:
5662

5763
{#v0-0-0-removed}
5864
### Removed
59-
* Nothing yet
65+
* Support for Bazel 6 using bzlmod has been dropped.
6066

6167
{#v0-38-0}
6268
## [0.38.0] - 2024-11-08

MODULE.bazel

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ module(
66

77
bazel_dep(name = "bazel_features", version = "1.9.1")
88
bazel_dep(name = "bazel_skylib", version = "1.7.1")
9-
bazel_dep(name = "rules_cc", version = "0.0.9")
9+
bazel_dep(name = "rules_cc", version = "0.0.14")
1010
bazel_dep(name = "platforms", version = "0.0.4")
1111

1212
# Those are loaded only when using py_proto_library
13-
bazel_dep(name = "rules_proto", version = "6.0.0-rc1")
14-
bazel_dep(name = "protobuf", version = "24.4", repo_name = "com_google_protobuf")
13+
bazel_dep(name = "rules_proto", version = "6.0.2")
14+
bazel_dep(name = "protobuf", version = "29.0-rc2", repo_name = "com_google_protobuf")
1515

1616
internal_deps = use_extension("//python/private:internal_deps.bzl", "internal_deps")
1717
use_repo(
@@ -71,7 +71,7 @@ pip.parse(
7171
use_repo(pip, "rules_python_publish_deps")
7272

7373
# Not a dev dependency to allow usage of //sphinxdocs code, which refers to stardoc repos.
74-
bazel_dep(name = "stardoc", version = "0.6.2", repo_name = "io_bazel_stardoc")
74+
bazel_dep(name = "stardoc", version = "0.7.1", repo_name = "io_bazel_stardoc")
7575

7676
# ===== DEV ONLY DEPS AND SETUP BELOW HERE =====
7777
bazel_dep(name = "rules_bazel_integration_test", version = "0.26.1", dev_dependency = True)
@@ -83,8 +83,18 @@ bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)
8383
# Extra gazelle plugin deps so that WORKSPACE.bzlmod can continue including it for e2e tests.
8484
# We use `WORKSPACE.bzlmod` because it is impossible to have dev-only local overrides.
8585
bazel_dep(name = "rules_go", version = "0.41.0", dev_dependency = True, repo_name = "io_bazel_rules_go")
86-
bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle")
8786
bazel_dep(name = "rules_python_gazelle_plugin", version = "0", dev_dependency = True)
87+
bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle")
88+
single_version_override(
89+
module_name = "gazelle",
90+
patch_strip = 1,
91+
patches = [
92+
# Can be removed once https://github.com/bazel-contrib/bazel-gazelle/issues/1959
93+
# is fixed and released.
94+
"patches/gazelle_native_sh.patch",
95+
],
96+
version = "0.33.0",
97+
)
8898

8999
internal_dev_deps = use_extension(
90100
"//python/private:internal_dev_deps.bzl",
@@ -144,17 +154,20 @@ bazel_binaries.local(
144154
path = "tests/integration/bazel_from_env",
145155
)
146156
bazel_binaries.download(version = "6.4.0")
147-
bazel_binaries.download(version = "7.3.1")
148-
bazel_binaries.download(version = "rolling")
157+
bazel_binaries.download(version = "7.4.0")
158+
159+
# For now, don't test with rolling, because that's Bazel 9, which is a ways
160+
# away.
161+
# bazel_binaries.download(version = "rolling")
149162
use_repo(
150163
bazel_binaries,
151164
"bazel_binaries",
152165
# These don't appear necessary, but are reported as direct dependencies
153166
# that should be use_repo()'d, so we add them as requested
154167
"bazel_binaries_bazelisk",
155168
"build_bazel_bazel_6_4_0",
156-
"build_bazel_bazel_7_3_1",
157-
"build_bazel_bazel_rolling",
169+
"build_bazel_bazel_7_4_0",
170+
# "build_bazel_bazel_rolling",
158171
"build_bazel_bazel_self",
159172
)
160173

examples/bzlmod/.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.3.1
1+
7.x

examples/bzlmod/MODULE.bazel

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,20 @@ local_path_override(
1212
)
1313

1414
# (py_proto_library specific) We are using rules_proto to define rules_proto targets to be consumed by py_proto_library.
15-
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
15+
bazel_dep(name = "rules_proto", version = "6.0.0-rc1")
1616

1717
# (py_proto_library specific) Add the protobuf library for well-known types (e.g. `Any`, `Timestamp`, etc)
18-
bazel_dep(name = "protobuf", version = "24.4", repo_name = "com_google_protobuf")
18+
bazel_dep(name = "protobuf", version = "27.0", repo_name = "com_google_protobuf")
19+
20+
# Only needed to make rules_python's CI happy. rules_java 8.3.0+ is needed so
21+
# that --java_runtime_version=remotejdk_11 works with Bazel 8.
22+
bazel_dep(name = "rules_java", version = "8.3.0")
23+
24+
# Only needed to make rules_python's CI happy. A test verifies that
25+
# MODULE.bazel.lock is cross-platform friendly, and there are transitive
26+
# dependencies on rules_rust, so we need rules_rust 0.54.1+ where such issues
27+
# were fixed.
28+
bazel_dep(name = "rules_rust", version = "0.54.1")
1929

2030
# We next initialize the python toolchain using the extension.
2131
# You can set different Python versions in this block.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy