bazelbuild / rules_scala

Scala rules for Bazel
Apache License 2.0
363 stars 275 forks source link

Use version-aware naming for artifact repositories #1573

Closed aszady closed 4 months ago

aszady commented 5 months ago

Description

It enables the logic implemented in #1562. The choice of toolchains to cover is the same as in #1566.

Now, e.g., instead of referring to the artifact's repository @io_bazel_rules_scala_scala_compiler, we ~need to~ may use the version-aware name, like @io_bazel_rules_scala_scala_compiler_3_3_0.

In future this may require an update in client's code. In particular in cases they don't use the default toolchains provided by the rules, and construct their own dependency providers. One would need to manually add the version suffix to the repository names, or use a construction like + version_suffix(SCALA_VERSION) in their code.

For now a backward compatibility layer is provided in a shape of repository with aliases, pointing to artifacts for the default Scala version.

Motivation

1290

aszady commented 5 months ago

Added. Out of possible solutions, two aliases worked the best for me. I also tried sth like using scala_library with single dependency, though it didn't work well with dependency checker (suggesting unused dependency). @simuons, please take a look at the revised version.

Now this PR consists of three commits:

  1. Preparation: add alias repo for backward compatibility.
  2. Do the actual change (this state demonstrates that aliases work).
  3. Cleanup: migrate all the internal rules' deps to suffixed repos.

Do you prefer to have them merged together or separately?