Skip to content

Commit 8f255cd

Browse files
Introduce SCALA_VERSIONS (#1557)
A variable to hold all (possibly more than one in the future) configured versions of Scala. Co-authored-by: mkuta <[email protected]>
1 parent 330081d commit 8f255cd

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

cross-compilation-doc.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Cross compilation support
2+
3+
The support for cross-compilation is currently under development.
4+
5+
## Version configuration
6+
7+
`scala_config` creates the repository `@io_bazel_rules_scala_config`.
8+
File created there, `config.bzl`, consists of many variables. In particular:
9+
* `SCALA_VERSION` – representing the default Scala version, e.g. `"3.3.1"`;
10+
* `SCALA_VERSIONS` – representing all configured Scala versions (currently one), e.g. `["3.3.1"]`.

scala_config.bzl

+5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ def _validate_supported_scala_version(scala_major_version, scala_minor_version):
1111
fail("Scala version must be newer or equal to 2.12.1 to use compiler dependency tracking.")
1212

1313
def _store_config(repository_ctx):
14+
# Default version
1415
scala_version = repository_ctx.os.environ.get(
1516
"SCALA_VERSION",
1617
repository_ctx.attr.scala_version,
1718
)
1819

20+
# All versions supported
21+
scala_versions = [scala_version]
22+
1923
enable_compiler_dependency_tracking = repository_ctx.os.environ.get(
2024
"ENABLE_COMPILER_DEPENDENCY_TRACKING",
2125
str(repository_ctx.attr.enable_compiler_dependency_tracking),
@@ -29,6 +33,7 @@ def _store_config(repository_ctx):
2933

3034
config_file_content = "\n".join([
3135
"SCALA_VERSION='" + scala_version + "'",
36+
"SCALA_VERSIONS=" + str(scala_versions),
3237
"SCALA_MAJOR_VERSION='" + scala_major_version + "'",
3338
"SCALA_MINOR_VERSION='" + scala_minor_version + "'",
3439
"ENABLE_COMPILER_DEPENDENCY_TRACKING=" + enable_compiler_dependency_tracking,

0 commit comments

Comments
 (0)