Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmihai committed Dec 29, 2020
1 parent 4adf8a7 commit acb4b7e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Build/BackEnd/BuildManager/BuildParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ public string OutputResultsCacheFile
/// Any <see cref="GraphBuildSubmission"/> requests will also use this project cache instead of
/// the potential project caches described in graph node's evaluations.
/// </summary>
public ProjectCacheDescriptor ProjectCacheDescriptor{ get; set; }
public ProjectCacheDescriptor ProjectCacheDescriptor { get; set; }

/// <summary>
/// Retrieves a toolset.
Expand Down
3 changes: 0 additions & 3 deletions src/Build/BackEnd/BuildManager/BuildSubmission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
using Microsoft.Build.BackEnd;
using Microsoft.Build.Shared;
using System.Globalization;
using Microsoft.Build.BackEnd.Logging;
using Microsoft.Build.BackEnd.SdkResolution;
using Microsoft.Build.Definition;

namespace Microsoft.Build.Execution
{
Expand Down
20 changes: 12 additions & 8 deletions src/Build/BackEnd/Components/ProjectCache/CacheContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@
namespace Microsoft.Build.Experimental.ProjectCache
{
/// <summary>
/// Either Graph is null, or GraphEntryPoints is null. Not Both.
/// Holds various information about the current msbuild execution that the cache might use.
/// The cache may need to know about the top level projects or the entire project graph, so MSBuild
/// provides a graph when one is available. When it isn't available, MSBuild provides the top level projects
/// and the plugin can construct its own graph based on those.
/// So either <see cref="Graph" />is null, or <see cref="GraphEntryPoints" /> is null. But not both.
/// </summary>
public class CacheContext
{
public IReadOnlyDictionary<string, string> PluginSettings { get; }
public ProjectGraph? Graph { get; }
public IReadOnlyCollection<ProjectGraphEntryPoint>? GraphEntryPoints { get; }
public string MSBuildExePath { get; }
public MSBuildFileSystemBase FileSystem { get; }

public CacheContext(
IReadOnlyDictionary<string, string> pluginSettings,
MSBuildFileSystemBase fileSystem,
ProjectGraph? graph = null,
IReadOnlyCollection<ProjectGraphEntryPoint>? graphEntryPoints = null)
{
ErrorUtilities.VerifyThrow(
graph != null ^ graphEntryPoints != null,
(graph != null) ^ (graphEntryPoints != null),
"Either Graph is specified, or GraphEntryPoints is specified. Not both.");

PluginSettings = pluginSettings;
Expand All @@ -30,11 +40,5 @@ public CacheContext(
MSBuildExePath = BuildEnvironmentHelper.Instance.CurrentMSBuildExePath;
FileSystem = fileSystem;
}

public IReadOnlyDictionary<string, string> PluginSettings { get; }
public ProjectGraph? Graph { get; }
public IReadOnlyCollection<ProjectGraphEntryPoint>? GraphEntryPoints { get; }
public string MSBuildExePath { get; }
public MSBuildFileSystemBase FileSystem { get; }
}
}
5 changes: 4 additions & 1 deletion src/Build/BackEnd/Components/ProjectCache/CacheResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ public enum CacheResultType
}

/// <summary>
/// Only cache hits have non null build result information.
/// Represents the cache result a plugin returns back to MSBuild when queried about a certain project.
/// Results representing cache hits (with <see cref="ResultType"/> == <see cref="CacheResultType.CacheHit"/>)
/// contain information about what <see cref="Execution.BuildResult"/> MSBuild should use for the queried project.
/// It is assumed that all cache hits result in a successful <see cref="Execution.BuildResult"/>.
/// </summary>
public class CacheResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#nullable enable
using System.Collections.Generic;
using System.Linq;
using Microsoft.Build.Execution;
using Microsoft.Build.Graph;
using Microsoft.Build.Shared;

Expand Down

0 comments on commit acb4b7e

Please sign in to comment.