Skip to content

Bump Bazel, Scalafmt, Guava, sbt, gRPC, proto-java #1720

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 1 commit into from
Mar 26, 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
12 changes: 6 additions & 6 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ tasks:
- "set PATH=/usr/bin;%PATH%" #Make sure bash uses msys commands over windows commands. (i.e. find).
- "bash -lc \"pacman --noconfirm --needed -S libxml2\"" #tests require xmllint
- "bash test_rules_scala.sh"
test_coverage_linux_7_5_0:
test_coverage_linux_7_6_0:
name: "./test_coverage"
platform: ubuntu2004
bazel: 7.5.0
bazel: 7.6.0
shell_commands:
- "./test_coverage.sh"
test_coverage_macos_7.5.0:
test_coverage_macos_7.6.0:
name: "./test_coverage"
platform: macos
bazel: 7.5.0
bazel: 7.6.0
shell_commands:
- "./test_coverage.sh"
test_reproducibility_linux:
Expand Down Expand Up @@ -93,13 +93,13 @@ tasks:
examples_linux:
name: "./test_examples"
platform: ubuntu2004
bazel: 7.5.0
bazel: 7.6.0
shell_commands:
- "./test_examples.sh"
cross_build_linux:
name: "./test_cross_build"
platform: ubuntu2004
bazel: 7.5.0
bazel: 7.6.0
shell_commands:
- "./test_cross_build.sh"
lint_linux:
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.9.2"
version = "3.9.4"
runner.dialect = scala213
align.openParenCallSite = false
align.openParenDefnSite = false
Expand Down
76 changes: 62 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ load("@rules_scala//:scala_config.bzl", "scala_config")
# scala_config(scala_version = "2.13.16")
#
# You may define your own custom toolchain using Maven artifact dependencies
# configured by your `WORKSPACE` file, imported using external loader like
# https://github.com/bazelbuild/rules_jvm_external.
# configured by your `WORKSPACE` file, imported using an external loader like
# https://github.com/bazelbuild/rules_jvm_external. See docs/scala_toolchain.md.
scala_config()

