-
Notifications
You must be signed in to change notification settings - Fork 383
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
native.sh_binary reference in def.bzl blocks Bazel 8 integration #1959
Comments
Happy to merge the PR, but the breakage is unexpected and certainly not intended for Bazel 8. Are you perhaps using gazelle from a repo that happens to provide auto loaded starlark rules, e.g. rules_android? That would explain this. |
I am building rules_android, but I saw this error even without enabling the autoloaded rules -- it seems that simply using the Bazel 8.0.0rc1 with a repo that does something like |
Could you check whether this repros from other repos (not called "rules_android") too? |
I am seeing this in tests for bazel_skylib_gazelle_plugin: https://buildkite.com/bazel/bazel-skylib/builds/3522#0192b626-0c02-41d7-b2cf-ecd98915abe1 |
I tried to reproduce this in a project that isn't special-cased by Bazel, but failed to do so. Could you share a reproducer? I certainly agree that we should migrate all usages of |
@fmeum - I suspect that the failure occurs only if the module is a transitive dep of rules_shell itself (Bazel 8 can't insert a definition of native.sh_binary from rules_shell whilst in the process of loading rules_shell). The example that concerns me is bazel_skylib - it's a dependency of rules_shell, and in turn has (when building from a git checkout, as opposed to a stable release from bcr) a dev-only transitive dep on gazelle. To reproduce: git clone https://github.com/bazelbuild/bazel-skylib.git
cd bazel-skylib
git checkout 6edf03b1954900034ca2d85d6bf381da6663a575 # current main HEAD
USE_BAZEL_VERSION=last_green bazelisk build --nobuild //... Expected:
Actual result:
As a workaround, we could cut the dev-only dependency - at the expense of inconveniencing skylib maintainers and making it impossible to test dev versions of bazel_skylib_gazelle_plugin and bazel_skylib against each other... |
@fmeum I finally got around to making a reproducer. It's not specifically for Gazelle; it's for rules_java. However, it illustrates the issues of autoloads with Bazel 8 inside of special-cased main modules (for instance, rules_android). https://github.com/ted-xie/autoloads_with_dummy_rules_android |
I ran into this in rules_python with Bazel 8, too. |
I'm working on a release that will fix this, but there are some unrelated issues that make this a bit more difficult. |
FYI: I patched in the core changes from df259ce and rules_python seems to be happy. |
**What type of PR is this?** Bug fix **What package or component does this PR mostly affect?** all **What does this PR do? Why is it needed?** Adds an explicit load (and dep) for sh_binary, which is no longer packaged inside Bazel 8. This is backwards-compatible with Bazel 7. **Which issues(s) does this PR fix?** Fixes #1959 **Other notes for review** --------- Co-authored-by: Fabian Meumertzheim <[email protected]>
Various changes to support Bazel 8. An important note is dependencies have forced us to change the versions of Bazel we support. Summary of changes: * rules_cc 0.0.14: Releases after 0.0.9 have some Bazel 8 fixes, but also broke some things. Things seemed to have settled by 0.0.14. * protobuf 29.0-rc1: Technically 28.0 works, however: 1. 29.0-rc1 is coming via a transitive dependency anyways, and 2. In protobuf 28.0, compile warnings are treated as errors, which our Debian CI respects (and thus fails), while other platforms ignore. * stardoc 0.7.1: Fixes an issue with Bazel 8 and stardoc using empty globs. * Bazel 7.4 is now the minimum supported Bazel version. This requirements comes via dependencies. * Drop Bazel 6 bzlmod support. This requirement comes via dependencies. * Add a presubmit job for `last_rc` Bazel (currently the 8.x RC). * Use a local patch so Gazelle works with Bazel 8. This can be removed once bazel-contrib/bazel-gazelle#1959 is fixed and released. * Fix a `$(rpathlocation)` call in bootstrap tests. * Update bzl_library deps after upgrading deps: the set of targets that provide bzl sources changed in rules_cc and protobuf in these newer versions. Sorting this all out and finding the right combination of dependency versions was fairly involved. The details of that are in #2378. Work towards #2378, #2387
What version of gazelle are you using?
0.39.1
What version of rules_go are you using?
0.50.1
What version of Bazel are you using?
last_green (sort of 8.0)
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
Debian-like Linux, x86_64.
What did you do?
Build any dep with a gazelle reference using Bazel 8/last_green.
What did you expect to see?
Analysis success.
What did you see instead?
Bazel complains about missing native.sh_binary.
The text was updated successfully, but these errors were encountered: