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.
This helps unblock the resolution of #1482 to add Bzlmod support, by removing an obstacle to updating to Bazel 7. I decided not to include this in #1619 to give this subtle, substantial issue the focused attention it deserves. Either PR can go in first, but both must go in before updating to Bazel 7.
Description
Fixes protobuf related build failures under Bazel 7, while remaining compatible with Bazel 6.
Related to #1482, #1618, and #1619. Results from the investigation documented at:
Updates
_import_paths()
inscala_proto_aspect.bzl
to handle differencesProtoInfo.proto_source_root
andProtoInfo.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 https://github.com/bazelbuild/bazel/commit/6c6c196ceffe14c9cf29960ef4049469df73d991
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-L172Remove incompatible_generated_protos_in_virtual_imports https://github.com/bazelbuild/bazel/commit/3efaa325a1e142831744e8a021c4d25e1c6869f2
Comment from: Generated Protos are no longer considered as virtual_imports in Bazel 7 https://github.com/bazelbuild/bazel/issues/21075#issuecomment-1914040169
Motivation
This helps unblock the resolution of #1482 to add Bzlmod support, by removing an obstacle to updating to Bazel 7. I decided not to include this in #1619 to give this subtle, substantial issue the focused attention it deserves. Either PR can go in first, but both must go in before updating to Bazel 7.
cc: @BillyAutrey @jayconrod @benjaminp @TheGrizzlyDev