|
1 | 1 | # Cross compilation support
|
2 | 2 |
|
3 |
| -The support for cross-compilation is currently under development. |
| 3 | +Read *Quick start* for an information on how to use cross compilation. |
| 4 | +The remaining sections contain more detailed information, useful especially for toolchain & rule developers. |
| 5 | + |
| 6 | +## Quick start |
| 7 | +`scala_config` repository rule accepts two parameters related to Scala version: |
| 8 | +* `scala_version` – a single, default version; |
| 9 | +* `scala_versions` – a list of versions to make available for use. |
| 10 | + |
| 11 | +The first one, `scala_version`, will be used as a default, but it can be overridden for specific targets for any version from the `scala_versions`. |
| 12 | + |
| 13 | +Multiple rules, such as: |
| 14 | +- [scala_library](/scala/private/rules/scala_library.bzl) |
| 15 | +- [scala_binary](/scala/private/rules/scala_binary.bzl) |
| 16 | +- [scala_repl](/scala/private/rules/scala_repl.bzl) |
| 17 | +- [scala_test](/scala/private/rules/scala_test.bzl) |
| 18 | + |
| 19 | +support such override via the `scala_version` attribute, e.g.: |
| 20 | +```starlark |
| 21 | +scala_library( |
| 22 | + name = ... |
| 23 | + ... |
| 24 | + scala_version = "2.12.18", |
| 25 | + ... |
| 26 | +) |
| 27 | +``` |
| 28 | + |
| 29 | +For this library and all its dependencies 2.12.18 compiler will be used, unless explicitly overridden again in another target. |
4 | 30 |
|
5 | 31 | ## Version configuration
|
6 | 32 |
|
@@ -84,7 +110,7 @@ scala_library(
|
84 | 110 | )
|
85 | 111 | ```
|
86 | 112 |
|
87 |
| -See complete documentation in the [scala_cross_version_select.bzl](scala/scala_cross_version_select.bzl) file |
| 113 | +See complete documentation in the [scala_cross_version_select.bzl](/scala/scala_cross_version_select.bzl) file |
88 | 114 |
|
89 | 115 | #### Manually
|
90 | 116 | An example usage of `select()` to provide custom dependency for specific Scala version:
|
@@ -180,7 +206,8 @@ We can distinguish following tiers:
|
180 | 206 | * No `target_settings` set – not migrated, will work on the default `SCALA_VERSION`; undefined behavior on other versions.
|
181 | 207 | * (all toolchains not mentioned elsewhere)
|
182 | 208 | * `target_settings` set to the `SCALA_VERSION` – not fully migrated; will work only on the default `SCALA_VERSION` and will fail the toolchain resolution on other versions.
|
183 |
| - * [the main Scala toolchain](scala/BUILD) |
184 |
| - * [Scalafmt](scala/scalafmt/BUILD) |
185 |
| - * [Scalatest](testing/testing.bzl) |
| 209 | + * (no development in progress) |
186 | 210 | * Multiple toolchain instances with `target_settings` corresponding to each of `SCALA_VERSIONS` – fully migrated; will work in cross-build setup.
|
| 211 | + * [the main Scala toolchain](/scala/BUILD) |
| 212 | + * [Scalafmt](/scala/scalafmt/BUILD) |
| 213 | + * [Scalatest](/testing/testing.bzl) |
0 commit comments