Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding dependency to current rule in pre_build fails. #3318

Open
cemeceme opened this issue Dec 15, 2024 · 1 comment
Open

Adding dependency to current rule in pre_build fails. #3318

cemeceme opened this issue Dec 15, 2024 · 1 comment

Comments

@cemeceme
Copy link
Contributor

If a dependency is added within a pre_build function of the current rule, then please doesn't wait for the new dependency to be built before proceeding.
However, running please a second time, with the dependency now cached, works fine.

This is a similar issue as #3168, since please misses some blocking functionality within the buildTarget function for pre and post build calls for cases where dependencies may change.

Ideally, adding new dependencies to the current rule should be permissible in pre_build, since there are cases where the sources are not fully known until build time.
Specifically, this is something I noticed when using please to generate code that is then compiled in a separate rule. In that case, the cc-rules for instance, will only use a single build step to compile a potentially large number of sources, running on a single thread. Instead, it should be possible to go through the sources in a pre_build rule, to generate rules according to the actual files input.

@peterebden
Copy link
Member

I don't think this is intended to work at present. I thought we checked for this but I guess apparently not. Basically it runs the pre-build function at the point it's about to build a target - at that point it isn't expecting to back off and build something else. Conceptually it could be made to do that but I don't think that's extremely easy - e.g. the building target currently is taking up one of the build workers, it really needs to release that if it's going to wait for another thing to build, but I don't think there's a good way of handling that right now.

I see the point with the generated code situation - I've observed that before too, and it would be nice if this were possible.

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

No branches or pull requests

2 participants