Skip to content

Commit

Permalink
Make bazel_tools work again
Browse files Browse the repository at this point in the history
This PR address two problems:
- Partially rolledback bazelbuild@ef1a21f to restore android tools extension to avoid breaking older rules_jvm_external and rules_kotlin versions: bazel-contrib/rules_jvm_external#1270
- Add protobuf in MODULE.tools to ensure a Bazel 8 compatible version gets selected. (related bazelbuild#23908)

Closes bazelbuild#24094.

PiperOrigin-RevId: 690625240
Change-Id: I47e9ab7cab9bbfd09e455fb72d3d99d3e73f1f90
  • Loading branch information
meteorcloudy committed Oct 28, 2024
1 parent b55240e commit 295215a
Show file tree
Hide file tree
Showing 8 changed files with 212 additions and 981 deletions.
1 change: 1 addition & 0 deletions src/MODULE.tools
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use_repo(buildozer_binary, "buildozer_binary")

# Dependencies used to auto-load removed symbols and rules from Bazel (due to Starlarkification)
# See also: --incompatible_autoload_externally, AutoloadSymbols
bazel_dep(name = "protobuf", version = "29.0-rc2")
bazel_dep(name = "rules_java", version = "8.2.0")
bazel_dep(name = "rules_cc", version = "0.0.13")
bazel_dep(name = "rules_python", version = "0.36.0")
Expand Down
4 changes: 2 additions & 2 deletions src/test/shell/integration/discard_graph_edges_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ function test_packages_cleared() {
# is still low (external packages don't contribute there). We can lower this
# number again once we remove WORKSPACE logic and move repo rules to not use
# Package anymore.
[[ "$package_count" -le 53 ]] \
[[ "$package_count" -le 56 ]] \
|| fail "package count $package_count too high"
globs_count="$(extract_histogram_count "$histo_file" "GlobsValue$")"
[[ "$globs_count" -le 1 ]] \
|| fail "globs count $globs_count too high"
module_count="$(extract_histogram_count "$histo_file" 'eval.Module$')"
[[ "$module_count" -le 270 ]] \
[[ "$module_count" -le 295 ]] \
|| fail "Module count $module_count too high"
ct_count="$(extract_histogram_count "$histo_file" \
'RuleConfiguredTarget$')"
Expand Down
6 changes: 0 additions & 6 deletions src/test/shell/testenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,6 @@ function add_rules_license() {

function add_protobuf() {
add_bazel_dep "protobuf" "$1"
cat >> "$1" <<EOF
single_version_override(
module_name = "protobuf",
version = "29.0-rc2",
)
EOF
}

function add_rules_testing() {
Expand Down
1,161 changes: 189 additions & 972 deletions src/test/tools/bzlmod/MODULE.bazel.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/test/tools/bzlmod/verify_default_lock_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@ expected_modules=(
jsoncpp
platforms
protobuf
pybind11_bazel
re2
rules_android
rules_cc
rules_fuzzing
rules_java
rules_jvm_external
rules_kotlin
rules_license
rules_pkg
rules_proto
rules_python
rules_shell
stardoc
zlib
)

Expand Down
2 changes: 2 additions & 0 deletions tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ filegroup(
exclude = ["fastutil.proguard"],
) + [
"//tools/allowlists:srcs",
"//tools/android:embedded_tools",
"//tools/bash:embedded_tools",
"//tools/build_defs:embedded_tools",
"//tools/build_rules:embedded_tools_srcs",
Expand Down Expand Up @@ -76,6 +77,7 @@ filegroup(
name = "bzl_srcs",
srcs = [
"//tools:build_defs.bzl",
"//tools/android:bzl_srcs",
"//tools/build_defs:bzl_srcs",
"//tools/build_rules:bzl_srcs",
"//tools/cpp:bzl_srcs",
Expand Down
8 changes: 8 additions & 0 deletions tools/android/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ filegroup(
],
)

filegroup(
name = "embedded_tools",
srcs = [
"BUILD.tools",
"android_extensions.bzl",
],
)

platform(
name = "arm64-v8a",
constraint_values = [
Expand Down
5 changes: 5 additions & 0 deletions tools/android/BUILD.tools
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
filegroup(
name = "bzl_srcs",
srcs = glob(["*.bzl"]),
visibility = ["//tools:__pkg__"],
)

0 comments on commit 295215a

Please sign in to comment.