pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.2k stars 616 forks source link

Rule-generation support code #18022

Open lilatomic opened 1 year ago

lilatomic commented 1 year ago

There are now several systems which generate rules. These rule-generators themselves have several common tasks. We have the opportunity to solve them in a consistent way.

Simple utils:

More complicated:

I think I have a path forward on the simple utils. I think the only unknown for a v1 on those is where to put them. The more complicated ones could use some discussion. I'm not sure if it'd be good to just have an increasingly large bag of helpers, and I think it might be better to work up to having a RuleGenerator parent class which can provide some of this machinery (possibly automatically)

lilatomic commented 1 year ago

"including upstream rules" might not be necessary. The case I considered was lockfile rules for python tools, where every tool registered *lockfile.rules() . I included that in the rule generators because of that. But it turns out these were already registered as part of the python backend! so that might be the correct strategy here