private IBuilder RunPostProcessors(IBuildContext context, Project[] prjs, IBuilder input) { var modules = prjs.Select(p => p.Module).Distinct().ToList(); var postProcessableItems = prjs.Concat(modules.Cast <IPostProcessorsHolder>()).ToList(); var productName = analyzer.GetProductName(modules); if (productName != null) { postProcessableItems.Add(suite.GetProduct(productName)); } var factories = postProcessorFactories.ToList(); var resultBuilders = new List <IPostProcessor>(); foreach (var ppHolder in postProcessableItems) { foreach (var pp in ppHolder.PostProcessors) { var postProcessor = factories.Select(f => f.CreatePostProcessorFor(ppHolder, pp, new [] { input })).FirstOrDefault(p => p != null); if (postProcessor != null) { postProcessor.AddToContext(context); resultBuilders.Add(postProcessor); } } } if (resultBuilders.Count == 0) { return(input); } else { var merger = new MergingBuilder(resultBuilders.Concat(new[] { input })); merger.AddToContext(context); return(merger); } }
/// <summary> /// Generates a file name for a VS solution file which will contain the given set of projects. /// </summary> /// <param name="projects">Set of projects to be included in the SLN file</param> /// <returns>Returns a valid file name without extension</returns> public string GetName(IEnumerable <Project> projects) { var prjs = projects.ToList(); var matches = analyzer.GetCoveredModules(prjs).ToList(); if (matches.Count > 0 && matches.All(m => !m.Partial)) { bool?allTests = AllHasTests(matches); if (allTests.HasValue) { var productName = analyzer.GetProductName(matches.Select(m => m.Module)); if (productName != null) { // this covers a product return(GetNameBasedOnProduct(productName, allTests.Value)); } else if (matches.Count <= MaxModuleCount) { return(GetNameBasedOnMultipleModules(matches.Select(m => m.Module), allTests.Value)); } // otherwise: many modules -> fallback } // otherwise: contains modules both with tests included and without included -> fallback } // otherwise: there are partial matches -> fallback if (prjs.Count == 1) { // Single project return(GetNameForSingleProject(prjs[0])); } else { return(fallbackGenerator.GetName(prjs)); } }