Beispiel #1
0
        public DocumentBuilder(
            IEnumerable <Assembly> assemblies,
            ImmutableArray <string> postProcessorNames,
            string templateHash,
            string intermediateFolder = null,
            string commitFromSHA      = null,
            string commitToSHA        = null,
            bool cleanupCacheHistory  = false)
        {
            Logger.LogVerbose("Loading plug-in...");
            using (new LoggerPhaseScope("ImportPlugins", LogLevel.Verbose))
            {
                var assemblyList = assemblies?.ToList() ?? new List <Assembly>();
                assemblyList.Add(typeof(DocumentBuilder).Assembly);
                _container = CompositionContainer.GetContainer(assemblyList);
                _container.SatisfyImports(this);
                _assemblyList = assemblyList;
            }
            Logger.LogInfo($"{Processors.Count()} plug-in(s) loaded.");
            foreach (var processor in Processors)
            {
                Logger.LogVerbose($"\t{processor.Name} with build steps ({string.Join(", ", from bs in processor.BuildSteps orderby bs.BuildOrder select bs.Name)})");
            }

            _commitFromSHA         = commitFromSHA;
            _commitToSHA           = commitToSHA;
            _templateHash          = templateHash;
            _intermediateFolder    = intermediateFolder;
            _cleanupCacheHistory   = cleanupCacheHistory;
            _postProcessorsManager = new PostProcessorsManager(_container, postProcessorNames);
        }
Beispiel #2
0
 public DocumentBuilder(
     IEnumerable <Assembly> assemblies,
     ImmutableArray <string> postProcessorNames,
     string templateHash,
     string intermediateFolder = null,
     string commitFromSHA      = null,
     string commitToSHA        = null)
 {
     Logger.LogVerbose("Loading plug-in...");
     using (new LoggerPhaseScope("ImportPlugins", LogLevel.Verbose))
     {
         var assemblyList = assemblies?.ToList() ?? new List <Assembly>();
         assemblyList.Add(typeof(DocumentBuilder).Assembly);
         _container = CompositionContainer.GetContainer(assemblyList);
         _container.SatisfyImports(this);
         _currentBuildInfo.CommitFromSHA = commitFromSHA;
         _currentBuildInfo.CommitToSHA   = commitToSHA;
         if (intermediateFolder != null)
         {
             _currentBuildInfo.PluginHash    = ComputePluginHash(assemblyList);
             _currentBuildInfo.TemplateHash  = templateHash;
             _currentBuildInfo.DirectoryName = IncrementalUtility.CreateRandomDirectory(Environment.ExpandEnvironmentVariables(intermediateFolder));
         }
     }
     Logger.LogInfo($"{Processors.Count()} plug-in(s) loaded.");
     foreach (var processor in Processors)
     {
         Logger.LogVerbose($"\t{processor.Name} with build steps ({string.Join(", ", from bs in processor.BuildSteps orderby bs.BuildOrder select bs.Name)})");
     }
     _intermediateFolder    = intermediateFolder;
     _lastBuildInfo         = BuildInfo.Load(_intermediateFolder);
     _postProcessorsManager = new PostProcessorsManager(_container, postProcessorNames);
 }