Git Product home page Git Product logo

Comments (10)

haikalpribadi avatar haikalpribadi commented on July 1, 2024

I've isolated the issue on a branch on my repo for you to reproduce it:
https://github.com/haikalpribadi/grakn/tree/bazel-init-pubref-rules-proto

You can find the BUILD file here: https://github.com/haikalpribadi/grakn/blob/bazel-init-pubref-rules-proto/protocol/proto/BUILD

Once you clone the repo, run bazel build //protocol:client-node-proto to reproduce the problem.

from rules_proto.

pcj avatar pcj commented on July 1, 2024

Ah yes the proto_source_root. I'll try to look at this shortly.

from rules_proto.

haikalpribadi avatar haikalpribadi commented on July 1, 2024

Thanks, @pcj !

from rules_proto.

pcj avatar pcj commented on July 1, 2024

Actually after looking into this issue I don't think it is related to proto_source_root. What you are looking for is a new feature that has a PR open that will allow one to modify the import prefix of proto in question.

bazelbuild/bazel#5536

from rules_proto.

haikalpribadi avatar haikalpribadi commented on July 1, 2024

There's also this issue that I opened in grpc-java at about the same time cause i wasn't sure where the cause is. Do you think this is more relevant? grpc/grpc-java#4896

from rules_proto.

pcj avatar pcj commented on July 1, 2024

Ultimately I think the problem reduces to adding additional --proto_path=B.proto=some-package/B.proto arguments to protoc.

It's fairly trivial to add that feature to all the proto_compile rules, but since we are dependent on the native proto_library rule, unless that implementation has the ability to communicate those arguments to protoc itself (since it calls protoc to generate the descriptor_set), it won't work.

Another option is to rewrite the proto_library in skylark using aspects AND conform to the same provider structure that the native rule returns. I'm a little tempted to try this.

from rules_proto.

pcj avatar pcj commented on July 1, 2024

Or, redo your protos to have a common import structure, like the googleapis repo. But for many organizations with existing build workflow constraints and dependent code, it's not practical to do this.

from rules_proto.

haikalpribadi avatar haikalpribadi commented on July 1, 2024

Well, proto_library can already handle this, by taking in proto_source_root argument. Can this be extended/used in the {lang}_grpc_compile rules?

from rules_proto.

pcj avatar pcj commented on July 1, 2024

Are you able to build the proto_library target in this case (separate from any {lang}_grpc_compile rule)?

Does bazel build //protocol:client-proto figure out the imports and compile the descriptor set correctly?

from rules_proto.

haikalpribadi avatar haikalpribadi commented on July 1, 2024

Yes, proto_library compiles correctly with proto_source_root, since Bazel 0.17.2. So "yes" to both the above questions, @pcj :)

from rules_proto.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.