Git Product home page Git Product logo

Comments (5)

pcj avatar pcj commented on June 27, 2024

Should not be too hard to add.

from rules_protobuf.

pcj avatar pcj commented on June 27, 2024

Implemented in 84f5b46, on master. Can you confirm and close issue?

from rules_protobuf.

achew22 avatar achew22 commented on June 27, 2024

@pcj Thanks so much for taking this on, it's looking really good! Quick question and I think this might be a misunderstanding on my part.

When I run blaze build //examples/helloworld/grpc_gateway:swagger (your newly created target I get the following output:

INFO: Found 1 target...
Target //examples/helloworld/grpc_gateway:swagger up-to-date:
  bazel-bin/examples/helloworld/grpc_gateway/helloworld.swagger.json
INFO: Elapsed time: 0.166s, Critical Path: 0.00s

This output makes me think that there should be a target //examples/helloworld/grpc_gateway:helloworld.swagger.json that I can depend on in another rule. A genrule for example. However when I build //examples/helloworld/grpc_gateway:helloworld.swagger.json I get the classic error message:

ERROR: no such target '//examples/helloworld/grpc_gateway:helloworld.swagger.json': target 'helloworld.swagger.json' not declared in package 'examples/helloworld/grpc_gateway' defined by /Users/achew22/Projects/rules_protobuf/examples/helloworld/grpc_gateway/BUILD.

Am I doing something weird here? It seems like that file target should exist

from rules_protobuf.

pcj avatar pcj commented on June 27, 2024

You should be able to depend on the :swagger target directly in your genrule. This is true of all members of the *_proto_compile family, of which grpc_gateway_swagger_compile belongs.

All *_proto_library rules are actually a composition of a proto_compile rule + a library rule. So a go_proto_library rule named foo first emits a proto_compile of the form foo.pb and then depends on the output of that for a go_library rule. So if you want the compiled foo.a output, depend on :foo. If you want the generated files, depend on the implicit target foo.pb, which yields the *.pb.go files. In the case of swagger.json, there is no implicit .pb target since you are interacting with the proto_compile rule directly.

Hopefully that was not too longwinded. Curious what your genrule does... What are you feeding it into?

from rules_protobuf.

achew22 avatar achew22 commented on June 27, 2024

In the case of a swagger output there isn't a library to be consumed so that seems reasonable. My genrule, as I suspect you know, generates a swagger client library using this as the input. It seems to be working. Thanks so much for doing this. I'll look into open sourcing it. Unfortunately my ambitions are incompatible with my time constraints 😉.

Thank you so much for implementing this, it is hugely appreciated.

from rules_protobuf.

Related Issues (20)

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.