Commit Graph

9 Commits

Author SHA1 Message Date
vam 4269ce08f4 Make cc_grpc_library compatible with native proto_library and cc_proto_library rules.
This is needed to comply with bazel best practices (each proto file is first processed by proto_library: https://docs.bazel.build/versions/master/be/protocol-buffer.html#proto_library) and generally bring cc_grcp_library rule up to date with latest Bazel changes (the rule hasn't gotten much updates since 2016).

Detailed description.

Bazel has native `cc_proto_library` rule, but it does not have `cc_grpc_library`. The rule in cc_grpc_library in this repo seems like the best candidate.

This change makes possible using `cc_grpc_library` to generate on grpc library, and consume protobuf protion as dependencies. The typical `BUILD.bazel` file configuraiton now should look like the following:

```python
proto_library(
   name = "my_proto",
   srcs = ["my.proto"],
 )

cc_proto_library(
   name = "my_cc_proto",
   deps = [":my_proto"]
)

cc_grpc_library(
    name = "my_cc_grpc",
    srcs = [":my_proto"],
    deps = [":my_cc_proto"]
)
```

This allows to decouple all thre phases: proto descriptors generation (`proto_library`), protobuf messages library creation (`cc_proto_library`), grpc library creatio (`cc_grpc_library`).

Notice how `cc_grpc_library` depends on `proto_library` (as `src`) and on `cc_proto_library` (as `deps`). Currently cc_grpc_library is designed in a way that it encapsulates all of the above and directly accepts .proto files as srcs.

The previous version (before this PR) of cc_proto_library was encapsulating all of the 3 phases inside single `cc_proto_library` and also was doing it manually (without relying on the native `cc_proto_library`).

The `cc_proto_library` is kept backward-compatible with the old version.
2019-05-03 16:43:54 -07:00
Jan Tattermusch 4d5c3102a1 fix remaining license notices 2017-06-08 11:22:41 +02:00
Jan Tattermusch 7897ae9308 auto-fix most of licenses 2017-06-08 11:22:41 +02:00
Vijay Pai f74eaa6957 Fix up protobuf submodule name to match bazel expectation 2017-04-20 22:21:01 +00:00
Yang Gao 2b24d279d6 Merge pull request #9326 from yang-g/license
Add licenses to all BUILD files and missing copyright
2017-01-17 13:36:36 -08:00
Nicolas "Pixel" Noble 24263c3f7a Fixing a few items with the new Bazel BUILD system:
-) Fixing Bazel 0.4.x breakage
-) Adding helloworld BUILD examples
-) Fixing grpc++ missing files.
-) Adding helloworld example as a test for Bazel basic.
2017-01-13 02:55:13 +01:00
yang-g a2341eaed0 omg it is 2017 2017-01-11 23:01:24 -08:00
yang-g 43dc9ed3b7 Add licenses to all BUILD files and missing copyright 2017-01-11 16:05:25 -08:00
Nicolas "Pixel" Noble 799bd5efb7 Adding shim for generating C++ protos. 2016-10-21 01:54:32 +02:00