@@ -25,7 +25,7 @@ scala_toolchains()
25
25
scala_register_toolchains()
26
26
```
27
27
28
- ### B) Defining your own ` scala_toolchain ` requires 2 steps
28
+ ### B) Defining your own ` scala_toolchain `
29
29
30
30
#### Step 1
31
31
@@ -65,7 +65,7 @@ load("@rules_scala//scala:scala.bzl", "setup_scala_toolchain")
65
65
66
66
setup_scala_toolchain(
67
67
name = " my_toolchain" ,
68
- # configure toolchain dependecies
68
+ # configure toolchain dependencies
69
69
parser_combinators_deps = [
70
70
" @maven//:org_scala_lang_modules_scala_parser_combinators_2_12" ,
71
71
],
@@ -101,6 +101,32 @@ Register your custom toolchain:
101
101
register_toolchains(" //toolchains:my_scala_toolchain" )
102
102
```
103
103
104
+ #### Step 3 (optional)
105
+
106
+ If you use ` scala_toolchains() ` to instantiate other builtin toolchains, set
107
+ ` validate_scala_version = False ` :
108
+
109
+ ``` py
110
+ # WORKSPACE
111
+ scala_toolchains(
112
+ validate_scala_version = False ,
113
+ # ...other toolchain parameters...
114
+ )
115
+ ```
116
+
117
+ This prevents ` rules_scala ` from checking that the Scala versions specified via
118
+ ` scala_config ` match the ` scala_version ` values from
119
+ ` third_party/repositories/scala_*.bzl ` .
120
+
121
+ ` scala_toolchains() ` uses these ` scala_*.bzl ` files to instantiate dependency
122
+ JAR repositories required by the builtin toolchains. It always instantiates a
123
+ default Scala toolchain, along with its compiler JAR repositories, since [ most
124
+ users expect this behavior] [ 1633-comment ] . (As always, calling
125
+ ` register_toolchains() ` on your own toolchain in ` MODULE.bazel ` , or before
126
+ ` scala_register_toolchains() ` in ` WORKSPACE ` , overrides the builtin toolchain.)
127
+
128
+ [ 1633-comment ] : https://github.com/bazelbuild/rules_scala/pull/1633#discussion_r1834378901
129
+
104
130
## Configuration options
105
131
106
132
The following attributes apply to both ` scala_toolchain ` and
@@ -168,7 +194,7 @@ The following attributes apply to both `scala_toolchain` and
168
194
<td>
169
195
<p><code>String; optional</code></p>
170
196
<p>
171
- Enable unused dependency checking (see <a href="https://github.com/bazelbuild/rules_scala #experimental-unused-dependency-checking">Unused dependency checking</a>).
197
+ Enable unused dependency checking (see <a href="./dependency-tracking.md #experimental-unused-dependency-checking">Unused dependency checking</a>).
172
198
Possible values are: <code>off</code>, <code>warn</code> and <code>error</code>.
173
199
</p>
174
200
</td>
0 commit comments