7 instantiations of ProjectGraphNode
Microsoft.Build (1)
Graph\GraphBuilder.cs (1)
541
var graphNode = new
ProjectGraphNode
(projectInstance);
Microsoft.Build.Engine.UnitTests (6)
Graph\ProjectGraph_Tests.cs (6)
127
Assert.Throws<InternalErrorException>(() => new
ProjectGraphNode
(null));
136
var node = new
ProjectGraphNode
(projectInstance);
137
var reference1 = new
ProjectGraphNode
(projectInstance);
140
var reference2 = new
ProjectGraphNode
(projectInstance);
183
var node = new
ProjectGraphNode
(projectInstance);
184
var reference1 = new
ProjectGraphNode
(projectInstance);
292 references to ProjectGraphNode
Microsoft.Build (118)
BackEnd\BuildManager\BuildManager.cs (14)
2124
Dictionary<
ProjectGraphNode
, BuildResult>? resultsPerNode = null;
2130
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetsPerNode = projectGraph.GetTargetLists(submission.BuildRequestData.TargetNames);
2137
foreach (
ProjectGraphNode
entryPointNode in projectGraph.EntryPointNodes)
2157
new ReadOnlyDictionary<
ProjectGraphNode
, BuildResult>(resultsPerNode ?? new Dictionary<
ProjectGraphNode
, BuildResult>())));
2159
static void DumpGraph(ProjectGraph graph, IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>>? targetList = null)
2172
private Dictionary<
ProjectGraphNode
, BuildResult> BuildGraph(
2174
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetsPerNode,
2185
var blockedNodes = new HashSet<
ProjectGraphNode
>(projectGraph.ProjectNodes);
2186
var finishedNodes = new HashSet<
ProjectGraphNode
>(projectGraph.ProjectNodes.Count);
2187
var buildingNodes = new Dictionary<BuildSubmissionBase,
ProjectGraphNode
>();
2188
var resultsPerNode = new Dictionary<
ProjectGraphNode
, BuildResult>(projectGraph.ProjectNodes.Count);
2207
foreach (
var
node in unblockedNodes)
2244
ProjectGraphNode
finishedNode = buildingNodes[finishedBuildSubmission];
Graph\GraphBuilder.cs (47)
34
public IReadOnlyCollection<
ProjectGraphNode
> ProjectNodes { get; private set; }
36
public IReadOnlyCollection<
ProjectGraphNode
> RootNodes { get; private set; }
38
public IReadOnlyCollection<
ProjectGraphNode
> EntryPointNodes { get; private set; }
104
private static IReadOnlyCollection<
ProjectGraphNode
> GetGraphRoots(IReadOnlyCollection<
ProjectGraphNode
> entryPointNodes)
106
var graphRoots = new List<
ProjectGraphNode
>(entryPointNodes.Count);
108
foreach (
var
entryPointNode in entryPointNodes)
137
Dictionary<
ProjectGraphNode
, HashSet<
ProjectGraphNode
>> transitiveReferenceCache = new(allParsedProjects.Count);
141
var
currentNode = parsedProject.Value.GraphNode;
156
foreach (
var
transitiveProjectReference in GetTransitiveProjectReferencesExcludingSelf(allParsedProjects[referenceInfo.ReferenceConfiguration]))
172
HashSet<
ProjectGraphNode
> GetTransitiveProjectReferencesExcludingSelf(ParsedProject parsedProject)
174
if (transitiveReferenceCache.TryGetValue(parsedProject.GraphNode, out HashSet<
ProjectGraphNode
> transitiveReferences))
191
foreach (
ProjectGraphNode
transitiveReference in GetTransitiveProjectReferencesExcludingSelf(reference))
203
var projectsByPath = new Dictionary<string, List<
ProjectGraphNode
>>();
209
if (projectsByPath.TryGetValue(projectPath, out List<
ProjectGraphNode
> value))
215
projectsByPath[projectPath] = new List<
ProjectGraphNode
> { project.Value.GraphNode };
228
ErrorUtilities.VerifyThrow(projectsByPath.TryGetValue(referencedProjectPath, out List<
ProjectGraphNode
> projectToReturn), "nodes should include solution projects");
232
foreach (
var
referencingNode in referencingNodes)
234
foreach (
var
referencedNode in referencedNodes)
441
IReadOnlyCollection<
ProjectGraphNode
> entryPointNodes,
445
var nodeStates = new Dictionary<
ProjectGraphNode
, NodeVisitationState>();
447
foreach (
var
entryPointNode in entryPointNodes)
464
ProjectGraphNode
node,
465
IDictionary<
ProjectGraphNode
, NodeVisitationState> nodeState)
469
foreach (
var
referenceNode in node.ProjectReferences)
541
var
graphNode = new ProjectGraphNode(projectInstance);
574
private List<ProjectInterpretation.ReferenceInfo> ParseReferences(
ProjectGraphNode
parsedProject)
648
private ConcurrentDictionary<(
ProjectGraphNode
,
ProjectGraphNode
), ProjectItemInstance> ReferenceItems =
649
new ConcurrentDictionary<(
ProjectGraphNode
,
ProjectGraphNode
), ProjectItemInstance>();
653
public ProjectItemInstance this[(
ProjectGraphNode
node,
ProjectGraphNode
reference) key]
662
public void AddOrUpdateEdge((
ProjectGraphNode
node,
ProjectGraphNode
reference) key, ProjectItemInstance edge)
667
addValueFactory: static ((
ProjectGraphNode
node,
ProjectGraphNode
reference) key, ProjectItemInstance referenceItem) => referenceItem,
668
updateValueFactory: static ((
ProjectGraphNode
node,
ProjectGraphNode
reference) key, ProjectItemInstance existingItem, ProjectItemInstance newItem) =>
687
static string GetEffectiveTargets(
ProjectGraphNode
reference, string targetsMetadata)
700
public void RemoveEdge((
ProjectGraphNode
node,
ProjectGraphNode
reference) key)
705
internal bool HasEdge((
ProjectGraphNode
node,
ProjectGraphNode
reference) key) => ReferenceItems.ContainsKey(key);
727
public
ProjectGraphNode
GraphNode { get; }
730
public ParsedProject(ConfigurationMetadata configurationMetadata,
ProjectGraphNode
graphNode, List<ProjectInterpretation.ReferenceInfo> referenceInfos)
Graph\GraphBuildRequestData.cs (2)
200
foreach (
ProjectGraphNode
entryPoint in ProjectGraph.EntryPointNodes)
219
ProjectGraphNode
? node = ProjectGraph?.EntryPointNodes.FirstOrDefault();
Graph\GraphBuildResult.cs (5)
19
internal GraphBuildResult(int submissionId, IReadOnlyDictionary<
ProjectGraphNode
, BuildResult> resultsByNode)
34
ResultsByNode = ImmutableDictionary<
ProjectGraphNode
, BuildResult>.Empty;
64
foreach (KeyValuePair<
ProjectGraphNode
, BuildResult> result in ResultsByNode)
79
public IReadOnlyDictionary<
ProjectGraphNode
, BuildResult> ResultsByNode { get; }
87
public BuildResult this[
ProjectGraphNode
node] => ResultsByNode[node];
Graph\ProjectGraph.cs (35)
60
private readonly Lazy<IReadOnlyCollection<
ProjectGraphNode
>> _projectNodesTopologicallySorted;
92
public IReadOnlyCollection<
ProjectGraphNode
> EntryPointNodes { get; }
97
public IReadOnlyCollection<
ProjectGraphNode
> ProjectNodes { get; }
103
public IReadOnlyCollection<
ProjectGraphNode
> ProjectNodesTopologicallySorted => _projectNodesTopologicallySorted.Value;
105
public IReadOnlyCollection<
ProjectGraphNode
> GraphRoots { get; }
449
_projectNodesTopologicallySorted = new Lazy<IReadOnlyCollection<
ProjectGraphNode
>>(() => TopologicalSort(GraphRoots, ProjectNodes));
491
internal string ToDot(IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetsPerNode = null)
498
Func<
ProjectGraphNode
, string> nodeIdProvider,
499
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetsPerNode = null)
503
var nodeIds = new ConcurrentDictionary<
ProjectGraphNode
, string>();
513
foreach (
var
node in ProjectNodes)
528
foreach (
var
reference in node.ProjectReferences)
540
string GetNodeId(
ProjectGraphNode
node)
545
string GetTargetListString(
ProjectGraphNode
node)
559
private static IReadOnlyCollection<
ProjectGraphNode
> TopologicalSort(
560
IReadOnlyCollection<
ProjectGraphNode
> graphRoots,
561
IReadOnlyCollection<
ProjectGraphNode
> graphNodes)
563
var toposort = new List<
ProjectGraphNode
>(graphNodes.Count);
564
var partialRoots = new Queue<
ProjectGraphNode
>(graphNodes.Count);
567
foreach (
var
root in graphRoots)
574
var
partialRoot = partialRoots.Dequeue();
578
foreach (
var
reference in partialRoot.ProjectReferences)
609
public IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> GetTargetLists(ICollection<string> entryProjectTargets)
622
foreach (
ProjectGraphNode
entryPointNode in EntryPointNodes)
637
foreach (
ProjectGraphNode
entryPointNode in EntryPointNodes)
665
ProjectGraphNode
node = GetNodeForProject(project);
683
ProjectGraphNode
node = GetNodeForProject(project);
691
ProjectGraphNode
GetNodeForProject(ProjectInSolution project) => EntryPointNodes.First(node => string.Equals(node.ProjectInstance.FullPath, project.AbsolutePath));
697
foreach (
ProjectGraphNode
entryPointNode in EntryPointNodes)
711
var
node = buildRequest.Node;
726
foreach (
var
referenceNode in node.ProjectReferences)
752
var entriesToUpdate = new List<KeyValuePair<
ProjectGraphNode
, ImmutableList<string>>>();
774
entriesToUpdate.Add(new KeyValuePair<
ProjectGraphNode
, ImmutableList<string>>(pair.Key, targetList));
866
public ProjectGraphBuildRequest(
ProjectGraphNode
node, ImmutableList<string> targets)
872
public
ProjectGraphNode
Node { get; }
Graph\ProjectGraphNode.cs (9)
20
private readonly HashSet<
ProjectGraphNode
> _projectReferences = new HashSet<
ProjectGraphNode
>();
21
private readonly HashSet<
ProjectGraphNode
> _referencingProjects = new HashSet<
ProjectGraphNode
>();
37
public IReadOnlyCollection<
ProjectGraphNode
> ProjectReferences => _projectReferences;
42
public IReadOnlyCollection<
ProjectGraphNode
> ReferencingProjects => _referencingProjects;
57
internal void AddProjectReference(
ProjectGraphNode
reference, ProjectItemInstance projectReferenceItem, GraphBuilder.GraphEdges edges)
65
internal void RemoveReference(
ProjectGraphNode
reference, GraphBuilder.GraphEdges edges)
75
foreach (
var
reference in _projectReferences)
Graph\ProjectInterpretation.cs (6)
77
public IEnumerable<ReferenceInfo> GetReferences(
ProjectGraphNode
projectGraphNode, ProjectCollection projectCollection, ProjectGraph.ProjectInstanceFactoryFunc projectInstanceFactory)
250
ProjectGraphNode
outerBuild = node.Value.GraphNode;
254
foreach (
ProjectGraphNode
innerBuild in outerBuild.ProjectReferences)
256
foreach (
ProjectGraphNode
outerBuildReferencingProject in outerBuild.ReferencingProjects)
525
public ImmutableList<string> GetApplicableTargetsForReference(
ProjectGraphNode
projectGraphNode)
546
public bool RequiresTransitiveProjectReferences(
ProjectGraphNode
projectGraphNode)
Microsoft.Build.Engine.UnitTests (174)
BackEnd\BuildManager_Tests.cs (4)
4255
var
node1 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project1, StringComparison.OrdinalIgnoreCase));
4259
var
node2 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project2, StringComparison.OrdinalIgnoreCase));
4340
var
node1 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project1, StringComparison.OrdinalIgnoreCase));
4344
var
node2 = graph.ProjectNodes.First(node => node.ProjectInstance.FullPath.Equals(project2, StringComparison.OrdinalIgnoreCase));
Graph\GraphLoadedFromSolution_tests.cs (7)
624
var
node1 = GetFirstNodeWithProjectNumber(graph, 1);
629
var
outerBuild3 = GetOuterBuild(graph, 3);
638
IEnumerable<ProjectItemInstance> GetOutgoingEdgeItemsFromNode(
ProjectGraphNode
node, IReadOnlyDictionary<(ConfigurationMetadata, ConfigurationMetadata), ProjectItemInstance> edgeInfos)
643
IEnumerable<ProjectItemInstance> GetIncomingEdgeItemsToNode(
ProjectGraphNode
node, IReadOnlyDictionary<(ConfigurationMetadata, ConfigurationMetadata), ProjectItemInstance> edgeInfos)
707
foreach (
var
node in graphFromSolution.ProjectNodes)
715
private static string GetConfiguration(
ProjectGraphNode
node)
720
private static string GetPlatform(
ProjectGraphNode
node)
Graph\GraphTestingUtilities.cs (25)
41
ProjectGraphNode
outerBuild,
53
foreach (
ProjectGraphNode
innerBuild in outerBuild.ProjectReferences)
65
foreach (
ProjectGraphNode
outerBuildReferencer in outerBuild.ReferencingProjects)
67
ProjectGraphNode
[] innerBuilds = outerBuildReferencer.ProjectReferences
73
foreach (
ProjectGraphNode
innerBuild in innerBuilds)
90
public static void AssertNonMultitargetingNode(
ProjectGraphNode
node, Dictionary<string, string> additionalGlobalProperties = null)
99
public static void AssertOuterBuildEvaluation(
ProjectGraphNode
outerBuild, Dictionary<string, string> additionalGlobalProperties)
110
ProjectGraphNode
innerBuild,
131
internal static
ProjectGraphNode
GetFirstNodeWithProjectNumber(ProjectGraph graph, int projectNum)
136
internal static IEnumerable<
ProjectGraphNode
> GetNodesWithProjectNumber(ProjectGraph graph, int projectNum)
141
internal static
ProjectGraphNode
GetOuterBuild(ProjectGraph graph, int projectNumber)
146
internal static IReadOnlyCollection<
ProjectGraphNode
> GetInnerBuilds(ProjectGraph graph, int projectNumber)
148
var
outerBuild = GetOuterBuild(graph, projectNumber);
152
return ImmutableArray<
ProjectGraphNode
>.Empty;
166
internal static string GetProjectFileName(
ProjectGraphNode
node)
178
internal static int GetProjectNumber(
ProjectGraphNode
node)
190
internal static string GetProjectPath(
ProjectGraphNode
node)
214
internal static IEnumerable<
ProjectGraphNode
> ComputeClosure(
ProjectGraphNode
node)
218
IEnumerable<
ProjectGraphNode
> ComputeClosureRecursive(
ProjectGraphNode
projectGraphNode)
220
foreach (
var
reference in projectGraphNode.ProjectReferences)
224
foreach (
var
closureReference in ComputeClosureRecursive(reference))
236
var
node = GetFirstNodeWithProjectNumber(graph, kvp.Key);
241
internal static void AssertReferencesIgnoringOrder(this
ProjectGraphNode
node, int[] expectedReferences)
Graph\IsolateProjects_Tests.cs (3)
15
using ExpectedNodeBuildOutput = System.Collections.Generic.Dictionary<Microsoft.Build.Graph.
ProjectGraphNode
, string[]>;
16
using OutputCacheDictionary = System.Collections.Generic.Dictionary<Microsoft.Build.Graph.
ProjectGraphNode
, string>;
327
ProjectGraphNode
[] topoSortedProjectGraphNodes = projectGraph.ProjectNodesTopologicallySorted.ToArray();
Graph\ProjectGraph_Tests.cs (108)
136
var
node = new ProjectGraphNode(projectInstance);
137
var
reference1 = new ProjectGraphNode(projectInstance);
140
var
reference2 = new ProjectGraphNode(projectInstance);
183
var
node = new ProjectGraphNode(projectInstance);
184
var
reference1 = new ProjectGraphNode(projectInstance);
263
ProjectGraphNode
node1 = GetFirstNodeWithProjectNumber(graph, 1);
264
ProjectGraphNode
node2 = GetFirstNodeWithProjectNumber(graph, 2);
265
ProjectGraphNode
node3 = GetFirstNodeWithProjectNumber(graph, 3);
266
ProjectGraphNode
node4 = GetFirstNodeWithProjectNumber(graph, 4);
267
ProjectGraphNode
node5 = GetFirstNodeWithProjectNumber(graph, 5);
268
ProjectGraphNode
node6 = GetFirstNodeWithProjectNumber(graph, 6);
269
ProjectGraphNode
node7 = GetFirstNodeWithProjectNumber(graph, 7);
370
var
root1 = GetFirstNodeWithProjectNumber(graph, 1);
377
var
root2 = GetFirstNodeWithProjectNumber(graph, 2);
467
var
node4A = GetFirstNodeWithProjectNumber(graph, 2).ProjectReferences.First();
468
var
node4B = GetFirstNodeWithProjectNumber(graph, 3).ProjectReferences.First();
582
var
node1 = GetFirstNodeWithProjectNumber(projectGraph, 1);
583
var
node2 = GetFirstNodeWithProjectNumber(projectGraph, 2);
584
var
node3 = GetFirstNodeWithProjectNumber(projectGraph, 3);
607
var
entryPointNode1 = projectGraph.EntryPointNodes.First();
608
var
entryPointNode2 = projectGraph.EntryPointNodes.Last();
646
var
entryPointNode1 = projectGraph.EntryPointNodes.First();
647
var
entryPointNode2 = projectGraph.EntryPointNodes.Last();
869
ProjectGraphNode
project1Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project1Path);
875
ProjectGraphNode
project2Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project2Path);
881
ProjectGraphNode
project3Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project3Path);
888
ProjectGraphNode
project4Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project4Path);
894
ProjectGraphNode
project5Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project5Path);
900
ProjectGraphNode
project6Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project6Path);
908
ProjectGraphNode
project8Node = projectGraph.ProjectNodes.Single(node => node.ProjectInstance.FullPath == project8Path);
928
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new[] { "A" });
956
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new[] { "A" });
987
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new[] { "A" });
1009
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(null);
1027
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new[] { "Foo" });
1050
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(null);
1073
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new[] { "A" });
1116
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string> { "A" });
1157
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string> { "A" });
1191
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string> { "A" });
1194
var
root = GetFirstNodeWithProjectNumber(projectGraph, 1);
1196
var
outerBuild = GetOuterBuild(projectGraph, 2);
1202
foreach (
var
innerBuild in innerBuilds)
1256
ProjectGraphNode
rootOuterBuild = GetOuterBuild(graph, 1);
1257
ProjectGraphNode
nonRootOuterBuild = GetOuterBuild(graph, 3);
1262
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = graph.GetTargetLists(new[] { "A" });
1266
foreach (
ProjectGraphNode
innerBuild in GetInnerBuilds(graph, 1))
1275
foreach (
ProjectGraphNode
innerBuild in GetInnerBuilds(graph, 3))
1363
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(new List<string> { "A" });
1376
void AssertMultitargetingNode(int projectNumber, ProjectGraph projectGraph, IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists, string[] outerBuildTargets, string[] nonOuterBuildTargets)
1380
foreach (
var
innerBuild in GetInnerBuilds(projectGraph, projectNumber))
1398
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(null);
1421
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(null);
1451
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(null);
1508
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(entryProjectTargets: null);
1553
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = graph.GetTargetLists(entryProjectTargets: new[] { "Build" });
1560
expectedNodeBuildOutput: new Dictionary<
ProjectGraphNode
, string[]>(),
1561
outputCaches: new Dictionary<
ProjectGraphNode
, string>(),
1603
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = graph.GetTargetLists(entryProjectTargets: new[] { "Build" });
1610
expectedNodeBuildOutput: new Dictionary<
ProjectGraphNode
, string[]>(),
1611
outputCaches: new Dictionary<
ProjectGraphNode
, string>(),
1634
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = graph.GetTargetLists(null);
1848
Func<
ProjectGraphNode
, string> nodeIdProvider = GetProjectFileName;
1854
foreach (
var
node in graph.ProjectNodes)
1866
foreach (
var
reference in node.ProjectReferences)
1891
var
outerBuild = graph.GraphRoots.First();
1918
var
outerBuild = GetOuterBuild(graph, 2);
1952
var
outerBuild = GetOuterBuild(graph, 2);
1956
var
outerBuildReferencingNode = GetFirstNodeWithProjectNumber(graph, 1);
1960
foreach (
var
innerBuild in GetInnerBuilds(graph, 2))
1985
var
rootOuterBuild = GetOuterBuild(graph, 1);
1986
var
nonRootOuterBuild = GetOuterBuild(graph, 2);
2006
var
nonMultitargetingNode = GetFirstNodeWithProjectNumber(graph, 2);
2034
var
nonMultitargetingNode = GetFirstNodeWithProjectNumber(graph, 2);
2053
var
nonMultitargetingNode = GetFirstNodeWithProjectNumber(graph, 2);
2106
var
innerBuildWithCommonReferences = GetNodesWithProjectNumber(graph, 1).First(n => n.ProjectInstance.GlobalProperties.TryGetValue(InnerBuildPropertyName, out string p) && p == "a");
2112
var
innerBuildWithAdditionalReferences = GetNodesWithProjectNumber(graph, 1).First(n => n.ProjectInstance.GlobalProperties.TryGetValue(InnerBuildPropertyName, out string p) && p == "b");
2139
var
outerBuild = graph.GraphRoots.First(i => i.ProjectType == ProjectInterpretation.ProjectType.OuterBuild);
2144
var
referencedInnerBuild = GetNodesWithProjectNumber(graph, 1).First(n => n.ProjectInstance.GetPropertyValue(InnerBuildPropertyName) == "a");
2146
var
two = GetFirstNodeWithProjectNumber(graph, 2);
2173
var
rootNode = graph.GraphRoots.First();
2177
var
innerBuildNode = rootNode.ProjectReferences.First();
2217
var
outerBuild1 = GetOuterBuild(graph, 1);
2221
var
innerBuild1WithReferenceToInnerBuild2 = outerBuild1.ProjectReferences.FirstOrDefault(n => n.ProjectType == ProjectInterpretation.ProjectType.InnerBuild && n.ProjectInstance.GlobalProperties[InnerBuildPropertyName] == "a");
2224
var
outerBuild2 = GetOuterBuild(graph, 2);
2227
var
innerBuild2 = GetInnerBuilds(graph, 2).FirstOrDefault();
2335
foreach (
var
node in projectGraph.ProjectNodes)
2365
foreach (
var
node in graph.ProjectNodes)
2541
foreach (
var
innerBuild in innerBuilds1)
2553
foreach (
var
innerBuild in innerBuilds4)
2620
var
outerBuild1 = GetOuterBuild(graph, 1);
2628
foreach (
var
inner1 in innerBuildsFor1)
2634
var
outerBuild2 = GetOuterBuild(graph, 2);
2641
foreach (
var
inner2 in innerBuildsFor2)
2646
var
outerBuild3 = GetOuterBuild(graph, 3);
2655
foreach (
var
inner3 in innerBuildsFor3)
2697
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = graph.GetTargetLists(Array.Empty<string>());
2699
ProjectGraphNode
project1 = GetFirstNodeWithProjectNumber(graph, 1);
2700
ProjectGraphNode
project2 = GetFirstNodeWithProjectNumber(graph, 2);
2739
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = graph.GetTargetLists(Array.Empty<string>());
2741
ProjectGraphNode
project1 = GetFirstNodeWithProjectNumber(graph, 1);
2742
ProjectGraphNode
project2 = GetFirstNodeWithProjectNumber(graph, 2);
2798
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = graph.GetTargetLists(Array.Empty<string>());
2801
foreach (
ProjectGraphNode
inner in GetInnerBuilds(graph, 1))
2807
foreach (
ProjectGraphNode
inner in GetInnerBuilds(graph, 2))
2875
ProjectGraphNode
project1Node = GetFirstNodeWithProjectNumber(projectGraph, 1);
2876
ProjectGraphNode
project2Node = GetFirstNodeWithProjectNumber(projectGraph, 2);
2878
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetLists = projectGraph.GetTargetLists(entryTargets);
Graph\ResultCacheBasedBuilds_Tests.cs (10)
20
using ExpectedNodeBuildOutput = System.Collections.Generic.Dictionary<Microsoft.Build.Graph.
ProjectGraphNode
, string[]>;
21
using OutputCacheDictionary = System.Collections.Generic.Dictionary<Microsoft.Build.Graph.
ProjectGraphNode
, string>;
306
foreach (
var
node in topoSortedNodes)
349
var
rootNode = topoSortedNodes.First(n => Path.GetFileNameWithoutExtension(n.ProjectInstance.FullPath) == "1");
424
IReadOnlyCollection<
ProjectGraphNode
> topoSortedNodes,
430
Func<
ProjectGraphNode
, ExpectedNodeBuildOutput, string[]> expectedOutputProducer = null,
431
IReadOnlyDictionary<
ProjectGraphNode
, ImmutableList<string>> targetListsPerNode = null,
444
foreach (
var
node in topoSortedNodes)
491
string[] ExpectedBuildOutputForNode(
ProjectGraphNode
node)
509
private static string ProjectNumber(
ProjectGraphNode
node) => Path.GetFileNameWithoutExtension(node.ProjectInstance.FullPath);
ProjectCache\ProjectCacheTests.cs (16)
163
public CacheResult GetExpectedCacheResultForNode(
ProjectGraphNode
node)
340
public CacheResult GetCacheResultForNode(
ProjectGraphNode
node)
513
var nodesToBuildResults = new Dictionary<
ProjectGraphNode
, BuildResult>();
518
foreach (
var
node in graph.ProjectNodesTopologicallySorted)
536
(MockLogger logger, ProjectGraph graph, Dictionary<
ProjectGraphNode
, BuildResult> nodesToBuildResults) = BuildGraphVsScenario(testData, buildParameters);
560
private (MockLogger logger, ProjectGraph projectGraph, Dictionary<
ProjectGraphNode
, BuildResult> nodesToBuildResults) BuildGraphVsScenario(
565
var nodesToBuildResults = new Dictionary<
ProjectGraphNode
, BuildResult>();
600
foreach (
var
node in graph.ProjectNodesTopologicallySorted)
622
foreach (
var
node in graph.ProjectNodes)
646
private static string CreateSolutionConfigurationProperty(IReadOnlyCollection<
ProjectGraphNode
> projectNodes)
652
foreach (
var
node in projectNodes)
702
var
rootNode = graph.GraphRoots.First();
794
IReadOnlyDictionary<
ProjectGraphNode
, BuildResult> projectPathToBuildResults,
810
foreach (
var
node in graph.ProjectNodes)
850
private static int GetProjectNumber(
ProjectGraphNode
node) => GetProjectNumber(node.ProjectInstance.FullPath);
1498
foreach (
var
node in graph.ProjectNodes.Where(n => referenceNumbers.Contains(GetProjectNumber(n))))
SolutionFileBuilder.cs (1)
95
n => GraphTestingUtilities.GetProjectNumber((
ProjectGraphNode
)n).ToString(),