@@ -168,10 +168,14 @@ v6.x:
168
168
name__ unless your ` BUILD ` files or those of your dependencies require it
169
169
(bazelbuild/rules_scala #1696 ).
170
170
171
+ Update your project's ` @io_bazel_rules_scala ` references to ` @rules_scala `
172
+ if possible. Otherwise, use ` repo_name = "io_bazel_rules_scala" ` in
173
+ ` bazel_dep() ` or ` name = "io_bazel_rules_scala" ` in ` http_archive ` .
174
+
171
175
You can use the ` repo_mapping ` attribute of ` http_archive ` or equivalent
172
- Bzlmod mechanisms to translate ` @rules_scala ` to ` @io_bazel_rules_scala `
173
- for dependencies. See the [ '@io_bazel_rules_scala_config' is now
174
- '@rules_scala_config' ] ( #map ) section below for details. (That section is
176
+ Bzlmod mechanisms to translate ` @rules_scala ` to ` @io_bazel_rules_scala ` for
177
+ dependencies. See the [ Translating repo names for
178
+ dependencies ] ( #repo-mapping ) section below for details. (That section is
175
179
about ` @rules_scala_config ` , but the same mechanisms apply.)
176
180
177
181
- __ ` rules_scala ` v7.0.0 introduces a new ` scala_toolchains() ` API that is
@@ -368,7 +372,7 @@ Please check [cross-compilation.md](docs/cross-compilation.md) for more details
368
372
## Compatible Bazel versions
369
373
370
374
Bazel compatibility is tied directly to the versions of ` protobuf ` required by
371
- Bazel and ` rules_java ` , and their compatibility with [ scalabp /ScalaPB] (
375
+ Bazel and ` rules_java ` , and their compatibility with [ scalapb /ScalaPB] (
372
376
https://github.com/scalapb/ScalaPB ) Maven artifacts. For extensive analysis,
373
377
see bazelbuild/rules_scala #1647 .
374
378
@@ -675,23 +679,18 @@ register_toolchains(
675
679
)
676
680
```
677
681
678
- ### < a id = " map " ></ a > ` @io_bazel_rules_scala_config ` is now ` @rules_scala_config `
682
+ ### ` @io_bazel_rules_scala_config ` is now ` @rules_scala_config `
679
683
680
684
Since ` @io_bazel_rules_scala ` is no longer hardcoded in ` rules_scala ` internals,
681
685
we've shortened ` @io_bazel_rules_scala_config ` to ` @rules_scala_config ` . This
682
686
shouldn't affect most users, but it may break some builds using
683
687
` @io_bazel_rules_scala_config ` to define custom [ cross-compilation targets] (
684
688
./docs/cross-compilation.md).
685
689
686
- If you can't update ` @io_bazel_rules_scala_config ` references in your own
687
- project immediately, or have dependencies that require it, use the workarounds
688
- below. (The same workarounds also apply if you need to translate ` @rules_scala `
689
- to ` @io_bazel_rules_scala ` .)
690
-
691
- #### Bzlmod
692
-
693
- You can remap ` @rules_scala_config ` via [ ` use_repo() ` ] if you need it in your
694
- own project:
690
+ If your project uses Bzlmod, you can remap ` @io_bazel_rules_scala_config ` to
691
+ ` @rules_scala_config ` for your own project via [ ` use_repo() ` ] . Use this only if
692
+ updating your project's own ` @io_bazel_rules_scala_config ` references isn't
693
+ immediately feasible.
695
694
696
695
[ `use_repo()` ] : https://bazel.build/rules/lib/globals/module#use_repo
697
696
@@ -704,8 +703,20 @@ scala_config = use_extension(
704
703
use_repo(scala_config, io_bazel_rules_scala_config = " rules_scala_config" )
705
704
```
706
705
707
- For [ ` bazel_dep() ` ] [ ] dependencies, use [ ` override_repo() ` ] [ ] to
708
- override ` @io_bazel_rules_scala_config ` with ` @rules_scala_config ` :
706
+ If your project uses ` WORKSPACE ` you _ must_ update all
707
+ ` @io_bazel_rules_scala_config ` references to ` @rules_scala_config ` . There is no
708
+ ` use_repo() ` equivalent.
709
+
710
+ #### <a id =" repo-mapping " ></a >Translating repo names for dependencies
711
+
712
+ For any dependencies referencing ` @io_bazel_rules_scala_config ` , use the workarounds
713
+ below. The same workarounds for your project's dependencies also apply to
714
+ translating ` @rules_scala ` to ` @io_bazel_rules_scala ` .
715
+
716
+ #### Bzlmod
717
+
718
+ For module extensions, use [ ` override_repo() ` ] [ ] to override
719
+ ` @io_bazel_rules_scala_config ` with ` @rules_scala_config ` :
709
720
710
721
``` py
711
722
bazel_dep(name = " foo" , version = " 1.0.0" )
@@ -714,12 +725,12 @@ foo_ext = use_extension("@foo//:ext.bzl", "foo_ext")
714
725
override_repo(foo_ext, io_bazel_rules_scala_config = " rules_scala_config" )
715
726
```
716
727
717
- [ `bazel_dep()` ] : https://bazel.build/rules/lib/globals/module#bazel_dep
718
- [ `override_repo()` ] : https://bazel.build/rules/lib/globals/ module#override_repo
719
-
720
- For [ ` archive_override ()` ] [ ] and [ ` git_override() ` ] [ ] dependencies, use the
721
- ` repo_mapping ` attribute passed through to the underlying [ ` http_archive() ` ] [ ]
722
- and [ ` git_repository() ` ] [ ] rules:
728
+ [ ` bazel_dep() ` ] [ ] dependencies may still require ` @io_bazel_rules_scala_config `
729
+ (or ` @io_bazel_rules_scala ` ) outside of a module extension. In this case, to
730
+ avoid using the old name in your own project, use [ ` archive_override() ` ] [ ] or
731
+ [ ` git_override ()` ] [ ] with the ` repo_mapping ` attribute. These overrides pass the
732
+ ` repo_mapping ` through to the underlying [ ` http_archive() ` ] [ ] and
733
+ [ ` git_repository() ` ] [ ] rules:
723
734
724
735
``` py
725
736
archive_override(
@@ -731,14 +742,16 @@ archive_override(
731
742
)
732
743
```
733
744
745
+ [ `override_repo()` ] : https://bazel.build/rules/lib/globals/module#override_repo
746
+ [ `bazel_dep()` ] : https://bazel.build/rules/lib/globals/module#bazel_dep
734
747
[ `archive_override()` ] : https://bazel.build/rules/lib/globals/module#archive_override
735
748
[ `git_override()` ] : https://bazel.build/rules/lib/globals/module#git_override
736
749
[ `http_archive()` ] : https://bazel.build/rules/lib/repo/http#http_archive-repo_mapping
737
750
[ `git_repository()` ] : https://bazel.build/rules/lib/repo/git#git_repository-repo_mapping
738
751
739
752
#### ` WORKSPACE `
740
753
741
- Use the ` repo_mapping ` attribute of [ ` http_archive() ` ] [ ] or
754
+ For dependencies, use the ` repo_mapping ` attribute of [ ` http_archive() ` ] [ ] or
742
755
[ ` git_repository() ` ] [ ] :
743
756
744
757
``` py
0 commit comments