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

Upgrade to Bazel 8 #30

Open
wants to merge 4 commits into
base: migrate-to-bzlmod
Choose a base branch
from
Open
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
54 changes: 36 additions & 18 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
build --define=scala_deps_direct=error
build --define=scala_deps_used=error
# 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"

build --experimental_strict_action_env
test --experimental_strict_action_env
# Other options
build --experimental_use_hermetic_linux_sandbox
build --experimental_worker_cancellation
build --experimental_worker_multiplex_sandboxing
build --strategy=worker,sandboxed,local
build --verbose_failures
build --worker_max_instances=4
build --worker_sandboxing

build --strategy=ScalaCompile=worker
build --strategy=ScalaCheckDeps=worker
build --strategy=ScalaFmt=worker
test --strategy=ScalaCompile=worker
test --strategy=ScalaCheckDeps=worker
test --strategy=ScalaFmt=worker

build --python_path=/usr/bin/python3
run --python_path=/usr/bin/python3
test --python_path=/usr/bin/python3
common --announce_rc
common --color=yes
common --disk_cache=.bazel_cache

# 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
common --@rules_scala_annex//rules/scala:scala-toolchain=zinc
common:v3.2 --config=noop
common:v3.3 --config=noop

# pick something trivial as a "noop"
common:noop --logging=3
# Unfortunately, this can't be enabled just yet because of
# https://github.com/bazelbuild/rules_java/issues/264
#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.0.1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.bazel_cache/
/bazel-*
/external-tools/
/temp
Expand Down
6 changes: 3 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ bazel_dep(name = "rules_scala_annex")

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

rules_scala_annex_version = "lucid_2024-12-06"
rules_scala_annex_version = "upgrade-to-bazel-8"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Wait until upgrade-to-bazel-8 is merged and change this to a release tag.


archive_override(
module_name = "rules_scala_annex",
integrity = "sha256-lSbyWlYtgP0ENngg4gKU1EBJ8d1sgMQKJlmOHwmCw3k=",
integrity = "sha256-O5U6tsd1xo1gkY+iL1si2Ssod34Xk7Ix/gDHytbU49c=",
strip_prefix = "rules_scala-{}".format(rules_scala_annex_version),
urls = ["https://github.com/lucidsoftware/rules_scala/archive/refs/tags/{}.zip".format(rules_scala_annex_version)],
urls = ["https://github.com/lucidsoftware/rules_scala/archive/refs/heads/{}.zip".format(rules_scala_annex_version)],
)

register_toolchains("//scala:zinc")
Expand Down
348 changes: 117 additions & 231 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rules/hocon.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ hocon_library = rule(
),
"_hocon_compiler": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
allow_files = True,
default = Label("//hocon-compiler"),
),
Expand Down
4 changes: 2 additions & 2 deletions tests/optional_includes/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ hocon_library(
"2.conf",
"3.conf",
],
deps = glob(["config/2.conf"]) + glob(["config/3.conf"]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we removing config/2.conf from here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the purpose of using globs here was to show how to use an optional dependency, where the file may or may not exist. This is something that we use in our codebase in order to allow developers to override configuration with a file that isn't checked into git.

deps = ["config/3.conf"],
)

hocon_library(
name = "bad",
src = "config/1.conf",
out = "bad.conf",
tags = ["manual"],
deps = glob(["config/2.conf"]) + glob(["config/3.conf"]),
deps = ["config/3.conf"],
)
Loading