Skip to content

Commit 0d14a75

Browse files
committed
Consume requested targets when constructing the graph
1 parent 3927f98 commit 0d14a75

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<ArtifactsPackageVersion>19.232.34508-buildid25403274</ArtifactsPackageVersion>
55
<BuildXLPackageVersion>0.1.0-20240121.1</BuildXLPackageVersion>
6-
<MSBuildPackageVersion>17.8.3</MSBuildPackageVersion>
6+
<MSBuildPackageVersion>17.9.5</MSBuildPackageVersion>
77
</PropertyGroup>
88
<ItemGroup>
99
<PackageVersion Include="coverlet.collector" Version="3.1.2" />

src/Common/MSBuildCachePluginBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ private async Task BeginBuildInnerAsync(CacheContext context, PluginLoggerBase l
273273
Parser parser = new(logger, _repoRoot);
274274
IReadOnlyDictionary<ProjectGraphNode, ParserInfo> parserInfoForNodes = parser.Parse(graph);
275275

276-
// TODO: MSBuild should give this to us via CacheContext
277-
var entryProjectTargets = Array.Empty<string>();
276+
// In practice, the underlying type of the IReadOnlyCollection is a ICollection<string> so attempt to cast first. We're not mutating the collection so still abiding by the readonly-ness.
277+
ICollection<string> entryProjectTargets = context.RequestedTargets as ICollection<string> ?? new List<string>(context.RequestedTargets);
278278
IReadOnlyDictionary<ProjectGraphNode, ImmutableList<string>> targetListPerNode = graph.GetTargetLists(entryProjectTargets);
279279

280280
Dictionary<NodeDescriptor, NodeContext> nodeContexts = new(parserInfoForNodes.Count);

0 commit comments

Comments
 (0)