Skip to content

Upgrade to Bazel 8 #78

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

Merged
merged 16 commits into from
Feb 27, 2025
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
65 changes: 42 additions & 23 deletions .bazelrc_shared
Original file line number Diff line number Diff line change
@@ -1,44 +1,63 @@
common --announce_rc
common --color=yes
# TODO: remove this when we move to Bazel 8. This is the default in Bazel 8.
common --experimental_remote_cache_eviction_retries=5

# TODO: enable path mapping when we move to Bazel 8. There is a bug in 7. See:
# https://github.com/bazelbuild/bazel/issues/23990
# In the meantime, if you need to test path mapping you should disable multiplex
# workers with the following build option:
#build --noworker_multiplex
#common --experimental_output_paths=strip
#common --modify_execution_info=CppCompile=+supports-path-mapping

build --experimental_strict_action_env
build --javacopt="-source 21 -target 21"
# Java options
build --java_language_version="21"
build --java_runtime_version="remotejdk_21"
build --javacopt="-source 21 -target 21"
build --tool_java_language_version="21"
build --tool_java_runtime_version="remotejdk_21"

# Other options
build --experimental_use_hermetic_linux_sandbox
build --experimental_worker_sandbox_hardening
build --experimental_worker_cancellation
build --strategy=worker,sandboxed,local

build --verbose_failures
build --worker_max_instances=4
build --worker_sandboxing

# Disable multiplex sandboxing because there is a bug that causes files which
# should be in the sandbox to not be. Not sure if this is a Bazel bug or a rule
# set bug. Something we need to deal with either way.
# Once we enable path mapping, we should also be able to get rid of the outgoing
# transition that we're currently relying on to prevent an explosion in the number
# of builds.
#build --experimental_worker_multiplex_sandboxing
build --experimental_worker_cancellation
build --verbose_failures

# This is disabled as it was causing some issues with some javac targets when used
# with path mapping. If that is resolved, then we can turn it back on.
#build --experimental_worker_sandbox_hardening
build --experimental_use_hermetic_linux_sandbox
# TODO: enable path mapping when we move to Bazel 8. There is a bug in 7. See:
# https://github.com/bazelbuild/bazel/issues/23990
# In the meantime, if you need to test path mapping you should disable multiplex
# workers with the following build option:
#build --noworker_multiplex
#common --experimental_output_paths=strip
#common --modify_execution_info=CppCompile=+supports-path-mapping

test --test_output=all

common --announce_rc
common --color=yes
common:rules --disk_cache=.bazel_cache
common:tests --disk_cache=../.bazel_cache
common:tests --@rules_scala_annex//rules/scala:scala-toolchain=test_zinc_2_13

# These are backwards incompatible options; we should check to see if their values have been flipped
# when upgrading to new major Bazel version.
common --incompatible_auto_exec_groups
common --incompatible_autoload_externally=sh_binary # sh_binary is used by rules_jvm_external
common --incompatible_config_setting_private_default_visibility
common --incompatible_disable_native_repo_rules
common --incompatible_disable_starlark_host_transitions
common --incompatible_disable_target_provider_fields
common --incompatible_strict_action_env

# Unfortunately, this can't be enabled just yet because with it enabled, we get the following error:
# ERROR: Traceback (most recent call last):
# File "/home/jpeterson/.cache/bazel/*/external/rules_java+/java/common/rules/java_runtime.bzl", line 197, column 48, in <toplevel>
# "hermetic_static_libs": attr.label_list(
# Error in label_list: Illegal argument: element in 'providers' is of unexpected type. Either all elements should be providers, or all elements should be lists of providers, but got an element of type com.google.devtools.build.lib.starlarkbuildapi.core.ContextAndFlagGuardedValue$1.
#
#common --incompatible_stop_exporting_language_modules

# This is disabled because rules_python (and possibly other rulesets we depend on) rely on
# deprecated `Label` APIs:
# https://github.com/bazelbuild/rules_python/blob/main/python/private/pythons_hub.bzl#L82
#common --noincompatible_enable_deprecated_label_apis

test --test_output=all
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4.1
8.1.0
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-24.04]
bazel_version: [bazelbuild/7.4.1]
bazel_version: [bazelbuild/8.1.0]
steps:
- uses: actions/checkout@v3
- uses: bazel-contrib/[email protected]
Expand Down
22 changes: 10 additions & 12 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
module(name = "rules_scala_annex")

bazel_dep(name = "bazel_skylib", version = "1.7.1")

bazel_dep(name = "buildifier_prebuilt", version = "7.3.1", dev_dependency = True)

bazel_dep(name = "rules_java", version = "7.12.2")
bazel_dep(name = "protobuf", version = "29.3")
bazel_dep(name = "rules_java", version = "8.9.0")
bazel_dep(name = "rules_jvm_external", version = "6.5")

bazel_dep(name = "buildifier_prebuilt", version = "7.3.1", dev_dependency = True)
bazel_dep(name = "rules_pkg", version = "1.0.1", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.7.1", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.7.2", dev_dependency = True)

register_toolchains(
"//:annex_scalafmt",
Expand Down Expand Up @@ -113,9 +112,8 @@ annex_proto = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
annex_proto.install(
name = "annex_proto",
artifacts = [
"com.github.os72:protoc-jar:3.11.4",
"com.thesamet.scalapb:compilerplugin_2.13:0.11.17",
"com.thesamet.scalapb:protoc-bridge_2.13:0.9.7",
"com.thesamet.scalapb:compilerplugin_2.13:1.0.0-alpha.1",
"com.thesamet.scalapb:protoc-bridge_2.13:0.9.8",
],
fetch_sources = True,
lock_file = "//:annex_proto_install.json",
Expand All @@ -127,14 +125,14 @@ annex_proto.install(
)
use_repo(annex_proto, "annex_proto")

java_launcher_version = "7.4.1"
java_launcher_version = "8.9.0"

java_launcher_template_sha = "ee4aa47ae5e639632c67be5cc0ccbc4e941a67a1b884a1ce0c4329357a4b62b2"
java_launcher_template_sha = "289d8c13a3e2680bfbe21a2c6a57cc428ecdc6a0f2c04bda4d4dc2da40311eaa"

java_stub_template_url = (
"raw.githubusercontent.com/bazelbuild/bazel/" +
"raw.githubusercontent.com/bazelbuild/rules_java/" +
java_launcher_version +
"/src/main/java/com/google/devtools/build/lib/bazel/rules/java/" +
"/java/bazel/rules/" +
"java_stub_template.txt"
)

Expand Down
Loading