Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Prost/Tonic rules #479

Closed
wants to merge 1 commit into from
Closed

Add Prost/Tonic rules #479

wants to merge 1 commit into from

Commits on Nov 5, 2020

  1. Add Prost/Tonic rules

    This is still very WIP in terms of its integration with rules_rust,
    however, I wanted to put this up as a reference for those who may be
    interested in pushing it forward more.  Ideally, rules_rust would be
    updated to expose an interface similar to rules_go:
    
    https://github.com/bazelbuild/rules_go#protobuf-and-grpc
    
    That allows plugins appropriate access into build internals so that the
    generate code can be shifted by the user.  This quite necessary for
    rust, as there is no canonical rust api for protobuf/grpc;  Prost/Tonic
    is just one of them.
    
    The current rust_proto_library and rust_grpc_library are tied to
    grpc_rust and rust_protobuf crates currently, and this cannot be shifted
    with the rust_protobuf_toolchain.
    
    This PR contains a couple parts:
    
     1. Bazel rules and macros that define an external prost_library and
        tonic_library that can generate code from a proto_library target
     2. A prostgen executable that does the heavy lifting of running the
        code generation, and making sure that different prost_library
        targets can be used in different targets
     3. The cargo file with the requisite crates for prostgen
     4. A set of test cases that we had run into when using prost_library
        and tonic_library.
    
    The //proto/prostgen/raze folder doesn't quite interoperate with the
    //proto/raze folder, and I haven't had a chance to nail that down yet.
    There are also some targets missing from WORKSPACE needed for the tests.
    
    For googlers, the high-level approach is described in go/rust-protobuf.
    David Freese committed Nov 5, 2020
    Configuration menu
    Copy the full SHA
    3b6fc1e View commit details
    Browse the repository at this point in the history