Depfiles for custom rules #26689
-
In bazel, AFAIK there is native support for C/C++ compilers to produce depfiles (using the Is there a similar mechanism available for custom rules? In particular, our project has multiple code-generator tools that parse C++ header files. Some examples:
Each of these tools can be quite expensive to run (at least in our environment). Given that they process header files, the inputs to It is impractical to attempt a reduction in inputs, especially since examination of the files is unavailable during the analysis phase (for good reason). It would be (very) advantageous in our situation to be able to limit the actual dependencies to the files that actually get used. The depfile mechanism seems like a natural fit, and (IMO) would be a most welcome addition here if it doesn't already exist. Are there alternatives I may not be aware of? Please help educate me if my understanding doesn't match yours. One crazy thought that comes to mind... might it be possible to "pretend" that the above are indeed C/C++ compilers, and somehow create C/C++ toolchains that use them? Would this maybe trigger the depfiles mechanism? (this feels to me like a bit of a hack, but I'm open to any ideas that might help here). Thanks for your time and attention. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You could implement your own parsing of dep files and then use the |
Beta Was this translation helpful? Give feedback.
You could implement your own parsing of dep files and then use the
unused_inputs_list
feature ofctx.actions.run
to communicate the unused inputs to Bazel.