From 14a547fcbec987789e5b43c6fa73b3ae74a7468a Mon Sep 17 00:00:00 2001 From: Mike Bland Date: Mon, 2 Dec 2024 09:44:01 -0500 Subject: [PATCH] Update `{junit,specs2_junit}_toolchain()` 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. --- testing/junit.bzl | 7 ++++++- testing/scalatest.bzl | 5 ++--- testing/specs2_junit.bzl | 7 ++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/testing/junit.bzl b/testing/junit.bzl index a87ac6817e..2208675b96 100644 --- a/testing/junit.bzl +++ b/testing/junit.bzl @@ -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), + ))) diff --git a/testing/scalatest.bzl b/testing/scalatest.bzl index 3260aa457c..1d66fe50c9 100644 --- a/testing/scalatest.bzl +++ b/testing/scalatest.bzl @@ -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(): @@ -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), ))) diff --git a/testing/specs2_junit.bzl b/testing/specs2_junit.bzl index a7da792d84..eed7313178 100644 --- a/testing/specs2_junit.bzl +++ b/testing/specs2_junit.bzl @@ -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), + )))