bazel: Bazel 8.0.0rc2: autoload does not work with WORKSPACE repos
Description of the bug:
Testing Bazel 8.0.0rc2 I got such an error:
$ bazel build //...
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 94b17434-9dc8-4f06-8612-54cdc65e5c92
WARNING: WORKSPACE support will be removed in Bazel 9 (late 2025), please migrate to Bzlmod, see https://bazel.build/external/migration.
WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'protobuf' found. This will result in a failure if there's a reference to those rules or symbols.
WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_android' found. This will result in a failure if there's a reference to those rules or symbols.
WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_java' found. This will result in a failure if there's a reference to those rules or symbols.
WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_python' found. This will result in a failure if there's a reference to those rules or symbols.
WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_shell' found. This will result in a failure if there's a reference to those rules or symbols.
ERROR: /home/user/opt/bazel-scala-example/example-lib/BUILD:13:13: //example-lib:hello-world: no such attribute 'srcs' in 'java_library' rule
ERROR: /home/user/opt/bazel-scala-example/example-lib/BUILD:18:10: //example-lib:java_test: no such attribute 'test_class' in 'java_test' rule
ERROR: /home/user/opt/bazel-scala-example/example-lib/BUILD:18:10: //example-lib:java_test: no such attribute 'srcs' in 'java_test' rule
ERROR: /home/user/opt/bazel-scala-example/example-lib/BUILD:18:10: //example-lib:java_test: no such attribute 'deps' in 'java_test' rule
ERROR: package contains errors: example-lib
ERROR: package contains errors: example-lib: //example-lib:hello-world: no such attribute 'srcs' in 'java_library' rule
WARNING: Target pattern parsing failed.
ERROR: Skipping '//...': Error evaluating '//...': error loading package 'example-lib': Package 'example-lib' contains errors
ERROR: Error evaluating '//...': error loading package 'example-lib': Package 'example-lib' contains errors
INFO: Elapsed time: 2.845s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
This worked with Bazel 7.3.2.
Which category does this issue belong to?
No response
What’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Reproduction: https://github.com/gergelyfabian/bazel-scala-example/tree/bazel-8.0.0rc1
Simply run bazel build //... in this repo at branch bazel-8.0.0rc1
Which operating system are you running Bazel on?
Ubuntu 24.04
What is the output of bazel info release?
release 8.0.0rc2
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What’s the output of git remote get-url origin; git rev-parse HEAD ?
git@github.com:gergelyfabian/bazel-scala-example.git
b44d1811b34b69e28c30f99ec4b92c04b1ca93a5
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 18 (8 by maintainers)
Just use the latest commit from https://github.com/bazelbuild/bazel/commits/release-8.0.0/
export USE_BAZEL_VERSION=d966638807f64cfa71ef0b16d6595a211f097f87@bazel-io fork 8.0.0
@gergelyfabian I’ve just posted my experimental results to bazelbuild/rules_scala#1652. Most of the Bazel 8 and rules_java 8 incompatibilities can be easily addressed once Bzlmodification lands, and what I think is the only remaining one may be resolved by a
protobuf-java:4.29.0release (without-RC2).The tradeoffs are that users will be forced to upgrade to Protobuf v28.3 under Bazel 6 and 7, and Protobuf v29 under Bazel 8, and the
load("@rules_java")statements required by Bazel 8 will breakWORKSPACEusers for good. Then again, that may be all the more reason to suggest folks migrate to Bzlmod sooner than later.Update from bazelbuld/rules_scala#1652: I spoke too soon: I can get a
WORKSPACEbuild to userules_java8.5.1 and the other updated repo versions, and get to the point where it reaches theDetected mismatched Protobuf Gencode/Runtime version suffixeserror.So it seems we could bump
rules_scalato Bazel 8 andrules_java8 without abandoningWORKSPACE, but we will abandon Bazel 6 and 7 at that point.Thanks for the confirmation, we’ll have rc3 hopefully today.