Skip to content
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 Bazel 7 related protobuf build failures #1620

Commits on Oct 5, 2024

  1. Fix Bazel 7 related protobuf build failures

    Related to bazelbuild#1482, bazelbuild#1618, and bazelbuild#1619. Results from the investigation
    documented at:
    
    - bazelbuild#1619 (comment)
    
    Updates `_import_paths()` in `scala_proto_aspect.bzl` to handle
    differences `ProtoInfo.proto_source_root` and `ProtoInfo.direct_sources`
    values between Bazel 6 and Bazel 7.
    
    Without this change, `_import_paths()` emits incorrect values under
    Bazel 7, causing targets containing generated `.proto` inputs to fail,
    e.g.  `//test/proto3:test_generated_proto`.
    
    See also:
    
    - Fix paths for sibling repository setup and generated .proto files
      bazelbuild/bazel@6c6c196
    
    - The docstring for `ProtoInfo.proto_source_root` in the Bazel sources:
      https://github.com/bazelbuild/bazel/blob/7.3.2/src/main/starlark/builtins_bzl/common/proto/proto_info.bzl#L155-L172
    
    - Remove incompatible_generated_protos_in_virtual_imports
      bazelbuild/bazel@3efaa32
    
    - Comment from: Generated Protos are no longer considered as
      virtual_imports in Bazel 7
      bazelbuild/bazel#21075 (comment)
    
    ---
    
    I cherrypicked this commit into bazelbuild#1618. While it fixed the
    `//test/proto3` build failure, it does _not_ fix the hanging
    scalapb_workers from the ProtoScalaPBRule aspect.
    
    I'll have to investiate further whether than hang is related to Bazel,
    rules_proto, com_google_protobuf, or some mixture thereof. Still,
    progress!
    mbland committed Oct 5, 2024
    Configuration menu
    Copy the full SHA
    463509d View commit details
    Browse the repository at this point in the history