Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: updates for bazel 8 compatibility #2379

Merged
merged 7 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ buildifier:
# Use a specific version to avoid skew issues when new versions are released.
version: 6.1.0
warnings: "all"
# NOTE: Minimum supported version is 6.x for workspace; 7.x for bzlmod
.minimum_supported_version: &minimum_supported_version
# For testing minimum supported version.
# NOTE: Keep in sync with //:version.bzl
Expand All @@ -39,10 +40,12 @@ buildifier:
test_flags:
- "--test_tag_filters=-integration-test"
.common_workspace_flags_min_bazel: &common_workspace_flags_min_bazel
test_flags:
- "--noenable_bzlmod"
build_flags:
- "--noenable_bzlmod"
- "--build_tag_filters=-integration-test"
test_flags:
- "--noenable_bzlmod"
- "--test_tag_filters=-integration-test"
.common_workspace_flags: &common_workspace_flags
test_flags:
- "--noenable_bzlmod"
Expand Down Expand Up @@ -120,16 +123,22 @@ tasks:
<<: *common_workspace_flags_min_bazel
name: "Default: Ubuntu, workspace, minimum Bazel"
platform: ubuntu2004

ubuntu_min_bzlmod:
<<: *minimum_supported_version
<<: *reusable_config
name: "Default: Ubuntu, bzlmod, minimum Bazel"
platform: ubuntu2004
bazel: 7.x
ubuntu:
<<: *reusable_config
name: "Default: Ubuntu"
platform: ubuntu2004

