Skip to content

Introduce SCALA_VERSIONS #1557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cross-compilation-doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Cross compilation support

The support for cross-compilation is currently under development.

## Version configuration

`scala_config` creates the repository `@io_bazel_rules_scala_config`.
File created there, `config.bzl`, consists of many variables. In particular:
* `SCALA_VERSION` – representing the default Scala version, e.g. `"3.3.1"`;
* `SCALA_VERSIONS` – representing all configured Scala versions (currently one), e.g. `["3.3.1"]`.
5 changes: 5 additions & 0 deletions scala_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ def _validate_supported_scala_version(scala_major_version, scala_minor_version):
fail("Scala version must be newer or equal to 2.12.1 to use compiler dependency tracking.")

def _store_config(repository_ctx):
# Default version
scala_version = repository_ctx.os.environ.get(
"SCALA_VERSION",
repository_ctx.attr.scala_version,
)

# All versions supported
scala_versions = [scala_version]

enable_compiler_dependency_tracking = repository_ctx.os.environ.get(
"ENABLE_COMPILER_DEPENDENCY_TRACKING",
str(repository_ctx.attr.enable_compiler_dependency_tracking),
Expand All @@ -29,6 +33,7 @@ def _store_config(repository_ctx):

config_file_content = "\n".join([
"SCALA_VERSION='" + scala_version + "'",
"SCALA_VERSIONS=" + str(scala_versions),
"SCALA_MAJOR_VERSION='" + scala_major_version + "'",
"SCALA_MINOR_VERSION='" + scala_minor_version + "'",
"ENABLE_COMPILER_DEPENDENCY_TRACKING=" + enable_compiler_dependency_tracking,
Expand Down