public static ImmutableList<FileModel> Build(IDocumentProcessor processor, DocumentBuildParameters parameters, IMarkdownService markdownService) { var hostServiceCreator = new HostServiceCreator(null); var hostService = hostServiceCreator.CreateHostService( parameters, null, markdownService, null, processor, parameters.Files.EnumerateFiles()); var phaseProcessor = new PhaseProcessor { Handlers = { new PrebuildBuildPhaseHandler(null), new PostbuildPhaseHandler(null, null), } }; phaseProcessor.Process(new List<HostService> { hostService }, parameters.MaxParallelism); return hostService.Models; }
private void Prepare( DocumentBuildParameters parameters, DocumentBuildContext context, TemplateProcessor templateProcessor, string markdownServiceContextHash, out IHostServiceCreator hostServiceCreator, out PhaseProcessor phaseProcessor) { if (IntermediateFolder != null && parameters.ApplyTemplateSettings.TransformDocument) { context.IncrementalBuildContext = IncrementalBuildContext.Create(parameters, CurrentBuildInfo, LastBuildInfo, IntermediateFolder, markdownServiceContextHash); hostServiceCreator = new HostServiceCreatorWithIncremental(context); phaseProcessor = new PhaseProcessor { Handlers = { new PrebuildBuildPhaseHandler(context).WithIncremental(), new PostbuildPhaseHandler(context, templateProcessor).WithIncremental(), } }; } else { hostServiceCreator = new HostServiceCreator(context); phaseProcessor = new PhaseProcessor { Handlers = { new PrebuildBuildPhaseHandler(context), new PostbuildPhaseHandler(context, templateProcessor), } }; } }
private void BuildCore(PhaseProcessor phaseProcessor, List<HostService> hostServices, DocumentBuildContext context) { try { phaseProcessor.Process(hostServices, context.MaxParallelism); } catch (BuildCacheException e) { var message = $"Build cache was corrupted, please try force rebuild `build --force` or clear the cache files in the path: {IntermediateFolder}. Detail error: {e.Message}."; Logger.LogError(message); throw new DocfxException(message, e); } }