-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Given #2626, I was wondering whether it would be possible to add a pure Skylark py_proto_library built on proto_library.
I've played around with rules and had a look at how rules_go does this with toolchains (https://github.com/bazelbuild/rules_go/pull/803/files). These basically involve you maintaining an additional dependency tree (which proto_library is supposed to solve) and having your custom py_proto_library applied across this tree. The most promising approach to avoiding this seems to be to use aspects.
It's pretty clear how aspects could be used to invoke protoc to generate the _pb2.py files. What's less clear is how to use these outputs, which are unknown ahead of time and come from the proto_library transitive dep provider, in conjunction with the native py_library rule (I think this is the sandwich problem?).
Any guidance here from the Bazel proto or Python teams?