Skip to content

Commit

Permalink
Cache results of ResolveTargetingPackAssets across builds (#19570)
Browse files Browse the repository at this point in the history
Uses MSBuild's RegisteredTaskObject machinery to cache (for the lifetime
of the process) the results of resolving targeting pack assets. This
task runs on every build because it must produce items to populate
@(Reference), but its output basically never changes since the targeting
packs are static.

The caching is two-layered:

1. Cache the parsing of the targeting pack (FrameworkList.xml and
   friends) so that those files need to be read only once per MSBuild
   worker node per build.
2. Cache the full results of the task, including deduplication in the
   case of multiple targeting packs.

Refactored the task to use strongly-typed objects to ensure that
the relevant data is hashed, instead of pulling from stringly-typed
item metadata.

Fixes #19282.
  • Loading branch information
rainersigwald authored Sep 8, 2021
1 parent acc267e commit 70f204b
Show file tree
Hide file tree
Showing 4 changed files with 827 additions and 116 deletions.
1 change: 1 addition & 0 deletions src/Common/EnvironmentVariableNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Microsoft.DotNet.Cli
{
static class EnvironmentVariableNames
{
public static readonly string ALLOW_TARGETING_PACK_CACHING = "DOTNETSDK_ALLOW_TARGETING_PACK_CACHING";
public static readonly string WORKLOAD_PACK_ROOTS = "DOTNETSDK_WORKLOAD_PACK_ROOTS";
public static readonly string WORKLOAD_MANIFEST_ROOTS = "DOTNETSDK_WORKLOAD_MANIFEST_ROOTS";
public static readonly string WORKLOAD_UPDATE_NOTIFY_DISABLE = "DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE";
Expand Down
Loading

0 comments on commit 70f204b

Please sign in to comment.