-
-
Notifications
You must be signed in to change notification settings - Fork 286
Bump dependency versions for rules_scala
v7.1.0
#1755
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
base: master
Are you sure you want to change the base?
Conversation
Bumps most dependency versions (except `rules_python` under `WORKSPACE`) to the latest available before releasing `rules_scala` v7.1.0. Also bumps the `rules_scala` version number in `MODULE.bazel` to `7.1.0`. - Go: 1.24.4 => 1.24.5 - Scalafmt: 3.9.7 => 3.9.8 - `bazel_skylib`: 1.7.1 => 1.8.1 - `gazelle`: 0.43.0 => 0.44.0 - `golang.org/x/tools`: v0.34.0 => v0.35.0 - `org.scala-sbt:util-interface`: 1.11.1 => 1.11.3 - `proto-google-common-protos`: 2.58.0 => 2.59.2 - `rules_cc`: 0.1.1 => 0.1.4 - `rules_go`: 0.55.0 => 0.55.1 - `rules_java`: 8.12.0 => 8.14.0 - `rules_jvm_external`: 6.7 => 6.8 - `rules_python`: 1.4.1 => 1.5.1 (Bzlmod only) Also: - Moves the `http_archive` instantiations of `rules_python` and `rules_shell` from individual `WORKSPACE` files to `//scala:latest_deps.bzl`. Removes `load` statements for `http_archive` throughout all `WORKSPACE` files. - Removes the `--incompatible_autoload_externally` flag from `.bazelrc`. - Fixes `_get_compiler_srcjar` from `//scala/private:macros/scala_repositories.bzl` to return empty `compiler_srcjar_objects` instead of returning a valid object. Caught by `test_compiler_srcjar_error 2.12.11` from `dt_patches/dt_patch_test.sh` when testing under `WORKSPACE`. Added `test_fail_if_compiler_srcjar_object_is_empty` to `test/shell/test_compiler_sources_integrity.sh` to catch the specific problem sooner. --- This is to ensure that we're compatible with the latest dependencies available before releasing a new minor version. I moved the `rules_python` instantiation to `//scala:latest_deps.bzl` because it was such a pain to update everywhere. `latest_deps.bzl` is essentially a development file, or a "use at your own risk" file, and the primary consumers are internal test modules. This will make future `rules_python` updates less noisy. The only `rules_shell` instantiations were in the top level `WORKSPACE` and `test_version/WORKSPACE.template`. I moved `rules_shell` into `latest_deps.bzl` to eliminate these direct instantations as well, and to remove the `http_archive` imports from those files. I'd added `--incompatible_autoload_externally` in bazel-contrib#1748 when fixing problems with `WORKSPACE` builds under Bazel 8.2.1. However, it's not really necessary, so I removed it. Updating `rules_python` from 1.4.1 to 1.5.1 produced the following error in Bazel 7.6.1 WORKSPACE builds, even with `--incompatible_autoload_externally=+@rules_python`: ```txt $ bazel build //src/... //test/... WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_python' found. This will result in a failure if there's a reference to those rules or symbols. ERROR: test/BUILD:824:10: in py_binary rule //test:py_resource_binary: Traceback (most recent call last): File ".../external/rules_python/python/private/py_binary_rule.bzl", line 24, column 30, in _py_binary_impl return py_executable_impl( File ".../external/rules_python/python/private/py_executable.bzl", line 255, column 35, in py_executable_impl py_executable_base_impl( File ".../external/rules_python/python/private/py_executable.bzl", line 1140, column 46, in py_executable_base_impl exec_result = semantics.create_executable( File ".../external/rules_python/python/private/py_executable.bzl", line 365, column 33, in _create_executable _create_stage1_bootstrap( File ".../external/rules_python/python/private/py_executable.bzl", line 809, column 27, in _create_stage1_bootstrap if runtime and runtime.supports_build_time_venv: Error: 'PyRuntimeInfo' value has no field or method 'supports_build_time_venv' Available attributes: bootstrap_template, coverage_files, coverage_tool, files, interpreter, interpreter_path, python_version, stub_shebang ERROR: test/BUILD:824:10: Analysis of target '//test:py_resource_binary' failed ERROR: Analysis of target '//test:py_resource_binary' failed; build aborted ``` This is due to bazel-contrib/rules_python#2760. In contrast, Bazel 8.3.1 builds work fine, as do Bazel 7.6.1 builds under Bzlmod. Trying `--incompatible_autoload_externally=PyRuntimeInfo` to work around the problem under Bazel 7.6.1 produced: ```txt $ bazel build //src/... //test/... FATAL: bazel crashed due to an internal error. Printing stack trace: java.lang.IllegalStateException: Symbol in 'PyRuntimeInfo' can't be removed, because it's still used by: py_binary, py_test, py_library at com.google.devtools.build.lib.packages.AutoloadSymbols.<init>(AutoloadSymbols.java:192) [...snip...] ``` And with `--incompatible_autoload_externally=@rules_python` produced: ```txt WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_python' found. This will result in a failure if there's a reference to those rules or symbols. ERROR: .../external/bazel_tools/tools/python/toolchain.bzl:25:44: name 'PyRuntimeInfo' is not defined ERROR: .../external/bazel_tools/tools/python/toolchain.bzl:33:44: name 'PyRuntimeInfo' is not defined ERROR: .../external/bazel_tools/tools/python/toolchain.bzl:64:26: name 'PyRuntimeInfo' is not defined ERROR: .../external/bazel_tools/tools/python/toolchain.bzl:72:26: name 'PyRuntimeInfo' is not defined WARNING: Target pattern parsing failed. ERROR: Skipping '//test/...': error loading package under directory 'test': error loading package 'test': at .../external/rules_python/python/defs.bzl:21:6: at .../external/rules_python/python/py_runtime_pair.bzl:17:6: compilation of module 'tools/python/toolchain.bzl' failed ERROR: error loading package under directory 'test': error loading package 'test': at .../external/rules_python/python/defs.bzl:21:6: at .../external/rules_python/python/py_runtime_pair.bzl:17:6: compilation of module 'tools/python/toolchain.bzl' failed ``` `tools/python/toolchain.bzl` from Bazel 7.6.1 breaks because it references the builtin `PyRuntimeInfo` instead of `load`ing it from `@rules_python`. Bazel 8 replaces that file's entire implementation with a function that `fail`s with a deprecation error and doesn't use `PyRuntimeInfo`: - https://github.com/bazelbuild/bazel/blob/7.6.1/tools/python/toolchain.bzl - https://github.com/bazelbuild/bazel/blob/8.0.0/tools/python/toolchain.bzl Using `+@rules_python` or `+PyRuntimeInfo` produced the original error. Nothing I could do could avoid using the builtin `PyRuntimeInfo` under Bazel 7.6.1. Since it's only a development dependency for `WORKSPACE` builds, I decided to keep `rules_python` at 1.4.1 in `latest_deps.bzl` for now. I've filed bazel-contrib/rules_python#3119 to get it on the record.
The unescaped `{` in the expected failure message caused `test_fail_if_compiler_srcjar_object_is_empty` to fail on Linux and Windows. Rather than escape it, it works just as well to remove it entirely. See also the "Escape '{', '}' in `test/shell/test_bzlmod_macros`" message from bazel-contrib#1722 and commit 3f37e26.
P.S. I tested this under Bzlmod and I also tested it under Bzlmod with Bazel 9.0.0-pre.20250710.1. Per my comments in #1754, this is the latest Bazel pre-release that will work until a fix lands for bazelbuild/bazel#26579. |
This is temporary until a fix lands for bazelbuild/bazel#26579, but will ensure that new changes get some degree of prerelease testing.
P.P.S. I just added a non-optional CI job for Bazel 9.0.0-pre.20250710.1 to ensure incoming changes get some prerelease coverage before a fix lands for bazelbuild/bazel#26579. I'm happy to revert it if you prefer, though. |
Description
Bumps most dependency versions (except
rules_python
underWORKSPACE
) to the latest available before releasingrules_scala
v7.1.0. Also bumps therules_scala
version number inMODULE.bazel
to7.1.0
.bazel_skylib
: 1.7.1 => 1.8.1gazelle
: 0.43.0 => 0.44.0golang.org/x/tools
: v0.34.0 => v0.35.0org.scala-sbt:util-interface
: 1.11.1 => 1.11.3proto-google-common-protos
: 2.58.0 => 2.59.2rules_cc
: 0.1.1 => 0.1.4rules_go
: 0.55.0 => 0.55.1rules_java
: 8.12.0 => 8.14.0rules_jvm_external
: 6.7 => 6.8rules_python
: 1.4.1 => 1.5.1 (Bzlmod only)Also:
Moves the
http_archive
instantiations ofrules_python
andrules_shell
from individualWORKSPACE
files to//scala:latest_deps.bzl
. Removesload
statements forhttp_archive
throughout allWORKSPACE
files.Removes the
--incompatible_autoload_externally
flag from.bazelrc
.Fixes
_get_compiler_srcjar
from//scala/private:macros/scala_repositories.bzl
to return emptycompiler_srcjar_objects
instead of returning a valid object. Caught bytest_compiler_srcjar_error 2.12.11
fromdt_patches/dt_patch_test.sh
when testing underWORKSPACE
. Addedtest_fail_if_compiler_srcjar_object_is_empty
totest/shell/test_compiler_sources_integrity.sh
to catch the specific problem sooner.Motivation
This is to ensure that we're compatible with the latest dependencies available before releasing a new minor version.
I moved the
rules_python
instantiation to//scala:latest_deps.bzl
because it was such a pain to update everywhere.latest_deps.bzl
is essentially a development file, or a "use at your own risk" file, and the primary consumers are internal test modules. This will make futurerules_python
updates less noisy.The only
rules_shell
instantiations were in the top levelWORKSPACE
andtest_version/WORKSPACE.template
. I movedrules_shell
intolatest_deps.bzl
to eliminate these direct instantations as well, and to remove thehttp_archive
imports from those files.I'd added
--incompatible_autoload_externally
in #1748 when fixing problems withWORKSPACE
builds under Bazel 8.2.1. However, it's not really necessary, so I removed it.Updating
rules_python
from 1.4.1 to 1.5.1 produced the following error in Bazel 7.6.1 WORKSPACE builds, even with--incompatible_autoload_externally=+@rules_python
:$ bazel build //src/... //test/... WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_python' found. This will result in a failure if there's a reference to those rules or symbols. ERROR: test/BUILD:824:10: in py_binary rule //test:py_resource_binary: Traceback (most recent call last): File ".../external/rules_python/python/private/py_binary_rule.bzl", line 24, column 30, in _py_binary_impl return py_executable_impl( File ".../external/rules_python/python/private/py_executable.bzl", line 255, column 35, in py_executable_impl py_executable_base_impl( File ".../external/rules_python/python/private/py_executable.bzl", line 1140, column 46, in py_executable_base_impl exec_result = semantics.create_executable( File ".../external/rules_python/python/private/py_executable.bzl", line 365, column 33, in _create_executable _create_stage1_bootstrap( File ".../external/rules_python/python/private/py_executable.bzl", line 809, column 27, in _create_stage1_bootstrap if runtime and runtime.supports_build_time_venv: Error: 'PyRuntimeInfo' value has no field or method 'supports_build_time_venv' Available attributes: bootstrap_template, coverage_files, coverage_tool, files, interpreter, interpreter_path, python_version, stub_shebang ERROR: test/BUILD:824:10: Analysis of target '//test:py_resource_binary' failed ERROR: Analysis of target '//test:py_resource_binary' failed; build aborted
This is due to bazel-contrib/rules_python#2760. In contrast, Bazel 8.3.1 builds work fine, as do Bazel 7.6.1 builds under Bzlmod.
Trying
--incompatible_autoload_externally=PyRuntimeInfo
to work around the problem under Bazel 7.6.1 produced:$ bazel build //src/... //test/... FATAL: bazel crashed due to an internal error. Printing stack trace: java.lang.IllegalStateException: Symbol in 'PyRuntimeInfo' can't be removed, because it's still used by: py_binary, py_test, py_library at com.google.devtools.build.lib.packages.AutoloadSymbols.<init>(AutoloadSymbols.java:192) [...snip...]
And with
--incompatible_autoload_externally=@rules_python
produced:tools/python/toolchain.bzl
from Bazel 7.6.1 breaks because it references the builtinPyRuntimeInfo
instead ofload
ing it from@rules_python
. Bazel 8 replaces that file's entire implementation with a function thatfail
s with a deprecation error and doesn't usePyRuntimeInfo
:Using
+@rules_python
or+PyRuntimeInfo
produced the original error. Nothing I could do could avoid using the builtinPyRuntimeInfo
under Bazel 7.6.1.Since it's only a development dependency for
WORKSPACE
builds, I decided to keeprules_python
at 1.4.1 inlatest_deps.bzl
for now. I've filed bazel-contrib/rules_python#3119 to get it on the record.