Skip to content

Commit

Permalink
Enable different Scala versions (#340)
Browse files Browse the repository at this point in the history
This updates //scala/extensions:config.bzl to provide a proper module
API that allows the user to configure different Scala versions.

For now, 2.13.12 is the latest Scala 2 version supported by rules_scala
(v6.6.0), defined in //third_party/repositories:scala_2_13.bzl. Setting
it to a later version results in an error:

```txt
File "@io_bazel_rules_scala//third_party/repositories/repositories.bzl",
    line 86, column 17, in repositories
    fail(version_message % (scala_version, repository_scala_version))

Error in fail:
Scala config (2.13.14) version does not match repository version (2.13.12)
```

Signed-off-by: Mike Bland <[email protected]>
  • Loading branch information
mbland authored Sep 9, 2024
1 parent 722e187 commit 988fe51
Show file tree
Hide file tree
Showing 3 changed files with 332 additions and 285 deletions.
6 changes: 5 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,14 @@ http_archive(
)

# This constant matches the default Scala version from rules_scala for now.
SCALA_VERSION = "2.12.18"
SCALA_VERSION = "2.13.12"
SCALA_VERSIONS = [SCALA_VERSION]

scala_config = use_extension("//scala/extensions:config.bzl", "scala_config")
scala_config.settings(
scala_version = SCALA_VERSION,
scala_versions = SCALA_VERSIONS,
)
use_repo(
scala_config,
"io_bazel_rules_scala_config",
Expand Down
Loading

0 comments on commit 988fe51

Please sign in to comment.