示例#1
0
        public async Task <BuildResult> Build(ProgressMonitor monitor, ConfigurationSelector configuration, bool buildReferencedTargets = false, OperationContext operationContext = null)
        {
            ReadOnlyCollection <SolutionItem> allProjects;

            try {
                allProjects = GetAllBuildableEntries(configuration, true, true);
            } catch (CyclicDependencyException) {
                monitor.ReportError(GettextCatalog.GetString("Cyclic dependencies are not supported."), null);
                return(new BuildResult("", 1, 1));
            }

            if (operationContext == null)
            {
                operationContext = new OperationContext();
            }

            bool        operationStarted = false;
            BuildResult result           = null;

            try {
                monitor.BeginTask(GettextCatalog.GetString("Building Solution: {0} ({1})", Name, configuration.ToString()), allProjects.Count);

                operationStarted = ParentSolution != null && await ParentSolution.BeginBuildOperation(monitor, configuration, operationContext);

                return(result = await RunParallelBuildOperation(monitor, configuration, allProjects, (ProgressMonitor m, SolutionItem item) => {
                    return item.Build(m, configuration, false, operationContext);
                }, false));
            } finally {
                if (operationStarted)
                {
                    await ParentSolution.EndBuildOperation(monitor, configuration, operationContext, result);
                }
                monitor.EndTask();
            }
        }
示例#2
0
        public async Task <BuildResult> Build(ProgressMonitor monitor, ConfigurationSelector configuration, bool buildReferencedTargets = false, OperationContext operationContext = null)
        {
            ReadOnlyCollection <SolutionItem> allProjects;

            try {
                allProjects = GetAllBuildableEntries(configuration, true, true);
            } catch (CyclicDependencyException) {
                monitor.ReportError(GettextCatalog.GetString("Cyclic dependencies are not supported."), null);
                return(new BuildResult("", 1, 1));
            }

            if (operationContext == null)
            {
                operationContext = new OperationContext();
            }

            bool        operationStarted = false;
            BuildResult result           = null;

            try {
                if (Runtime.Preferences.SkipBuildingUnmodifiedProjects)
                {
                    allProjects = allProjects.Where(si => {
                        if (si is Project p)
                        {
                            return(p.FastCheckNeedsBuild(configuration));
                        }
                        return(true);                       //Don't filter things that don't have FastCheckNeedsBuild
                    }).ToList().AsReadOnly();
                }
                monitor.BeginTask(GettextCatalog.GetString("Building Solution: {0} ({1})", Name, configuration.ToString()), allProjects.Count);

                operationStarted = ParentSolution != null && await ParentSolution.BeginBuildOperation(monitor, configuration, operationContext);

                return(result = await RunParallelBuildOperation(monitor, configuration, allProjects, (ProgressMonitor m, SolutionItem item) => {
                    return item.Build(m, configuration, false, operationContext);
                }, false));
            } finally {
                if (operationStarted)
                {
                    await ParentSolution.EndBuildOperation(monitor, configuration, operationContext, result);
                }
                monitor.EndTask();
            }
        }