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

Add support for PrunePackageReference in the new resolver #6142

Merged
merged 3 commits into from
Dec 20, 2024

Conversation

nkolev92
Copy link
Member

@nkolev92 nkolev92 commented Nov 12, 2024

Bug

Fixes: NuGet/Home#7344

Description

For reference, the design is at https://github.com/NuGet/Home/blob/dev/accepted/2024/prune-package-reference.md
This PR implements the full scope of the pruning in the new resolver.
Primary functions are not downloading and skipping packages to be pruned, and not representing them as dependencies in the targets section of the framework they were skipped for.
This PR does not add a list of pruned packages anywhere, and that's intentional at this point. The design lists that as a future possibility too.

Some pointers:

  • Meat of the changes is in DependecyGraphResolver. As we walk the graph, if a graph item is eligible (package and lower min version than the one specified in the PrunePackageReference, we skip it). We do that by tracking the indices of the packages we skip. This is the safe way, since it preserves the index calculation for the items in the graph.
    At flattening time, we then skip those dependencies and we "recreate" the RemoteResolveResult dependencies section to ensure the assets file contains the correct information.
  • LockFileUtils.CreateLockFileTargetLibrary now contains the dependencies count in the hashing to avoid issues where things were pruned in one framework but not in the other.
  • SdkAnalysisLevelMinimums.cs adds warnings for project pruning and direct package reference pruning only in .NET 10 SDK Analysis level scenarios. The feature is still disabled by default for all frameworks anyways.
  • The tests RestoreCommandTests.cs are exhaustive and they contain all scenarios called out in the spec & combinations of pruning normal and runtime dependencies, across different or same frameworks.

PR Checklist

@microsoft-github-policy-service microsoft-github-policy-service bot added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Nov 21, 2024
@nkolev92 nkolev92 force-pushed the dev-nkolev92-suppliedByPlatform branch from 2187307 to b866f12 Compare November 22, 2024 01:34
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Nov 22, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Dec 2, 2024
@nkolev92 nkolev92 force-pushed the dev-nkolev92-suppliedByPlatform branch from b866f12 to 61467e5 Compare December 3, 2024 01:20
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Dec 3, 2024
@nkolev92 nkolev92 force-pushed the dev-nkolev92-suppliedByPlatform branch 4 times, most recently from dfa9d32 to 095a289 Compare December 4, 2024 18:06
@nkolev92 nkolev92 changed the title Add support for PrunedPackageReference [Supplied by Platform] Add support for PrunedPackageReference in the new resolver Dec 7, 2024
@nkolev92 nkolev92 changed the title Add support for PrunedPackageReference in the new resolver Add support for PrunePackageReference in the new resolver Dec 7, 2024
@nkolev92 nkolev92 force-pushed the dev-nkolev92-suppliedByPlatform branch 2 times, most recently from 12cf323 to 5e25b65 Compare December 10, 2024 17:17
@nkolev92 nkolev92 force-pushed the dev-nkolev92-suppliedByPlatform branch from 19fea10 to 8c30394 Compare December 16, 2024 21:03
@nkolev92 nkolev92 force-pushed the dev-nkolev92-suppliedByPlatform branch from efcb1e0 to 8ec13b9 Compare December 17, 2024 17:29
@nkolev92 nkolev92 marked this pull request as ready for review December 17, 2024 17:29
@nkolev92 nkolev92 requested a review from a team as a code owner December 17, 2024 17:29
@nkolev92 nkolev92 requested review from jeffkl and zivkan December 17, 2024 23:19
@nkolev92 nkolev92 enabled auto-merge (squash) December 19, 2024 23:36
@nkolev92 nkolev92 merged commit 8f334f0 into dev Dec 20, 2024
22 of 23 checks passed
@nkolev92 nkolev92 deleted the dev-nkolev92-suppliedByPlatform branch December 20, 2024 00:12
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.

Support "Supplied by Platform" scenario in restore
3 participants