rules_closure icon indicating copy to clipboard operation
rules_closure copied to clipboard

Create abstract closure_template_library rule

Open jart opened this issue 8 years ago • 1 comments

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.

jart avatar May 24 '16 12:05 jart

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.

jart avatar May 27 '16 13:05 jart