ubuntu_upcoming:
<<: *reusable_config
name: "Default: Ubuntu, upcoming Bazel"
platform: ubuntu2004
bazel: last_rc
pystar_ubuntu_workspace:
<<: *reusable_config
<<: *pystar_base
Expand Down Expand Up @@ -171,6 +180,7 @@ tasks:
<<: *reusable_config
name: "RBE: Ubuntu, minimum Bazel"
platform: rbe_ubuntu2004
bazel: 7.x
build_flags:
# BazelCI sets --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1,
# which prevents cc toolchain autodetection from working correctly
Expand Down Expand Up @@ -232,24 +242,28 @@ tasks:
name: "examples/bzlmod: Ubuntu, minimum Bazel"
working_directory: examples/bzlmod
platform: ubuntu2004
bazel: 7.x
integration_test_bzlmod_ubuntu:
<<: *reusable_build_test_all
<<: *coverage_targets_example_bzlmod
name: "examples/bzlmod: Ubuntu"
working_directory: examples/bzlmod
platform: ubuntu2004
bazel: 7.x
integration_test_bzlmod_debian:
<<: *reusable_build_test_all
<<: *coverage_targets_example_bzlmod
name: "examples/bzlmod: Debian"
working_directory: examples/bzlmod
platform: debian11
bazel: 7.x
integration_test_bzlmod_macos:
<<: *reusable_build_test_all
<<: *coverage_targets_example_bzlmod
name: "examples/bzlmod: macOS"
working_directory: examples/bzlmod
platform: macos
bazel: 7.x
integration_test_bzlmod_windows:
<<: *reusable_build_test_all
# coverage is not supported on Windows
Expand All @@ -262,6 +276,7 @@ tasks:
name: "examples/bzlmod: Ubuntu with lockfile"
working_directory: examples/bzlmod
platform: ubuntu2004
bazel: 7.x
shell_commands:
# Update the lockfiles and fail if it is different.
- "../../tools/private/update_bzlmod_lockfiles.sh"
Expand All @@ -272,6 +287,7 @@ tasks:
name: "examples/bzlmod: macOS with lockfile"
working_directory: examples/bzlmod
platform: macos
bazel: 7.x
shell_commands:
# Update the lockfiles and fail if it is different.
- "../../tools/private/update_bzlmod_lockfiles.sh"
Expand All @@ -284,6 +300,7 @@ tasks:
name: "examples/bzlmod_build_file_generation: Ubuntu, minimum Bazel"
working_directory: examples/bzlmod_build_file_generation
platform: ubuntu2004
bazel: 7.x
integration_test_bzlmod_generation_build_files_ubuntu:
<<: *reusable_build_test_all
<<: *coverage_targets_example_bzlmod_build_file_generation
Expand Down Expand Up @@ -350,15 +367,16 @@ tasks:
<<: *minimum_supported_version
<<: *common_workspace_flags_min_bazel
<<: *reusable_build_test_all
name: "examples/pip_parse: Ubuntu, workspace, minimum supporte Bazel version"
name: "examples/pip_parse: Ubuntu, workspace, minimum supported Bazel version"
working_directory: examples/pip_parse
platform: ubuntu2004
integration_test_pip_parse_ubuntu_min_bzlmod:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: "examples/pip_parse: Ubuntu, bzlmod, minimum supporte Bazel version"
name: "examples/pip_parse: Ubuntu, bzlmod, minimum supported Bazel version"
working_directory: examples/pip_parse
platform: ubuntu2004
bazel: 7.x
integration_test_pip_parse_ubuntu:
<<: *reusable_build_test_all
name: "examples/pip_parse: Ubuntu"
Expand Down Expand Up @@ -393,6 +411,7 @@ tasks:
name: "examples/pip_parse_vendored: Ubuntu, bzlmod, minimum Bazel"
working_directory: examples/pip_parse_vendored
platform: ubuntu2004
bazel: 7.x
integration_test_pip_parse_vendored_ubuntu:
<<: *reusable_build_test_all
name: "examples/pip_parse_vendored: Ubuntu"
Expand Down Expand Up @@ -573,6 +592,7 @@ tasks:
name: "compile_pip_requirements_test_from_external_repo: Ubuntu, bzlmod, minimum Bazel"
working_directory: tests/integration/compile_pip_requirements_test_from_external_repo
platform: ubuntu2004
bazel: 7.x
shell_commands:
# Assert that @compile_pip_requirements//:requirements_test does the right thing.
- "bazel test @compile_pip_requirements//..."
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ A brief description of the categories of changes:
{#v0-0-0-changed}
### Changed
* (deps) bazel_skylib 1.6.1 -> 1.7.1
* (deps) rules_cc 0.0.9 -> 0.0.14
* (deps) protobuf 24.4 -> 29.0-rc2
* (deps) rules_proto 6.0.0-rc1 -> 6.0.2
* (deps) stardoc 0.6.2 -> 0.7.1
* For bzlmod, Bazel 7.4 is now the minimum Bazel version.
* (toolchains) Use the latest indygreg toolchain release [20241016] for Python versions:
* 3.9.20
* 3.10.15
Expand All @@ -48,6 +53,7 @@ A brief description of the categories of changes:

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

{#v0-0-0-removed}
### Removed
* Nothing yet
* Support for Bazel 6 using bzlmod has been dropped.

{#v0-38-0}
## [0.38.0] - 2024-11-08
Expand Down
31 changes: 22 additions & 9 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ module(

bazel_dep(name = "bazel_features", version = "1.9.1")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_cc", version = "0.0.14")
bazel_dep(name = "platforms", version = "0.0.4")

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

internal_deps = use_extension("//python/private:internal_deps.bzl", "internal_deps")
use_repo(
Expand Down Expand Up @@ -71,7 +71,7 @@ pip.parse(
use_repo(pip, "rules_python_publish_deps")

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

# ===== DEV ONLY DEPS AND SETUP BELOW HERE =====
bazel_dep(name = "rules_bazel_integration_test", version = "0.26.1", dev_dependency = True)
Expand All @@ -83,8 +83,18 @@ bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)
# Extra gazelle plugin deps so that WORKSPACE.bzlmod can continue including it for e2e tests.
# We use `WORKSPACE.bzlmod` because it is impossible to have dev-only local overrides.
bazel_dep(name = "rules_go", version = "0.41.0", dev_dependency = True, repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "rules_python_gazelle_plugin", version = "0", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle")
single_version_override(
rickeylev marked this conversation as resolved.
Show resolved Hide resolved
module_name = "gazelle",
patch_strip = 1,
patches = [
# Can be removed once https://github.com/bazel-contrib/bazel-gazelle/issues/1959
# is fixed and released.
"patches/gazelle_native_sh.patch",
],
version = "0.33.0",
)

internal_dev_deps = use_extension(
"//python/private:internal_dev_deps.bzl",
Expand Down Expand Up @@ -144,17 +154,20 @@ bazel_binaries.local(
path = "tests/integration/bazel_from_env",
)
bazel_binaries.download(version = "6.4.0")
bazel_binaries.download(version = "7.3.1")
bazel_binaries.download(version = "rolling")
bazel_binaries.download(version = "7.4.0")

# For now, don't test with rolling, because that's Bazel 9, which is a ways
# away.
# bazel_binaries.download(version = "rolling")
use_repo(
bazel_binaries,
"bazel_binaries",
# These don't appear necessary, but are reported as direct dependencies
# that should be use_repo()'d, so we add them as requested
"bazel_binaries_bazelisk",
"build_bazel_bazel_6_4_0",
"build_bazel_bazel_7_3_1",
"build_bazel_bazel_rolling",
"build_bazel_bazel_7_4_0",
# "build_bazel_bazel_rolling",
"build_bazel_bazel_self",
)

Expand Down
2 changes: 1 addition & 1 deletion examples/bzlmod/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.1
7.x
14 changes: 12 additions & 2 deletions examples/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,20 @@ local_path_override(
)

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

# (py_proto_library specific) Add the protobuf library for well-known types (e.g. `Any`, `Timestamp`, etc)
bazel_dep(name = "protobuf", version = "24.4", repo_name = "com_google_protobuf")
bazel_dep(name = "protobuf", version = "27.0", repo_name = "com_google_protobuf")

# Only needed to make rules_python's CI happy. rules_java 8.3.0+ is needed so
# that --java_runtime_version=remotejdk_11 works with Bazel 8.
bazel_dep(name = "rules_java", version = "8.3.0")

# Only needed to make rules_python's CI happy. A test verifies that
# MODULE.bazel.lock is cross-platform friendly, and there are transitive
# dependencies on rules_rust, so we need rules_rust 0.54.1+ where such issues
# were fixed.
bazel_dep(name = "rules_rust", version = "0.54.1")
rickeylev marked this conversation as resolved.
Show resolved Hide resolved

# We next initialize the python toolchain using the extension.
# You can set different Python versions in this block.
Expand Down
Loading