Closed tomasbasham closed 4 months ago
@tomasbasham How did you resolve this issue? I seem to be running into this and can't figure out the fix
Hi @Lumexralph. Unfortunately I didn't solve it and resorted to abandoning Buf all together in favour of managing the protobuf dependencies myself. Sorry I could not help.
Hi @Lumexralph. Unfortunately I didn't solve it and resorted to abandoning Buf all together in favour of managing the protobuf dependencies myself. Sorry I could not help.
I was able to solve it eventually using Gazelle resolve directives.
Thanks for your response.
Summary
When using
buf.dependency
dependencies don't seem to be managed correctly which causes a contradiction between the files generated bybuf-gazelle
and theBUILD.bazel
files within the dependencies, resulting in a failed build.To be honest I'm not entirely sure
rules_buf
is responsible for this particular issue. I was hoping somebody with more experience could help diagnose the problem.Bazel Version 7.1.2
To reproduce
Test repo
MODULE.bazel
BUILD.bazel
test.proto
Expected Behaviour
Running both
bazel run //:gazelle
andbuild //:organisation_service_test_v1_proto
produces aproto_libray
artefact successfully.Actual Behaviour
The dependencies downloaded and cached from the call to
buf.dependency
contain aBUILD.bazel
file with a singleproto_library
target given a name equal to the last file in the sources alphabetically.This contradicts what
buf-gazelle
expects when generatingBUILD
files. For example in this casegazelle
inserted"@buf_deps//google/api:api_proto"
(see above) but this does not exist as demonstrated below.This of course causes the build to fail.