please icon indicating copy to clipboard operation
please copied to clipboard

Adds support for generated code being compiled by multiple rules.

Open cemeceme opened this issue 10 months ago • 0 comments

Fixes #3318, fixes #3168

Currently, if a rule creates multiple outputs that are not known at initial run, there is no way to have please generate the required rules in a pre or post build step.

This pull request adds two mechanisms to handle that: 1.) Rules builds and waits for new dependencies that get added in pre and post build steps. 2.) Adds a way to define single outputs from rules.

The second point works similar to the way that named outputs work. Using the character + followed by the output, it is now possible to select only that output from a rule. In practice, this is only meant to be used in conjunction with get_outs(). I only chose + due to its similarity for |, and of course this can be adjusted to any other separator if needed.

For an example of how to use this, I have written a custom implementation of the cc-rules, that rely on this feature. See this section for how the rules are generated.

Also note that as @peterebden stated in #3318, if a build depends on runtime generated rules, it keep hold of its build runner until the dependencies finish building. However, the fact that multiple threads can work on a potentially large number of generated files still means that build times can be sped up significantly as-is.

cemeceme avatar Feb 02 '25 17:02 cemeceme