Make RAR disk cache deterministic (serialize only what's actually used) #8909
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #8636
Context
RAR uses a per-project disk cache to store data on referenced assemblies between executions. Per our common targets, for typical .NET projects the cache lives in
obj/{configuration}/{tfm}/{project-file-name}.AssemblyReference.cache. The cache has currently non-deterministic contents, often containing more than what's actually needed. This is because items are effectively only added to and never removed from it.Specific issues:
AssemblyInformationCachePaths, its contents is copied into per-project caches of all affected projects, making them deserialize this - typically large amount of - data on each execution. The pre-cache shipped with the SDK is 2 MB in size.Changes Made
Made RAR keep track of which items are actually used. Made RAR save only the files that have actually been used. A special case of nothing worth persisting has been used results in no cache file written.
Testing
Existing and new unit tests. Manual verification using projects previously built without #8802.