Exemplo n.º 1
0
        private List <TemplateManifestItem> ProcessCore(List <ManifestItem> items, DocumentBuildContext context, ApplyTemplateSettings settings, IDictionary <string, object> globals)
        {
            var manifest = new ConcurrentBag <TemplateManifestItem>();
            var systemAttributeGenerator = new SystemMetadataGenerator(context);
            var transformer = new TemplateModelTransformer(context, _templateCollection, settings, globals);

            items.RunAll(
                item =>
            {
                var manifestItem = transformer.Transform(item);
                if (manifestItem.OutputFiles?.Count > 0)
                {
                    manifest.Add(manifestItem);
                }
            },
                context.MaxParallelism);

            var itemsToRemove = new List <string>();

            foreach (var duplicates in from m in manifest
                     from output in m.OutputFiles.Values
                     group m.OriginalFile by output into g
                     where g.Count() > 1
                     select g)
            {
                Logger.LogWarning($"Overwrite occurs while input files \"{string.Join(", ", duplicates)}\" writing to the same output file \"{duplicates.Key}\"");
                itemsToRemove.AddRange(duplicates.Skip(1));
            }

            return(manifest.Where(m => !itemsToRemove.Contains(m.OriginalFile)).ToList());
        }
Exemplo n.º 2
0
        private List <ManifestItem> ProcessCore(List <InternalManifestItem> items, ApplyTemplateSettings settings, IDictionary <string, object> globals)
        {
            var manifest    = new ConcurrentBag <ManifestItem>();
            var transformer = new TemplateModelTransformer(_context, _templateCollection, settings, globals);

            items.RunAll(
                item =>
            {
                using (new LoggerFileScope(item.LocalPathFromRoot))
                {
                    manifest.Add(transformer.Transform(item));
                }
            },
                _maxParallelism);
            return(manifest.ToList());
        }
Exemplo n.º 3
0
        private List <ManifestItem> ProcessCore(List <InternalManifestItem> items, DocumentBuildContext context, ApplyTemplateSettings settings, IDictionary <string, object> globals)
        {
            var manifest = new ConcurrentBag <ManifestItem>();
            var systemAttributeGenerator = new SystemMetadataGenerator(context);
            var transformer = new TemplateModelTransformer(context, _templateCollection, settings, globals);

            items.RunAll(
                item =>
            {
                var manifestItem = transformer.Transform(item);
                if (manifestItem.OutputFiles?.Count > 0)
                {
                    manifest.Add(manifestItem);
                }
            },
                context.MaxParallelism);
            return(manifest.ToList());
        }
Exemplo n.º 4
0
        private List<ManifestItem> ProcessCore(List<InternalManifestItem> items, DocumentBuildContext context, ApplyTemplateSettings settings, IDictionary<string, object> globals)
        {
            var manifest = new ConcurrentBag<ManifestItem>();
            var systemAttributeGenerator = new SystemMetadataGenerator(context);
            var transformer = new TemplateModelTransformer(context, _templateCollection, settings, globals);
            items.RunAll(
                item =>
                {
                    using (new LoggerFileScope(item.LocalPathFromRoot))
                    {
                        var manifestItem = transformer.Transform(item);
                        if (manifestItem.OutputFiles?.Count > 0)
                        {
                            manifest.Add(manifestItem);
                        }
                    }
                },
                context.MaxParallelism);
            return manifest.ToList();

        }