bazelbuild / rules_scala

Scala rules for Bazel
Apache License 2.0
360 stars 273 forks source link

Bazel 7.0 rc2 support #1524

Closed gergelyfabian closed 10 months ago

gergelyfabian commented 10 months ago

Added @bazel_tools//tools/jdk:toolchain_type toolchain for scala_junit_test: https://github.com/bazelbuild/bazel/issues/18970

Changed deprecated transitive_runtime_deps to transitive_runtime_jars in jmh.bzl: https://bazel.build/versions/6.4.0/rules/lib/JavaInfo#transitive_runtime_deps

With these changes rules_scala (for the cases I checked) started working with Bazel 7.0 rc2.

gergelyfabian commented 10 months ago

There is still one thing that doesn't work for Bazel 7.0rc2. When running a target like this:

# Important to clean, as the files can stay from a previous bazel build with a lower Bazel version.
bazel clean
bazel run //utils/smth:library.format-test

I receive:

utils/smth/src/main/scala/com/dummy/smth/Smth.scala
diff: /home/gege/.cache/bazel/_bazel_user/7f83a0b1f0940f88aec1f4530f927169/execroot/repo/bazel-out/k8-fastbuild/bin/utils/smth/utils/smth/src/main/scala/com/dummy/smth/Smth.scala.fmt.output: No such file or directory

It seems the action responsible for creating this file executes (I have tested disabling writing the output there, but then obviously it fails due to not generating an output), but at a later step the action running scalafmt from the manifest cannot see the scalafmt outputs.

gergelyfabian commented 10 months ago

One difference I can see in the bazel-bin direction between Bazel 6.4.0 and Bazel 7.0rc2 (after running bazel run //utils/smth:library.format-test):

# 6.4.0:
ls bazel-bin/utils/smth/utils/smth/src/main/scala/com/dummy/smth/
Smth.scala.fmt.output
# 7.0rc2:
ls bazel-bin/utils/smth/utils/smth/src/main/scala/com/dummy/smth/
[empty]
gergelyfabian commented 10 months ago

Opened an issue for the scalafmt error:

https://github.com/bazelbuild/rules_scala/issues/1525