rules-proto-grpc / rules_proto_grpc

Bazel rules for building Protobuf and gRPC code and libraries from proto_library targets
https://rules-proto-grpc.com
Apache License 2.0
250 stars 157 forks source link

Remove grpc sources from runfiles trees #262

Closed william-smith-skydio closed 1 year ago

william-smith-skydio commented 1 year ago

If a C++ binary uses grpc code generated with cpp_grpc_library, the resulting runfiles tree includes the generated grpc sources.

Reproducer here: https://gist.github.com/william-smith-skydio/e3b630f7cc826ad33f283b8017a88cc7

> tree bazel-bin/test.runfiles/__main__/
bazel-bin/test.runfiles/__main__/
├── grpc_test_proto_cpp_pb
│   ├── grpc_test.grpc.pb.cc -> ...
│   ├── grpc_test.grpc.pb.h -> ...
│   ├── grpc_test_mock.grpc.pb.h -> ...
│   ├── grpc_test.pb.cc -> ...
│   └── grpc_test.pb.h -> ...
└── test -> ...

With this patch applied, I get the expected behavior:

tree bazel-bin/test.runfiles
bazel-bin/test.runfiles
├── __main__
│   └── test -> ...
└── MANIFEST

This issue does not affect cpp_proto_library since that was already using the split srcs/hdrs targets.

aaliddell commented 1 year ago

Thanks