private Task <bool> EvaluateAllFilesAsync(IReadOnlySet <AbsolutePath> evaluationGoals, QualifierId qualifierId) { Contract.Assert(m_msBuildWorkspaceResolver.ComputedProjectGraph.Succeeded); ProjectGraphResult result = m_msBuildWorkspaceResolver.ComputedProjectGraph.Result; GlobalProperties qualifier = MsBuildResolverUtils.CreateQualifierAsGlobalProperties(qualifierId, m_context); IReadOnlySet <ProjectWithPredictions> filteredBuildFiles = result.ProjectGraph.ProjectNodes .Where(project => evaluationGoals.Contains(project.FullPath)) .Where(project => ProjectMatchesQualifier(project, qualifier)) .ToReadOnlySet(); var graphConstructor = new PipGraphConstructor( m_context, m_host, result.ModuleDefinition, m_msBuildResolverSettings, result.MsBuildLocation, result.DotNetExeLocation, m_frontEndName, m_msBuildWorkspaceResolver.UserDefinedEnvironment, m_msBuildWorkspaceResolver.UserDefinedPassthroughVariables); return(graphConstructor.TrySchedulePipsForFilesAsync(filteredBuildFiles, qualifierId)); }
private Task <SandboxedProcessResult> RunMsBuildGraphBuilderAsync( AbsolutePath responseFile, IEnumerable <AbsolutePath> projectEntryPoints, AbsolutePath outputFile, IEnumerable <AbsolutePath> searchLocations, BuildParameters.IBuildParameters buildParameters) { AbsolutePath toolDirectory = m_configuration.Layout.BuildEngineDirectory.Combine(m_context.PathTable, RelativePathToGraphConstructionTool).GetParent(m_context.PathTable); string pathToTool = m_configuration.Layout.BuildEngineDirectory.Combine(m_context.PathTable, RelativePathToGraphConstructionTool).ToString(m_context.PathTable); string outputDirectory = outputFile.GetParent(m_context.PathTable).ToString(m_context.PathTable); string outputFileString = outputFile.ToString(m_context.PathTable); string enlistmentRoot = m_resolverSettings.Root.ToString(m_context.PathTable); IReadOnlyCollection <string> entryPointTargets = m_resolverSettings.InitialTargets ?? CollectionUtilities.EmptyArray <string>(); var requestedQualifiers = m_requestedQualifiers.Select(qualifierId => MsBuildResolverUtils.CreateQualifierAsGlobalProperties(qualifierId, m_context)).ToList(); var arguments = new MSBuildGraphBuilderArguments( enlistmentRoot, projectEntryPoints.Select(entryPoint => entryPoint.ToString(m_context.PathTable)).ToList(), outputFileString, new GlobalProperties(m_resolverSettings.GlobalProperties ?? CollectionUtilities.EmptyDictionary <string, string>()), searchLocations.Select(location => location.ToString(m_context.PathTable)).ToList(), entryPointTargets, requestedQualifiers, m_resolverSettings.AllowProjectsToNotSpecifyTargetProtocol == true); var responseFilePath = responseFile.ToString(m_context.PathTable); SerializeResponseFile(responseFilePath, arguments); Tracing.Logger.Log.LaunchingGraphConstructionTool(m_context.LoggingContext, m_resolverSettings.Location(m_context.PathTable), arguments.ToString(), pathToTool); // Just being defensive, make sure there is not an old output file lingering around File.Delete(outputFileString); return(FrontEndUtilities.RunSandboxedToolAsync( m_context, pathToTool, buildStorageDirectory: outputDirectory, fileAccessManifest: GenerateFileAccessManifest(toolDirectory, outputFile), arguments: I($"\"{responseFilePath}\""), workingDirectory: outputDirectory, description: "MsBuild graph builder", buildParameters, beforeLaunch: () => ConnectToServerPipeAndLogProgress(outputFileString))); }
private Task <SandboxedProcessResult> RunMsBuildGraphBuilderAsync( AbsolutePath responseFile, IEnumerable <AbsolutePath> projectEntryPoints, AbsolutePath outputFile, IEnumerable <AbsolutePath> msBuildSearchLocations, AbsolutePath dotnetExeLocation, BuildParameters.IBuildParameters buildParameters) { Contract.Assert(!m_resolverSettings.ShouldRunDotNetCoreMSBuild() || dotnetExeLocation.IsValid); AbsolutePath toolDirectory = m_configuration.Layout.BuildEngineDirectory.Combine(m_context.PathTable, RelativePathToGraphConstructionTool).GetParent(m_context.PathTable); string outputDirectory = outputFile.GetParent(m_context.PathTable).ToString(m_context.PathTable); string outputFileString = outputFile.ToString(m_context.PathTable); IReadOnlyCollection <string> entryPointTargets = m_resolverSettings.InitialTargets ?? CollectionUtilities.EmptyArray <string>(); var requestedQualifiers = m_host.QualifiersToEvaluate.Select(qualifierId => MsBuildResolverUtils.CreateQualifierAsGlobalProperties(qualifierId, m_context)).ToList(); var arguments = new MSBuildGraphBuilderArguments( projectEntryPoints.Select(entryPoint => entryPoint.ToString(m_context.PathTable)).ToList(), outputFileString, new GlobalProperties(m_resolverSettings.GlobalProperties ?? CollectionUtilities.EmptyDictionary <string, string>()), msBuildSearchLocations.Select(location => location.ToString(m_context.PathTable)).ToList(), entryPointTargets, requestedQualifiers, m_resolverSettings.AllowProjectsToNotSpecifyTargetProtocol == true, m_resolverSettings.ShouldRunDotNetCoreMSBuild()); var responseFilePath = responseFile.ToString(m_context.PathTable); SerializeResponseFile(responseFilePath, arguments); string graphConstructionToolPath = m_configuration.Layout.BuildEngineDirectory.Combine(m_context.PathTable, RelativePathToGraphConstructionTool).ToString(m_context.PathTable); string pathToTool; string toolArguments; // if we should call the dotnet core version of MSBuild, we need to actually call dotnet.exe and pass the tool itself as its first argument if (m_resolverSettings.ShouldRunDotNetCoreMSBuild()) { pathToTool = dotnetExeLocation.ToString(m_context.PathTable); toolArguments = I($"\"{graphConstructionToolPath}\" \"{responseFilePath}\""); } else { pathToTool = graphConstructionToolPath; toolArguments = I($"\"{responseFilePath}\""); } Tracing.Logger.Log.LaunchingGraphConstructionTool(m_context.LoggingContext, m_resolverSettings.Location(m_context.PathTable), arguments.ToString(), pathToTool); // Just being defensive, make sure there is not an old output file lingering around File.Delete(outputFileString); return(FrontEndUtilities.RunSandboxedToolAsync( m_context, pathToTool, buildStorageDirectory: outputDirectory, fileAccessManifest: GenerateFileAccessManifest(toolDirectory, outputFile), arguments: toolArguments, workingDirectory: outputDirectory, description: "MsBuild graph builder", buildParameters, beforeLaunch: () => ConnectToServerPipeAndLogProgress(outputFileString))); }