Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
        private IBuilder RunPostProcessors(Project[] prjs, IBuilder input, IEnumerable<Project> projects)
        {
            var modules = prjs.Select(p => p.Module).Distinct().ToList();
            var postProcessableItems = prjs.Concat(modules.Cast<IPostProcessorsHolder>()).ToList();

            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)
                    {
                        resultBuilders.Add(postProcessor);
                    }
                }
            }

            if (resultBuilders.Count == 0)
            {
                return input;
            }
            else
            {
                return coreBuilderFactory.CreateMergingBuilder(resultBuilders.Concat(new[] {input}), new ProjectBuilderTag(String.Format("Post processors of {0}", String.Join(", ", prjs.Select(p => p.Name))), projects));
            }
        }