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

BSP resolve filtering observes computed default values of resolve fields #15282

Merged
merged 2 commits into from Apr 29, 2022

Conversation

stuhood
Copy link
Sponsor Member

@stuhood stuhood commented Apr 29, 2022

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).

# 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]
# 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]
Comment on lines +65 to +72
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.
Copy link
Sponsor Member Author

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_helpers).

Comment on lines +78 to +79
# TODO: Workaround for https://github.com/python/mypy/issues/5485, because we cannot directly use
# a Callable.
Copy link
Sponsor Member Author

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.

@stuhood stuhood enabled auto-merge (squash) April 29, 2022 19:36
@stuhood stuhood merged commit bd0b9c8 into pantsbuild:main Apr 29, 2022
stuhood added a commit that referenced this pull request Apr 29, 2022
Fixes #15201. The actual cause of the empty list in this case was #15282.

[ci skip-rust]
[ci skip-build-wheels]
@stuhood stuhood deleted the stuhood/bsp-resolve-filter-default branch April 29, 2022 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:bugfix Bug fixes for released features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants