Skip to content

Commit

Permalink
Move scala/{private/macros/,}toolchains_repo.bzl
Browse files Browse the repository at this point in the history
Like "Move `scala_toolchains` to `scala/toolchains.bzl`",
removes the `scala_toolchains_repo` symbol from `scala/scala.bzl` and
makes it available from `scala/toolchains_repo.bzl`.

This avoids a future `test_scala_version 2.12.20` failure during Bazel 8
builds after adding `twitter_scrooge` toolchain support in the new
`test_version/version_specific_tests_dir/scrooge_repositories.bzl` file.
Otherwise, this new file would load `toolchains_repo` from
`scala/scala.bzl`. The `test_version/test_scala_version_.../WORKSPACE`
file generated from `test_version/WORKSPACE.template` would then
transitively load `.bzl` files with `rules_java` symbols, breaking the
test.

```txt
$ RULES_SCALA_TEST_ONLY="test_scala_version 2.12.20" ./test_version.sh

ERROR: Traceback (most recent call last):
  File ".../external/rules_scala/scala/private/common_attributes.bzl",
  line 18, column 28, in <toplevel>
    "deps": 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 list with an element of type NoneType.

ERROR: Error computing the main repository mapping:
  at test_version/test_scala_version_.../scrooge_repositories.bzl:1:6:
  at .../scala/scala.bzl:30:5:
  at .../scala/private/rules/scala_junit_test.bzl:5:5:
initialization of module 'scala/private/common_attributes.bzl' failed
```
  • Loading branch information
mbland committed Dec 10, 2024
1 parent 594c4ff commit f62d8a7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions scala/scala.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ load(
"//specs2:specs2_junit.bzl",
_specs2_junit_dependencies = "specs2_junit_dependencies",
)
load(
"//scala/private:macros/toolchains_repo.bzl",
_scala_toolchains_repo = "scala_toolchains_repo",
)
load(
"//scala/private:macros/scala_repositories.bzl",
_rules_scala_setup = "rules_scala_setup",
Expand Down Expand Up @@ -80,4 +76,3 @@ rules_scala_toolchain_deps_repositories = _rules_scala_toolchain_deps_repositori
scala_test = _scala_test
scala_test_suite = _scala_test_suite
setup_scala_toolchain = _setup_scala_toolchain
scala_toolchains_repo = _scala_toolchains_repo
2 changes: 1 addition & 1 deletion scala/toolchains.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

load("//junit:junit.bzl", "junit_artifact_ids")
load("//scala/private:macros/scala_repositories.bzl", "scala_repositories")
load("//scala/private:macros/toolchains_repo.bzl", "scala_toolchains_repo")
load("//scala:toolchains_repo.bzl", "scala_toolchains_repo")
load("//scala:scala_cross_version.bzl", "default_maven_server_urls")
load("//scalatest:scalatest.bzl", "scalatest_artifact_ids")
load("//specs2:specs2.bzl", "specs2_artifact_ids")
Expand Down
File renamed without changes.

0 comments on commit f62d8a7

Please sign in to comment.