bazelbuild / rules_scala

Scala rules for Bazel
Apache License 2.0
359 stars 266 forks source link

Introduce 'SCALA_VERSIONS' config setting #1552

Open mateuszkuta256 opened 4 months ago

mateuszkuta256 commented 4 months ago

Description

Extend scala_config repo with a scala_versions property

This is the first step for cross-compilation feature. User should be able to define multiple scala versions supported by the repository:

scala_config(
    scala_version = "3.2.1",
    scala_versions = [
        "2.13.12",
        "3.2.1",
    ],
)

the semantics will be:

This change is backward-compatible. scala_versions is optional and default to [scala_version]

This PR also registers toolchain-related repositories with a versions suffix. It is needed to avoid collisions, e.g. when 2.13.12 and 3.3.1 are set, we will register two io_bazel_rules_scala_scala_compiler: io_bazel_rules_scala_scala_compiler_2_13_12 io_bazel_rules_scala_scala_compiler_3_3_1

In the follow-up PR I'm gonna add a transition, that will select proper toolchains based on scala_version config

Motivation

Extracted from https://github.com/bazelbuild/rules_scala/pull/1546

mateuszkuta256 commented 4 months ago

I think that build fails because of a problem with CI first of all, works on my local macOs machine 😃 also noticed a difference in environment variables. For this PR: BUILDKITE_LABEL="./test_rules_scala on :ubuntu: Ubuntu 20.04 LTS" my another PR that passes, points: BUILDKITE_LABEL="./test_rules_scala on :ubuntu: 20.04 LTS (OpenJDK 11, gcc 9.4.0)"

lukaszwawrzyk commented 4 months ago

@simuons Can you take a look at this PR? As @mateuszkuta256 said, it focuses on adding a possibility to define all repositories and toolchains with variants for specified scala versions. This is a base for actually enabling crossbuild in next PRs

simuons commented 4 months ago

@mateuszkuta256 please rebase your pr to see if it passes build.

simuons commented 4 months ago

Unfortunately CI still fails with jdk 21. I'm trying to solve that first and will get back to this PR

aszady commented 4 months ago

Hi there! I will be continuing the work of @mateuszkuta256 in this (and the remaining) PRs. It seems that after recovering accidentally removed cfgs, the build passes again!