private ProcessDependencies ( string outputDirectory, IEnumerable |
||
outputDirectory | string | |
templateBundles | IEnumerable |
|
return | void |
public static List <TemplateManifestItem> Transform(TemplateProcessor processor, List <ManifestItem> manifest, DocumentBuildContext context, ApplyTemplateSettings settings) { if (settings.Options == ApplyTemplateOptions.ExportRawModel || processor == null) { ExportRawModel(manifest, settings); return(null); } using (new LoggerPhaseScope("Apply Templates")) { Logger.LogInfo($"Applying templates to {manifest.Count} model(s)..."); processor.ProcessDependencies(settings.OutputFolder); if (processor.IsEmpty) { Logger.LogWarning("No template is found."); ExportRawModel(manifest, settings); return(null); } Logger.LogVerbose("Start applying template..."); var outputDirectory = context.BuildOutputFolder; var templateManifest = processor.Transform(manifest, context, settings); if (!settings.Options.HasFlag(ApplyTemplateOptions.TransformDocument)) { Logger.LogInfo("Dryrun, no template will be applied to the documents."); } if (templateManifest.Count > 0) { // Save manifest from template // TODO: Keep .manifest for backward-compatability, will remove next sprint var manifestPath = Path.Combine(outputDirectory ?? string.Empty, Constants.ObsoleteManifestFileName); JsonUtility.Serialize(manifestPath, templateManifest); // Logger.LogInfo($"Manifest file saved to {manifestPath}. NOTE: This file is out-of-date and will be removed in version 1.8, if you rely on this file, please change to use {Constants.ManifestFileName} instead."); var manifestJsonPath = Path.Combine(outputDirectory ?? string.Empty, Constants.ManifestFileName); var toc = context.GetTocInfo(); var manifestObject = GenerateManifest(context, templateManifest); JsonUtility.Serialize(manifestJsonPath, manifestObject); Logger.LogInfo($"Manifest file saved to {manifestJsonPath}."); } return(templateManifest); } }
private void ProcessUnloadedTemplateDependency(IEnumerable <HostService> hostServices) { var loaded = Context.ManifestItems; var unloaded = GetUnloadedManifestItems(hostServices); var types = new HashSet <string>(unloaded.Select(m => m.DocumentType).Except(loaded.Select(m => m.DocumentType))); if (types.Count > 0) { TemplateProcessor.ProcessDependencies(types, Context.ApplyTemplateSettings); } foreach (var m in unloaded) { Context.ManifestItems.Add(m); } }
private void ProcessUnloadedTemplateDependency(IEnumerable <HostService> hostServices, int maxParallelism) { var loaded = Context.ManifestItems; IEnumerable <ManifestItem> unloaded; using (new LoggerPhaseScope("GetUnloadedManifestItems", LogLevel.Verbose)) { unloaded = GetUnloadedManifestItems(hostServices, maxParallelism); } var types = new HashSet <string>(unloaded.Select(m => m.DocumentType).Except(loaded.Select(m => m.DocumentType))); if (types.Count > 0) { using (new LoggerPhaseScope("ProcessDependencies", LogLevel.Verbose)) { TemplateProcessor.ProcessDependencies(types, Context.ApplyTemplateSettings); } } foreach (var m in unloaded) { Context.ManifestItems.Add(m); } }