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
BSP resolve filtering observes computed default values of resolve fields #15282
BSP resolve filtering observes computed default values of resolve fields #15282
Conversation
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
TODO: This is to work around the fact that Field value defaulting cannot have arbitrary | ||
subsystem requirements, and so `JvmResolveField` and `PythonResolveField` have methods | ||
which compute the true value of the field given a subsytem argument. Consumers need to | ||
be type aware, and `@rules` cannot have dynamic requirements. | ||
|
||
See https://github.com/pantsbuild/pants/issues/12934 about potentially allowing unions | ||
(including Field registrations) to have `@rule_helper` methods, which would allow the | ||
computation of an AsyncFields to directly require a subsystem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, the urgency of this feature has bumped up quite a bit. We need the ability for a @union to represent a full interface, including async methods (@rule_helper
s).
# TODO: Workaround for https://github.com/python/mypy/issues/5485, because we cannot directly use | ||
# a Callable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unrelated workaround, but it definitely adds insult to injury.
The underlying issue causing us not to have any metadata to merge in #15201 was that the targets in the example were using the default resolve, and the resolve filtering from #15064 was not accounting for default values.
This fixes resolve filtering by adding another union which returns a type which can compute the resolve Field value (using a subsystem in this case).