Giter Club home page Giter Club logo

Comments (4)

pcj avatar pcj commented on June 11, 2024

The main issue is that skylark starlark rules do not allow one to "work" outside the package they are defined in. So, when you ctx.action.declare_file, any file you create must within that package, which has the downstream ramifications you observe. Without having reviewed the specific implementation of the native rules, I don't think they have this restriction.

Arguably the "best" way to accomplish proto compilation is via an aspect-based implementation (which may solve the aforementioned issue), but doing that in a generic way for multiple languages is not trivial.

In any case, I agree the paths for generated protos can get confusing and problematic.

from rules_proto.

qzmfranklin avatar qzmfranklin commented on June 11, 2024

Hi @pcj:

Thanks for the response! I researched and experimented a little bit more and reached the same point (root cause and solution) you brought up. I am happy that problem is ACK'ed and the root problem is thoroughly exposed. Will work around this issue by copying .proto files around for now.

I believe that the Bazel built-in {cc,java}_proto_library rules use an aspect-based approach. This belief came from this blog post. Though that blog post (2017/02/27) was pretty old by now (2018/12/20).

I am very interested in 'doing that (the aspect way) in a generic way for multiple languages is not trivial' you mentioned. I know it could be hard and a little far fetching, but would you like to shed more light on the difficulties that you can envision?

from rules_proto.

pcj avatar pcj commented on June 11, 2024

OK I have an initial working aspect-based implementation on the "aspect" branch. It still makes my brain hurt, and the code is in complete chaos but you're welcome to try it out.

It works well for dynamic languages like python but will make rules like cpp_proto_library implementations quite difficult.

https://github.com/stackb/rules_proto/tree/aspect

from rules_proto.

qzmfranklin avatar qzmfranklin commented on June 11, 2024

Thanks for the response. I won't have time to try it out right at the moment. But I will keep an eye on this and try to get this to work when I get some time.

Thanks for everything. Closing for now.

from rules_proto.

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.