Adds support for generated code being compiled by multiple rules. #3347
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 withget_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.