File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ scala_toolchain(
3434[
3535 toolchain (
3636 name = tc ,
37+ target_settings = ["@io_bazel_rules_scala_config//:scala_version" + version_suffix (SCALA_VERSION )],
3738 toolchain = tc + "_impl" ,
3839 toolchain_type = "//scala:toolchain_type" ,
3940 visibility = ["//visibility:public" ],
Original file line number Diff line number Diff line change @@ -29,12 +29,24 @@ def _store_config(repository_ctx):
2929 )
3030
3131 # All versions supported
32- scala_versions = repository_ctx .attr .scala_versions
32+ if "SCALA_VERSIONS" in repository_ctx .os .environ :
33+ scala_versions = repository_ctx .os .environ ["SCALA_VERSIONS" ].split ("," )
34+ else :
35+ scala_versions = repository_ctx .attr .scala_versions
36+
3337 if not scala_versions :
3438 scala_versions = [scala_version ]
3539 elif scala_version not in scala_versions :
3640 fail ("You have to include the default Scala version (%s) in the `scala_versions` list." % scala_version )
3741
42+ # dottyijar requires Scala v3.6.2, but we don't want to force the caller to always provide 3.6.2. Therefore, we
43+ # append it if it hasn't been provided.
44+ #
45+ # Once we move to Bzlmod, this shouldn't be a problem, since we can register a toolchain for Scala v3.6.2 without
46+ # requiring users of this ruleset to do so.
47+ if "3.6.2" not in scala_versions :
48+ scala_versions = scala_versions + ["3.6.2" ]
49+
3850 enable_compiler_dependency_tracking = repository_ctx .os .environ .get (
3951 "ENABLE_COMPILER_DEPENDENCY_TRACKING" ,
4052 str (repository_ctx .attr .enable_compiler_dependency_tracking ),
Original file line number Diff line number Diff line change @@ -7,17 +7,23 @@ runner=$(get_test_runner "${1:-local}")
77test_classpath_contains_2_12 () {
88 bazel aquery ' mnemonic("Javac", //src/java/io/bazel/rulesscala/scalac:scalac)' \
99 --repo_env=SCALA_VERSION=2.12.20 \
10+ --repo_env=SCALA_VERSIONS=2.12.20 \
1011 | grep scala-library-2.12
1112}
1213
1314test_classpath_contains_2_13 () {
1415 bazel aquery ' mnemonic("Javac", //src/java/io/bazel/rulesscala/scalac:scalac)' \
1516 --repo_env=SCALA_VERSION=2.13.15 \
17+ --repo_env=SCALA_VERSIONS=2.13.15 \
1618 | grep scala-library-2.13
1719}
1820
1921test_scala_config_content () {
20- bazel build --repo_env=SCALA_VERSION=0.0.0 @io_bazel_rules_scala_config//:all 2> /dev/null
22+ bazel build \
23+ --repo_env=SCALA_VERSION=0.0.0 \
24+ --repo_env=SCALA_VERSIONS=0.0.0 \
25+ @io_bazel_rules_scala_config//:all 2> /dev/null
26+
2127 grep " SCALA_MAJOR_VERSION='0.0'" \
2228 " $( bazel info output_base) " /external/* io_bazel_rules_scala_config/config.bzl
2329}
You can’t perform that action at this time.
0 commit comments