Commit a9d16f4
committed
Move
Ensures we get all the versions of dependencies we want in `WORKSPACE`,
while providing a new API to consumers. Part of bazel-contrib#1652.
Bumps several packages as high as they can go and still be compatible
with Bazel 6 and 7:
- `bazel_skylib`: 1.4.1 => 1.7.1
- `rules_cc`: 0.0.6 => 0.0.9
- `rules_python`: 0.36.0 => 0.38.0
- `rules_go`: 0.50.1
The following packages are at the maximum version to prevent breakages
under Bazel 6.5.0.
---
`abseil-cpp` and `protobuf` have to stay at 20220623.1 and v27.1,
respectively, for Bazel 6 compatibility per bazel-contrib#1647. `protobuf` up to
v25.5 is compatible with Bazel 6 provided users set the compiler flags
mentioned in that issue.
---
`rules_python` 0.38.0 => 0.39.0 requires at least `rules_cc` 0.0.10,
which introduced `cc/common/cc_info.bzl`:
```txt
$ bazel build //{src,test,third_party,scala_proto}/...
[ ...snip... ]
ERROR: error loading package under directory 'test':
error loading package 'test':
at .../external/rules_python/python/defs.bzl:17:6:
at .../external/rules_python/python/py_binary.bzl:18:6:
at .../external/rules_python/python/private/py_binary_macro.bzl:16:6:
at .../external/rules_python/python/private/common_bazel.bzl:19:6:
Label '@rules_cc//cc/common:cc_info.bzl' is invalid
because 'cc/common' is not a package;
perhaps you meant to put the colon here:
'@rules_cc//cc:common/cc_info.bzl'?
```
---
`rules_cc` 0.0.9 => 0.0.10 requires Bazel 7, which defines
`CcSharedLibraryHintInfo`:
```txt
$ bazel build //{src,test,third_party,scala_proto}/...
ERROR: .../external/rules_cc/cc/private/rules_impl/native.bzl:40:33:
name 'CcSharedLibraryHintInfo' is not defined (did you mean
'CcSharedLibraryInfo'?)
[ ...snip... ]
ERROR: error loading package under directory 'test':
error loading package 'test':
at .../external/rules_python/python/defs.bzl:17:6:
at .../external/rules_python/python/py_binary.bzl:18:6:
at .../external/rules_python/python/private/py_binary_macro.bzl:16:6:
at .../external/rules_python/python/private/common_bazel.bzl:18:6:
at .../external/rules_cc/cc/common/cc_common.bzl:17:6:
compilation of module 'cc/private/rules_impl/native.bzl' failed
```
---
`rules_java` remains at 7.9.0 due to the more complicated situation it
presents. The current version that could be compatible with Bazel 6 and
7 is 7.12.2.
As it turns out, we could include `rules_java` versions up to and
including 7.12.2 if we don't call the following in `WORKSPACE`:
```py
load("@rules_java//java:repositories.bzl", "rules_java_dependencies",
"rules_java_toolchains")
rules_java_dependencies()
rules_java_toolchains()
```
In fact, __we don't do that today__. When we do, Bazel 7.4.1 builds
successfully, but Bazel 6.5.2 fails with:
```txt
$ bazel build //{src,test,third_party,scala_proto}/...
ERROR:
.../external/rules_java/toolchains/java_toolchain_alias.bzl:83:34:
Use of Starlark transition without allowlist attribute
'_allowlist_function_transition'.
See Starlark transitions documentation for details and usage:
@rules_java//toolchains:java_toolchain_alias.bzl NORMAL
ERROR:
.../src/java/io/bazel/rulesscala/coverage/instrumenter/BUILD:3:12:
While resolving toolchains for target
//src/java/io/bazel/rulesscala/coverage/instrumenter:instrumenter:
invalid registered toolchain '//toolchains:all':
while parsing '//toolchains:all':
error loading package '@rules_java//toolchains':
initialization of module 'toolchains/java_toolchain_alias.bzl' failed
ERROR: Analysis of target
'//src/java/io/bazel/rulesscala/coverage/instrumenter:instrumenter'
failed; build aborted:
```
When we bump to rules_java 7.10.0, which contains
bazelbuild/rules_java#210, Bazel 7.4.1 fails
with:
```txt
$ bazel build //{src,test,third_party,scala_proto}/...
ERROR: .../external/rules_java_builtin/toolchains/BUILD:254:14:
While resolving toolchains for target
@@rules_java_builtin//toolchains:platformclasspath (096dcc8):
No matching toolchains found for types
@@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type.
To debug, rerun with
--toolchain_resolution_debug='@@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type'
If platforms or toolchains are a new concept for you, we'd encourage
reading https://bazel.build/concepts/platforms-intro.
ERROR: Analysis of target '//test/toolchains:java21_toolchain' failed;
build aborted: Analysis failed
```
This is the error I described in bazel-contrib#1619, under "Bump to rules_java 7.9.0
for Bazel 7 compatibility" in the message for
commit cd22d88.
Today I rediscovered:
- bazelbuild/rules_java: Regression with
@@rules_java//toolchains:bootstrap_runtime_toolchain_type in 7.10.0
bazelbuild/rules_java#214
But even worse, Bazel 6.5.0 fails with:
```txt
$ bazel build //{src,test,third_party,scala_proto}/...
[ ...snip... ]
ERROR: .../test/src/main/resources/java_sources/BUILD:5:14:
Building test/src/main/resources/java_sources/CompiledWithJava8_java.jar
(1 source file) failed: Worker process did not return a WorkResponse:
---8<---8<--- Start of log, file at .../bazel-workers/multiplex-worker-18-Javac.log ---8<---8<---
Error thrown by worker thread, shutting down worker.
java.lang.NoSuchMethodError:
'java.lang.Iterable
com.google.devtools.build.buildjar.javac.BlazeJavacMain$ClassloaderMaskingFileManager.getJavaFileObjectsFromPaths(java.util.Collection)'
at com.google.devtools.build.buildjar.javac.BlazeJavacMain.compile(BlazeJavacMain.java:142)
at com.google.devtools.build.buildjar.ReducedClasspathJavaLibraryBuilder.compileSources(ReducedClasspathJavaLibraryBuilder.java:57)
at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder.compileJavaLibrary(SimpleJavaLibraryBuilder.java:110)
at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder.run(SimpleJavaLibraryBuilder.java:118)
at com.google.devtools.build.buildjar.BazelJavaBuilder.build(BazelJavaBuilder.java:111)
at com.google.devtools.build.buildjar.BazelJavaBuilder.parseAndBuild(BazelJavaBuilder.java:91)
at com.google.devtools.build.buildjar.BazelJavaBuilder.lambda$main$0(BazelJavaBuilder.java:52)
at com.google.devtools.build.lib.worker.WorkRequestHandler$WorkRequestCallback.apply(WorkRequestHandler.java:252)
at com.google.devtools.build.lib.worker.WorkRequestHandler.respondToRequest(WorkRequestHandler.java:480)
at com.google.devtools.build.lib.worker.WorkRequestHandler.lambda$startResponseThread$1(WorkRequestHandler.java:433)
at java.base/java.lang.Thread.run(Thread.java:829)
---8<---8<--- End of log ---8<---8<---
ERROR: .../test/src/main/resources/java_sources/BUILD:11:14:
Building test/src/main/resources/java_sources/CompiledWithJava11_java.jar
(1 source file) failed: Worker process did not return a WorkResponse:
---8<---8<--- Start of log, file at .../bazel-workers/multiplex-worker-18-Javac.log ---8<---8<---
Error thrown by worker thread, shutting down worker.
java.lang.NoSuchMethodError:
'java.lang.Iterable
com.google.devtools.build.buildjar.javac.BlazeJavacMain$ClassloaderMaskingFileManager.getJavaFileObjectsFromPaths(java.util.Collection)'
at com.google.devtools.build.buildjar.javac.BlazeJavacMain.compile(BlazeJavacMain.java:142)
at com.google.devtools.build.buildjar.ReducedClasspathJavaLibraryBuilder.compileSources(ReducedClasspathJavaLibraryBuilder.java:57)
at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder.compileJavaLibrary(SimpleJavaLibraryBuilder.java:110)
at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder.run(SimpleJavaLibraryBuilder.java:118)
at com.google.devtools.build.buildjar.BazelJavaBuilder.build(BazelJavaBuilder.java:111)
at com.google.devtools.build.buildjar.BazelJavaBuilder.parseAndBuild(BazelJavaBuilder.java:91)
at com.google.devtools.build.buildjar.BazelJavaBuilder.lambda$main$0(BazelJavaBuilder.java:52)
at com.google.devtools.build.lib.worker.WorkRequestHandler$WorkRequestCallback.apply(WorkRequestHandler.java:252)
at com.google.devtools.build.lib.worker.WorkRequestHandler.respondToRequest(WorkRequestHandler.java:480)
at com.google.devtools.build.lib.worker.WorkRequestHandler.lambda$startResponseThread$1(WorkRequestHandler.java:433)
at java.base/java.lang.Thread.run(Thread.java:829)
---8<---8<--- End of log ---8<---8<---
```
In bazel-contrib#1619, I thought we wanted to keep `@bazel_tools//tools/jdk:` as the
canonical Java toolchains package, instead of
`@rules_java//toolchains:`. But based on this comment from @fmeum, I'm
inclined to believe switching to `@rules_java//toolchains:` actually is
the preferred, futureproof approach:
- bazelbuild/rules_java#214 (comment)
---
Bazel 8 requires `rules_java` 8, per bazel-contrib#1652. We can't update to
`rules_java` 8 right now, unless we decided to do the following:
- Tell Bazel 6 users to add C++ compiler flags to support the newer
`abseil-cpp` versions required by newer `protobuf` versions.
- Abandon Bazel 6 support in favor of supporting Bazel 7 at a minimum.
- In addition to either of the above cases, update ScalaPB to
1.0.0-alpha.1 or higher to support `protobuf` v28.
Here are the details explaining why `rules_java` 8 currently breaks.
`rules_java` 8.0.0 requires Bazel >= 7.3.2, which provides the `subrule`
API. Compatibility with Bazel >= 6.3.0 isn't restored until `rules_java`
8.3.2.
```txt
$ bazel build //{src,test,third_party,scala_proto}/...
ERROR:
.../external/rules_java/java/common/rules/android_lint.bzl:142:24:
name 'subrule' is not defined (did you mean 'rule'?)
ERROR: Error computing the main repository mapping:
at .../scala/private/extensions/dev_deps.bzl:8:6:
at .../external/rules_java/java/repositories.bzl:20:6:
at .../external/rules_java/toolchains/local_java_repository.bzl:17:6:
at .../external/rules_java/java/defs.bzl:18:6:
at .../external/rules_java/java/java_library.bzl:16:6:
at .../external/rules_java/java/bazel/rules/bazel_java_library.bzl:21:6:
compilation of module 'java/common/rules/android_lint.bzl' failed
```
`rules_java` 8.3.0 is broken, as it can't find its own
`@compatibility_proxy` repo:
```txt
$ bazel build //{src,test,third_party,scala_proto}/...
ERROR: error loading package under directory 'src':
error loading package 'src/protobuf/io/bazel/rules_scala':
at .../external/rules_java/java/defs.bzl:22:6:
at .../external/rules_java/java/java_test.bzl:16:6:
Unable to find package for @compatibility_proxy//:proxy.bzl:
The repository '@compatibility_proxy' could not be resolved:
Repository '@compatibility_proxy' is not defined.
```
`rules_java` 8.3.1 seems to fix this, presumably by importing the
`protobuf` repo as `com_google_protobuf`. However, it now requires at
least `protobuf` v27.0, which adds `bazel/java/lite_proto_library.bzl`.
Per bazel-contrib#1647, we'd have to update to ScalaPB 1.0.0-alpha.1 to support
`protobuf` v28, abandoning users of previous `protobuf` versions or
forcing them to upgrade.
```txt
$ bazel build //{src,test,third_party,scala_proto}/...
[...snip...]
ERROR: error loading package under directory 'src':
error loading package 'src/java/io/bazel/rulesscala/worker':
at .../external/rules_java/java/defs.bzl:16:6:
Label '@com_google_protobuf//bazel:java_lite_proto_library.bzl'
is invalid because 'bazel' is not a package;
perhaps you meant to put the colon here:
'@com_google_protobuf//:bazel/java_lite_proto_library.bzl'?
```rules_scala_dependencies to scala/deps.bzl1 parent 9c2cb85 commit a9d16f4
File tree
3 files changed
+86
-86
lines changed- scala
- private/macros
3 files changed
+86
-86
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 6 | + | |
13 | 7 | | |
14 | 8 | | |
15 | 9 | | |
16 | 10 | | |
17 | 11 | | |
18 | 12 | | |
19 | 13 | | |
20 | | - | |
21 | | - | |
22 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
23 | 17 | | |
24 | 18 | | |
25 | 19 | | |
26 | 20 | | |
27 | 21 | | |
28 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
| |||
49 | 59 | | |
50 | 60 | | |
51 | 61 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | 62 | | |
69 | 63 | | |
70 | 64 | | |
| |||
109 | 103 | | |
110 | 104 | | |
111 | 105 | | |
112 | | - | |
| 106 | + | |
113 | 107 | | |
114 | | - | |
115 | | - | |
| 108 | + | |
| 109 | + | |
116 | 110 | | |
117 | 111 | | |
118 | 112 | | |
| |||
124 | 118 | | |
125 | 119 | | |
126 | 120 | | |
127 | | - | |
| 121 | + | |
128 | 122 | | |
129 | 123 | | |
130 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | 121 | | |
174 | 122 | | |
175 | 123 | | |
| |||
188 | 136 | | |
189 | 137 | | |
190 | 138 | | |
191 | | - | |
| 139 | + | |
192 | 140 | | |
193 | 141 | | |
194 | 142 | | |
| |||
260 | 208 | | |
261 | 209 | | |
262 | 210 | | |
263 | | - | |
| 211 | + | |
264 | 212 | | |
265 | 213 | | |
266 | 214 | | |
| |||
0 commit comments