bazel-gazelle icon indicating copy to clipboard operation
bazel-gazelle copied to clipboard

Request for comments: Subprocess plugin API

Open alexeagle opened this issue 3 years ago • 8 comments

I originally raised this on https://github.com/google/cargo-raze/issues/195 as a suggestion for how Rust generates BUILD files.

@achew22 paired with me to start on a prototype for a Gazelle plugin for a fake language called "rosetta". This plugin is configured with a binary to run, which is executed as a subprocess. We mirrored the gazelle plugin API to protobuf so that we can communicate with this subprocess over stdio. Here was our WIP

The advantage of doing this is that plugins can be written in any language. This isn't just out of vanity of course, there are APIs that a BUILD file generator may need to use. For example, to generate TypeScript projects, we need to use the typescript API which is only available in a nodejs runtime. POC in a gazelle-like nodejs tool

@jayconrod this would make development of gazelle a little trickier. You either need to generate the Go API from the protobuf one, or keep the two of them in sync. However I think it would open up the plugin ecosystem to a wider audience. For another example, for rules_python we are thinking of a basic generator written in Python.

alexeagle avatar Oct 18 '20 23:10 alexeagle