Open ted-xie opened 6 months ago
I looked into this and the root cause is that:
ProtoInfo.proto_source_root
is "external/maybe_rules_go_proto_bug~"
and the path of the proto is "external/maybe_rules_go_proto_bug~/proto/foo.proto"
ProtoInfo.proto_source_root
is ""
and the path of the proto is "../maybe_rules_go_proto_bug~/proto/foo.proto"
This looks like a bug in ProtoInfo
, probably in this line
https://github.com/bazelbuild/bazel/blob/3a1b336ec8250547651f6c148f79ba1ced2448f2/src/main/starlark/builtins_bzl/common/proto/proto_info.bzl#L122
/cc @comius
Just chiming in to say I got bitten by this today and that I wasn't able to find an obvious workaround on the rules_go
side :/. It appears that the mentioning PR #3966 which seems to reorder the WORKSPACE
to change which rules_proto
wins and force an 6.0.0 upgrade isn't actually a fix. After applying the same upgrade I'm seeing the same behavior on Bazel 7.0.
I can't quite follow how this is supposed to be behaving but if folks can provide pointers I'd be happy to take a crack at fixing this since it has other knock-on consequences for us.
Specifically we encountered this in the buildozer build; sample sandbox error below.
What version of rules_go are you using?
0.48. The issue also reproduces at commit 354a98f4acf2333b7603ede50dd5fbc20ae315b1.
What version of gazelle are you using?
N/A
What version of Bazel are you using?
7.1.2
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
Debian-based Linux variant, x86_64 architecture.
Any other potentially useful information about your toolchain?
N/A
What did you do?
See repro at https://github.com/ted-xie/rules_go_proto_bug. TL;DR building a go_proto_library rule that's part of an external dependency with
--experimental_sibling_repository_layout
fails. Failure message:What did you expect to see?
I expected the build to succeed.
What did you see instead?
The build fails due to the go proto compiler not being able to find the proto definition.
/cc @ahumesky