-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support for bazel 7.x
#16172
fix: support for bazel 7.x
#16172
Conversation
Fixes and closes protocolbuffers#16169 by amending the build to support the latest version of Bazel (`7.1.0`). - fix: use `to_list()[0]` for depset - fix: upgrade `rules_jvm_external` → latest - fix: upgrade `rules_kotlin` → `1.9.0`, to match `rules_jvm_external` - fix: `io_bazel_rules_kotlin` → `rules_kotlin` - fix: target for `kotlin-stdlib` - chore: re-generate maven dependency lockfile
@@ -50,10 +50,23 @@ kt_jvm_library( | |||
deps = ["//java/core"], | |||
) | |||
|
|||
java_import( | |||
name = "kotlin-stdlib-jvm", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this indirection necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessary, and I could remove it; the target changed within @com_github_jetbrains_kotlin
, and I didn't want to expose the java_import
etc functionality. I felt it was cleaner to have a single alias used in both //java/kotlin
and //java/kotlin-lite
.
But this is a matter of taste and I would defer to Google and/or other advice :)
Edit: The target should definitely not be public, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you mean the java_import
? That is necessary because the target is now a JAR file, there is no kotlin-stdlib
in that dependency anymore. Rules Kotlin was upgraded because Rules JVM was upgraded, which happened because the earlier version depends on toolchain internals which changed with Bazel 7.x.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, @haberman: maybe you didn't get these because I forgot to tag. My Mentions are where I'm usually looking.
@@ -174,7 +174,7 @@ def _osgi_jar_impl(ctx): | |||
source_jars = source_jars.to_list() | |||
if len(source_jars) > 1: | |||
fail("osgi_jar rule doesn't know how to deal with more than one source jar.") | |||
source_jar = target_java_output.source_jars[0] | |||
source_jar = target_java_output.source_jars.to_list()[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may need to rebase -- I believe this one was already fixed in 925de18
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, will do.
This seems to be failing CI tests with the following:
|
@zhangskz Ah, that surfaces because |
I think Bazel 7.x is working now. Can we close this PR? |
I think so! Thanks @haberman |
Summary
Fixes and closes #16169 by amending the build to support the latest version of Bazel (
7.1.0
). This is an alternative PR to #16171.Tested against:
7.1.0
7.0.0
6.3.2
On:
Changelog
to_list()[0]
for depsetrules_jvm_external
→ latestrules_kotlin
→1.9.0
, to matchrules_jvm_external
io_bazel_rules_kotlin
→rules_kotlin
kotlin-stdlib