Skip to content

Commit

Permalink
[29.x] Add missing java load (#19016)
Browse files Browse the repository at this point in the history
* Add missing java load

For most _native_ loads of Java rules (e.g. java_library), these can be automatically handled by Bazel 8's autoload feature.

However, this is not the case when the main repository (IOW, the repository currently being built) is a rule repo itself. In those cases, module dependencies are not automatically loaded.

This PR fixes a compatibility issue of OSS protobuf Bazel rules with other Bazel rule repositories such as bazelbuild/rules_android.

Without this PR, builds within rules repositories with Bazel 8 will fail like so:

```
external/protobuf+/java/core/BUILD.bazel:142:13: @@protobuf+//java/core:lite: no such attribute 'srcs' in 'java_library' rule
```

PiperOrigin-RevId: 690735533

* Dummy commit to force CI re-trigger
  • Loading branch information
ted-xie authored Oct 29, 2024
1 parent 63d966b commit bb287be
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions java/core/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:java_library.bzl", "java_library")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("//:protobuf.bzl", "internal_gen_well_known_protos_java")
load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION")
Expand Down Expand Up @@ -705,3 +706,4 @@ pkg_files(
strip_prefix = strip_prefix.from_root(""),
visibility = ["//java:__pkg__"],
)

0 comments on commit bb287be

Please sign in to comment.