Skip to content

Commit

Permalink
Update {junit,specs2_junit}_toolchain()
Browse files Browse the repository at this point in the history
These macros now mirror the implementation of `scalatest_toolchain()`.

However, I realized that the old pattern of calling
`scalatest_repositories()` followed by `scalatest_toolchain()` will no
longer work without first calling `scala_toolchains(scalatest = True)`.
This is because the `alias` targets in `testing/BUILD` that replace the
previous implementations all point to
`@io_bazel_rules_scala_toolchains`.

So if we want to keep these macros, it seems like we should maybe
restore the original toolchain targets in `testing/BUILD`. If we don't,
we can remove these macros, but we can document these as breaking
changes, and update other documentation accordingly.
  • Loading branch information
mbland committed Dec 10, 2024
1 parent 0aefe5a commit 594c4ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion testing/junit.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
load("//junit:junit.bzl", _repositories = "junit_repositories")
load("//scala:scala_cross_version.bzl", "version_suffix")
load("@io_bazel_rules_scala_config//:config.bzl", "SCALA_VERSIONS")

def junit_repositories():
_repositories()

def junit_toolchain():
native.register_toolchains("@io_bazel_rules_scala//testing:junit_toolchain")
for scala_version in SCALA_VERSIONS:
native.register_toolchains(str(Label(
"//testing:junit_toolchain" + version_suffix(scala_version),
)))
5 changes: 2 additions & 3 deletions testing/scalatest.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//scalatest:scalatest.bzl", _repositories = "scalatest_repositories")
load("//scala:scala_cross_version.bzl", "version_suffix")
load("//scalatest:scalatest.bzl", _repositories = "scalatest_repositories")
load("@io_bazel_rules_scala_config//:config.bzl", "SCALA_VERSIONS")

def scalatest_repositories():
Expand All @@ -8,6 +8,5 @@ def scalatest_repositories():
def scalatest_toolchain():
for scala_version in SCALA_VERSIONS:
native.register_toolchains(str(Label(
"//testing:scalatest_toolchain" +
version_suffix(scala_version),
"//testing:scalatest_toolchain" + version_suffix(scala_version),
)))
7 changes: 6 additions & 1 deletion testing/specs2_junit.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
load("//scala:scala_cross_version.bzl", "version_suffix")
load("//specs2:specs2_junit.bzl", _repositories = "specs2_junit_repositories")
load("@io_bazel_rules_scala_config//:config.bzl", "SCALA_VERSIONS")

def specs2_junit_repositories():
_repositories()

def specs2_junit_toolchain():
native.register_toolchains("@io_bazel_rules_scala//testing:specs2_junit_toolchain")
for scala_version in SCALA_VERSIONS:
native.register_toolchains(str(Label(
"//testing:specs2_junit_toolchain" + version_suffix(scala_version),
)))

0 comments on commit 594c4ff

Please sign in to comment.