load(
Expand Down Expand Up @@ -264,20 +264,26 @@ maximum available at the time of writing.
- For the actual versions used by `rules_scala`, see
[scala/deps.bzl](scala/deps.bzl).

- See [the configuration file][ci-config] for the exact Bazel versions verified
with the continuous-integration builds.

[ci-config]: ./.bazelci/presubmit.yml
- See [.bazelci/presubmit.yml](./.bazelci/presubmit.yml) for the exact Bazel
versions verified by the continuous integration builds.

| Bazel/Dependency | `rules_scala` 7.x |
| :-: | :-: |
| Bazel versions using Bzlmod<br/>(Coming soon! See bazelbuild/rules_scala#1482.) | 7.5.0, 8.x,<br/>`rolling`, `last_green` |
| Bazel versions using `WORKSPACE` | 6.5.0, 7.5.0, 8.x<br/>(see the [notes on 6.5.0 compatibility](#6.5.0)) |
| `protobuf` | v30.0 |
| `abseil-cpp` | 20250127.0 |
| `rules_java` | 8.10.0 |
| Bazel versions using Bzlmod<br/>(Coming soon! See bazelbuild/rules_scala#1482.) | 7.6.0, 8.x,<br/>`rolling`, `last_green` |
| Bazel versions using `WORKSPACE` | 6.5.0, 7.6.0, 8.x<br/>(see the [notes on 6.5.0 compatibility](#6.5.0)) |
| `protobuf` | v30.1 |
| `rules_proto` | 7.1.0 |
| `abseil-cpp` | 20250127.1 |
| `rules_java` | 8.11.0 |
| `ScalaPB` | 1.0.0-alpha.1 |

The next major release will likely drop support for `protobuf` versions before
v29 and remove `rules_proto` completely. This is to comply with the guidance in
[Protobuf News: News Announcements for Version 29.x](
https://protobuf.dev/news/v29/). For more details, see this [comment from #1710
explaining why rules_proto remains for now](
https://github.com/bazelbuild/rules_scala/pull/1710#issuecomment-2750001012).

## Usage with [bazel-deps](https://github.com/johnynek/bazel-deps)

Bazel-deps allows you to generate bazel dependencies transitively for maven artifacts. Generally we don't want bazel-deps to fetch
Expand Down Expand Up @@ -682,7 +688,7 @@ Under Bzlmod, repos are only visible to the module extension that creates them,
unless the `MODULE.bazel` file brings them into scope with
[`use_repo()`](https://bazel.build/rules/lib/globals/module#use_repo). This can
lead to errors like those from the following example, which [originally called
`setup_scala_toolchain()` under Bzlmod](
'setup_scala_toolchain()' under Bzlmod](
https://github.com/michalbogacz/scala-bazel-monorepo/blob/17f0890a4345529e09b9ce83bcb2e3d15687c522/BUILD.bazel):

```py
Expand Down Expand Up @@ -756,7 +762,7 @@ bazelbuild/bazel#25198 describes how the semantics of some instances of
`$(rootpath)` fixed them.

The good news is that replacing such instances `$(location)` with `$(rootpath)`
is backwards compatible to Bazel 6.5.0 and 7.5.0. Updating them now will ensure
is backwards compatible to Bazel 6.5.0 and 7.6.0. Updating them now will ensure
future compatibility.

### <a id="6.5.0"></a>Limited Bazel 6.5.0 compatibility
Expand Down Expand Up @@ -809,10 +815,52 @@ https://github.com/scalapb/ScalaPB/releases/tag/v1.0.0-alpha.1), we had to
remove the Scala 2.11 test cases.

Building `scala_proto` for Scala 2.11 requires [building with Bazel 6.5.0
under `WORKSPACE`](#6.5.0), with the maximum dependency versions specified in
under WORKSPACE](#6.5.0), with the maximum dependency versions specified in
that section. While this may continue to work for some time, it is not
officially supported.

### Removal of `bind()` aliases for `twitter_scrooge` dependencies

`rules_scala` 7.x removes all of the obsolete [`bind()`][] aliases under
`//external:io_bazel_rules_scala/dependency/` created for `twitter_scrooge`
toolchain dependencies. If your project happens to depend on these aliases, you
can replace them with the following repository references:

| `bind()` alias under `//external:io_bazel_rules_scala/dependency/` | Repository reference |
| :-- | :-- |
| `scala/guava` | `@io_bazel_rules_scala_guava` |
| `thrift/javax_annotation_api` | `@io_bazel_rules_scala_javax_annotation_api` |
| `thrift/libthrift` | `@libthrift` |
| `thrift/mustache` | `@io_bazel_rules_scala_mustache` |
| `thrift/scopt` | `@io_bazel_rules_scala_scopt` |
| `thrift/scrooge_core` | `@io_bazel_rules_scala_scrooge_core` |
| `thrift/scrooge_generator` | `@io_bazel_rules_scala_scrooge_generator` |
| `thrift/util_core` | `@io_bazel_rules_scala_util_core` |
| `thrift/util_logging` | `@io_bazel_rules_scala_util_logging` |

[`bind()`]: https://bazel.build/reference/be/workspace#bind

To access these repositories under Bzlmod, you'll need to add the following to
your `MODULE.bazel` file:

```py
scala_deps.toolchains(
twitter_scrooge = True,
)
use_repo(
scala_deps,
"io_bazel_rules_scala_guava",
"io_bazel_rules_scala_javax_annotation_api",
"io_bazel_rules_scala_mustache",
"io_bazel_rules_scala_scopt",
"io_bazel_rules_scala_scrooge_core",
"io_bazel_rules_scala_scrooge_generator",
"io_bazel_rules_scala_util_core",
"io_bazel_rules_scala_util_logging",
"libthrift",
)
```

### Bazel module compatibility levels

`rules_scala` 7.0.0 will set the
Expand Down
6 changes: 3 additions & 3 deletions docs/scala_toolchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ scala_toolchains()
scala_register_toolchains()
```

### B) Defining your own `scala_toolchain` requires 2 steps
### B) Defining your own `scala_toolchain`

#### Step 1

Expand Down Expand Up @@ -57,15 +57,15 @@ toolchain(

If you want to use your own compiler JARs, use `setup_scala_toolchain()`
instead. This example assumes the external libraries are resolved with
[rules_jvm_external](https://github.com/bazelbuild/rules_jvm_external)
[rules_jvm_external](https://github.com/bazelbuild/rules_jvm_external):

```py
# //toolchains/BUILD
load("@rules_scala//scala:scala.bzl", "setup_scala_toolchain")

setup_scala_toolchain(
name = "my_toolchain",
# configure toolchain dependecies
# configure toolchain dependencies
parser_combinators_deps = [
"@maven//:org_scala_lang_modules_scala_parser_combinators_2_12",
],
Expand Down
2 changes: 1 addition & 1 deletion dt_patches/compiler_sources/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
2 changes: 1 addition & 1 deletion dt_patches/test_dt_patches/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
2 changes: 1 addition & 1 deletion dt_patches/test_dt_patches_user_srcjar/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
2 changes: 1 addition & 1 deletion examples/crossbuild/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
2 changes: 1 addition & 1 deletion examples/overridden_artifacts/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
2 changes: 1 addition & 1 deletion examples/scala3/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
2 changes: 1 addition & 1 deletion examples/semanticdb/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
2 changes: 1 addition & 1 deletion examples/testing/scalatest_repositories/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
2 changes: 1 addition & 1 deletion examples/testing/specs2_junit_repositories/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
1 change: 1 addition & 0 deletions scala_proto/default/default_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ DEFAULT_SCALAPB_COMPILE_DEPS = [

DEFAULT_SCALAPB_GRPC_DEPS = [
"@io_bazel_rules_scala_guava",
"@org_jspecify_jspecify",
"@scala_proto_rules_disruptor",
"@scala_proto_rules_grpc_api",
"@scala_proto_rules_grpc_context",
Expand Down
1 change: 1 addition & 0 deletions scala_proto/default/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ GUAVA_ARTIFACT_IDS = [
"io_bazel_rules_scala_guava",
"io_bazel_rules_scala_failureaccess",
"org_checkerframework_checker_qual",
"org_jspecify_jspecify",
]

def scala_proto_artifact_ids(scala_version):
Expand Down
10 changes: 5 additions & 5 deletions scripts/create_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
]
PARSER_COMBINATORS_VERSION = '1.1.2'
SBT_COMPILER_INTERFACE_VERSION = '1.10.8'
SBT_UTIL_INTERFACE_VERSION = '1.10.10'
SBT_UTIL_INTERFACE_VERSION = '1.10.11'
SCALATEST_VERSION = "3.2.19"
SCALAFMT_VERSION = "3.9.2"
SCALAFMT_VERSION = "3.9.4"
KIND_PROJECTOR_VERSION = "0.13.3"
PROTOBUF_JAVA_VERSION = "4.30.0"
PROTOBUF_JAVA_VERSION = "4.30.1"
JLINE_VERSION = '3.29.0'
SCALAPB_VERSION = '0.11.17'
PROTOC_BRIDGE_VERSION = '0.9.8'
GRPC_VERSION = '1.71.0'
GRPC_COMMON_PROTOS_VERSION = '2.53.0'
GRPC_COMMON_PROTOS_VERSION = '2.54.1'
GRPC_LIBS = ['netty', 'protobuf', 'stub']
GUAVA_VERSION = '33.4.0-jre'
GUAVA_VERSION = '33.4.4-jre'

# This should include values corresponding to `MavenCoordinates.artifact_name`,
# i.e., group:artifact after stripping any Scala version suffix from artifact.
Expand Down
2 changes: 1 addition & 1 deletion test/proto_cross_repo_boundary/repo/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
2 changes: 1 addition & 1 deletion test/scalafmt/.scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.9.2"
version = "3.9.4"
runner.dialect = scala213
maxColumn = 40
lineEndings = preserve
2 changes: 1 addition & 1 deletion test_cross_build/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0
7.6.0
2 changes: 1 addition & 1 deletion test_cross_build/scalafmt/.scalafmt2.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.9.2"
version = "3.9.4"
runner.dialect = scala213
maxColumn = 40
lineEndings = preserve
2 changes: 1 addition & 1 deletion test_cross_build/scalafmt/.scalafmt3.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.9.2"
version = "3.9.4"
runner.dialect = scala3
maxColumn = 40
lineEndings = preserve
19 changes: 11 additions & 8 deletions third_party/repositories/scala_2_11.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ artifacts = {
"sha256": "88241573467ddca44ffd4d74aa04c2bbfd11bf7c17e0c342c94c9de7a70a7c64",
},
"com_google_protobuf_protobuf_java": {
"artifact": "com.google.protobuf:protobuf-java:4.30.0",
"sha256": "3e9ec992a1bd02eeec7229879e5e99798c0f582a3cbfc924792640256e87b67d",
"artifact": "com.google.protobuf:protobuf-java:4.30.1",
"sha256": "ff666fc33646eb2b609259b7928fc675782e401ee6e39ef3ae4581e06f642a15",
},
"com_lihaoyi_fansi": {
"artifact": "com.lihaoyi:fansi_2.11:0.2.6",
Expand Down Expand Up @@ -115,14 +115,13 @@ artifacts = {
"sha256": "8a8f81cf9b359e3f6dfa691a1e776985c061ef2f223c9b2c80753e1b458e8064",
},
"io_bazel_rules_scala_guava": {
"artifact": "com.google.guava:guava:33.4.0-jre",
"sha256": "b918c98a7e44dbe94ebd9fe3e40cddaadb5a93e6a78eb6008b42df237241e538",
"artifact": "com.google.guava:guava:33.4.4-jre",
"sha256": "95bde613be18dfa2f0b870e4029ac264d5ba6989967204fc92ffe9ad5370cf5e",
"deps": [
"@com_google_code_findbugs_jsr305",
"@com_google_errorprone_error_prone_annotations",
"@com_google_j2objc_j2objc_annotations",
"@io_bazel_rules_scala_failureaccess",
"@org_checkerframework_checker_qual",
"@org_jspecify_jspecify",
],
},
"io_bazel_rules_scala_javax_annotation_api": {
Expand Down Expand Up @@ -424,6 +423,10 @@ artifacts = {
"artifact": "org.codehaus.mojo:animal-sniffer-annotations:1.24",
"sha256": "c720e6e5bcbe6b2f48ded75a47bccdb763eede79d14330102e0d352e3d89ed92",
},
"org_jspecify_jspecify": {
"artifact": "org.jspecify:jspecify:1.0.0",
"sha256": "1fad6e6be7557781e4d33729d49ae1cdc8fdda6fe477bb0cc68ce351eafdfbab",
},
"org_scala_lang_modules_scala_collection_compat": {
"artifact": "org.scala-lang.modules:scala-collection-compat_2.11:2.1.2",
"sha256": "e9667b8b7276aeb42599f536fe4d7caab06eabc55e9995572267ad60c7a11c8b",
Expand Down Expand Up @@ -779,8 +782,8 @@ artifacts = {
"sha256": "c7b478503ec524e55df19b424d46d27c8a68aeb801664fadd4f069b71f52d0f6",
},
"scala_proto_rules_proto_google_common_protos": {
"artifact": "com.google.api.grpc:proto-google-common-protos:2.53.0",
"sha256": "61ac7fbd31a9f604890d22330a6f94b3f410ea2d7247e0f5f11a87ae34087385",
"artifact": "com.google.api.grpc:proto-google-common-protos:2.54.1",
"sha256": "2fcff25fe8a90fcacb146a900222c497ba0a9a531271e6b135a76450d23b1ef2",
"deps": [
"@com_google_protobuf_protobuf_java",
],
Expand Down
Loading