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

Fix --changed-dependees to work when v1 is disabled #10235

Merged
merged 2 commits into from Jul 2, 2020

Conversation

Eric-Arellano
Copy link
Contributor

@Eric-Arellano Eric-Arellano commented Jul 2, 2020

While we were using a rule to calculate the dependees, it was using a v1 code path based on TargetAdaptor. This means that --changed-dependees caused a crash when v1 is disabled.

To land this, we refactor dependees into two helper rules so that any rule can now await Get(Dependees, DependeesRequest).

[ci skip-rust-tests]

@Eric-Arellano Eric-Arellano requested a review from benjyw July 2, 2020 03:18
# Rust tests will be skipped. Delete if not intended.
[ci skip-rust-tests]
(changed_addresses,) = session.product_request(ChangedAddresses, [changed_request])
logger.debug("changed addresses: %s", changed_addresses.addresses)
(changed_addresses,) = session.product_request(
ChangedAddresses, [Params(changed_request, options_bootstrapper)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI we must pass options_bootstrapper because dep inference requires it. We now use dep inference when considering --changed-dependees.

Comment on lines +162 to +163
map_addresses_to_dependees,
find_dependees,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is a little weird. We need the dependees.py rules to be always in the build graph because they are now always used for resolving addresses. Without this, most unit tests fail due to an incomplete rule graph.

I wasn't sure where to register the rules, among these 3 options:

  1. Move the dependees logic out of backend/project_info/dependees.py, e.g. into graph.py. Always activate from there.
  2. Export the rules from changed.py, because we already always register these rules.
  3. Directly import these two rules from engine_initializer.py.

I didn't go with #1 because I couldn't think of a good place for those two rules. It makes sense to me to have the logic for dependees in dependees.py. So, I went with #2.

Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me, and we can always change this later. Nice thing about the engine is that you don't import rules in order to use them, so moving rule code around doesn't require deprecation!

Comment on lines +162 to +163
map_addresses_to_dependees,
find_dependees,
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me, and we can always change this later. Nice thing about the engine is that you don't import rules in order to use them, so moving rule code around doesn't require deprecation!

@Eric-Arellano Eric-Arellano merged commit a5a04c5 into pantsbuild:master Jul 2, 2020
@Eric-Arellano Eric-Arellano deleted the fix-changed branch July 2, 2020 18:19
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.

None yet

2 participants