Esempio n. 1
0
        /// <summary>
        /// Uses <see cref="MsBuildPipConstructor"/> to schedule the specified projects and retrieves the result
        internal MsBuildSchedulingResult ScheduleAll(MsBuildResolverSettings resolverSettings, IEnumerable <ProjectWithPredictions> projectsWithPredictions, QualifierId currentQualifier, QualifierId[] requestedQualifiers)
        {
            var moduleRegistry  = new ModuleRegistry(FrontEndContext.SymbolTable);
            var frontEndFactory = CreateFrontEndFactoryForEvaluation(ParseAndEvaluateLogger);

            using (var controller = CreateFrontEndHost(GetDefaultCommandLine(), frontEndFactory, moduleRegistry, AbsolutePath.Invalid, out _, out _, requestedQualifiers))
            {
                resolverSettings.ComputeEnvironment(out var trackedEnv, out var passthroughVars, out _);

                var pipConstructor = new PipConstructor(
                    FrontEndContext,
                    controller,
                    m_testModule,
                    resolverSettings,
                    resolverSettings.ShouldRunDotNetCoreMSBuild()? DotnetCoreMSBuild : FullframeworkMSBuild,
                    resolverSettings.ShouldRunDotNetCoreMSBuild()? DotnetExe : AbsolutePath.Invalid,
                    nameof(MsBuildFrontEnd),
                    trackedEnv,
                    passthroughVars);

                var schedulingResults = new Dictionary <ProjectWithPredictions, (bool, string, Process)>();

                foreach (var projectWithPredictions in projectsWithPredictions)
                {
                    var result = pipConstructor.TrySchedulePipForFile(projectWithPredictions, currentQualifier, out string failureDetail, out Process process);
                    schedulingResults[projectWithPredictions] = (result, failureDetail, process);
                }

                return(new MsBuildSchedulingResult(PathTable, controller.PipGraph, schedulingResults));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Uses <see cref="MsBuildPipConstructor"/> to schedule the specified projects and retrieves the result
        internal MsBuildSchedulingResult ScheduleAll(MsBuildResolverSettings resolverSettings, IEnumerable <ProjectWithPredictions> projectsWithPredictions, QualifierId currentQualifier, QualifierId[] requestedQualifiers)
        {
            var moduleRegistry  = new ModuleRegistry(FrontEndContext.SymbolTable);
            var frontEndFactory = CreateFrontEndFactoryForEvaluation(ParseAndEvaluateLogger);

            using (var controller = CreateFrontEndHost(GetDefaultCommandLine(), frontEndFactory, moduleRegistry, AbsolutePath.Invalid, out _, out _, requestedQualifiers))
            {
                resolverSettings.ComputeEnvironment(out var trackedEnv, out var passthroughVars, out _);

                var pipConstructor = new PipConstructor(
                    FrontEndContext,
                    controller,
                    m_testModule,
                    resolverSettings,
                    resolverSettings.ShouldRunDotNetCoreMSBuild()? DotnetCoreMSBuild : FullframeworkMSBuild,
                    resolverSettings.ShouldRunDotNetCoreMSBuild()? DotnetExe : AbsolutePath.Invalid,
                    nameof(MsBuildFrontEnd),
                    trackedEnv,
                    passthroughVars);

                var schedulingResults = new Dictionary <ProjectWithPredictions, (bool, string, Process)>();

                foreach (var projectWithPredictions in projectsWithPredictions)
                {
                    // Is some tests projects are not finalized. Let's do it here.
                    if (!projectWithPredictions.IsDependenciesSet)
                    {
                        projectWithPredictions.SetDependencies(CollectionUtilities.EmptyArray <ProjectWithPredictions>());
                    }

                    var result = pipConstructor.TrySchedulePipForProject(projectWithPredictions, currentQualifier);
                    schedulingResults[projectWithPredictions] = (result.Succeeded, result.Succeeded? null : result.Failure.Describe(), result.Succeeded? result.Result : null);
                }

                return(new MsBuildSchedulingResult(PathTable, controller.PipGraph, schedulingResults));
            }
        }