Try to demonstrate a problem with https://github.com/stackb/rules_proto - or possibly something else (including my lack of knowledge) - w.r.t. python wrappers for protobufs
bazel build //src/proto:all
fails while separately building targets with bazel query //... | xargs -n 1 bazel build
succeeds.
Issue seems to be that two targets are generating the python protobuf wrapper for the same file.
ERROR: file 'src/proto/b_pb2.py' is generated by these conflicting actions:
Label: //src/proto:b_proto
RuleClass: proto_library rule
Configuration: de2b1250788dfeca9c7ec0dbeba85f06
Mnemonic: ProtoCompile
Action key: 7e9a1878eff3415c62f50f7e698db12d, 53d25eb3e1a7c9d9533bc6d2d132d176
Progress message: ProtoCompile src/proto/b_pb2.py
PrimaryInput: File:[/home/dbakin/src/bazel-py-rule-issue[source]]src/proto/a.proto
PrimaryOutput: File:[[<execution_root>]bazel-out/k8-fastbuild/bin]src/proto/b_pb2.py
Primary outputs are different: 1971704056, 2050816446
Owner information: []#@build_stack_rules_proto//python:python_grpc_compile.bzl%python_grpc_compile_aspect[verbose_string="1"] BuildConfigurationValue.Key[de2b1250788dfeca9c7ec0dbeba85f06] //src/proto:b_proto BuildConfigurationValue.Key[de2b1250788dfeca9c7ec0dbeba85f06] false {verbose_string=[1]}, []#@build_stack_rules_proto//python:python_proto_compile.bzl%python_proto_compile_aspect[verbose_string="1"] BuildConfigurationValue.Key[de2b1250788dfeca9c7ec0dbeba85f06] //src/proto:b_proto BuildConfigurationValue.Key[de2b1250788dfeca9c7ec0dbeba85f06] false {verbose_string=[1]}
MandatoryInputs: Attempted action contains artifacts not in previous action (first 5):
external/com_github_grpc_grpc/grpc_python_plugin
Outputs: Attempted action contains artifacts not in previous action (first 5):
src/proto/b_pb2.py
src/proto/b_pb2_grpc.py
Previous action contains artifacts not in attempted action (first 5):
src/proto/b_pb2.py
ERROR: com.google.devtools.build.lib.actions.MutableActionGraph$ActionConflictException: for src/proto/b_pb2.py, previous action: action 'ProtoCompile src/proto/b_pb2.py', attempted action: action 'ProtoCompile src/proto/b_pb2.py'
INFO: Elapsed time: 6.556s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (13 packages loaded, 1848 targets configured)