Skip to content

Conversation

@cemeceme
Copy link
Contributor

@cemeceme cemeceme commented Feb 2, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding dependency to current rule in pre_build fails. Race condition when depending on rules created in post_build.

1 participant