rules_closure
rules_closure copied to clipboard
Create abstract closure_template_library rule
One of the nice things about Skylark is if you define multiple ctx.action
statements inside a rule, it will only run each individual action if necessary. Therefore, it is possible for us to define a closure_template_library
rule that generates the JS, Java jar, Python, etc. all at once, and the user only pays for what he needs.
But this is all dependent on whether or not we can export properties in the returned struct that Bazel will understand. I'm hoping that the correct properties will be as follows:
- Java:
compile_time_jars
,runtime_jars
- Python:
transitive_py_files
These are the properties exported by their Skylark reference implementations, e.g. py_rules.bzl. The problem is I'm not sure yet if the native rules will understand them. More research is required.
Change of plans.
Turns out proto_library
is currently being redesigned to have proto_library
be purely abstract and then feed into lang_proto_library
rules. This is because even if you don't pay for the price of a language-specific ctx.action
invocation, the combined rule still forces you to pay the price of a build graph dependency on the compiler for each language.
The Closure Template rules should be redesigned to follow this same design convention.