private void ExecCore() { string originalGlobalNamespaceId = VisitorHelper.GlobalNamespaceId; EnvironmentContext.SetBaseDirectory(BaseDirectory); // If Root Output folder is specified from command line, use it instead of the base directory EnvironmentContext.SetOutputDirectory(OutputFolder ?? BaseDirectory); using (new MSBuildEnvironmentScope()) { foreach (var item in Config) { VisitorHelper.GlobalNamespaceId = item.GlobalNamespaceId; var inputModel = ConvertToInputModel(item); EnvironmentContext.SetGitFeaturesDisabled(item.DisableGitFeatures); // TODO: Use plugin to generate metadata for files with different extension? using (var worker = new ExtractMetadataWorker(inputModel)) { // Use task.run to get rid of current context (causing deadlock in xunit) var task = Task.Run(worker.ExtractMetadataAsync); task.Wait(); } } VisitorHelper.GlobalNamespaceId = originalGlobalNamespaceId; } }
public ValidateBookmarkTest() { _outputFolder = GetRandomFolder(); Directory.CreateDirectory(Path.Combine(_outputFolder, "Dir")); EnvironmentContext.SetBaseDirectory(_outputFolder); EnvironmentContext.SetOutputDirectory(_outputFolder); }
public DocumentBuilderTest() { _inputFolder = GetRandomFolder(); _outputFolder = GetRandomFolder(); _templateFolder = GetRandomFolder(); EnvironmentContext.SetBaseDirectory(Directory.GetCurrentDirectory()); EnvironmentContext.SetOutputDirectory(_outputFolder); }
public TocDocumentProcessorTest() { _outputFolder = GetRandomFolder(); _inputFolder = GetRandomFolder(); _applyTemplateSettings = new ApplyTemplateSettings(_inputFolder, _outputFolder); _applyTemplateSettings.RawModelExportSettings.Export = true; _fileCreator = new FileCreator(_inputFolder); EnvironmentContext.SetBaseDirectory(_inputFolder); EnvironmentContext.SetOutputDirectory(_outputFolder); }
public void Exec(SubCommandRunningContext context) { var config = Config; var baseDirectory = config.BaseDirectory ?? Directory.GetCurrentDirectory(); var intermediateOutputFolder = config.Destination ?? Path.Combine(baseDirectory, "obj"); EnvironmentContext.SetBaseDirectory(baseDirectory); EnvironmentContext.SetOutputDirectory(intermediateOutputFolder); MergeDocument(baseDirectory, intermediateOutputFolder); EnvironmentContext.Clean(); }
private static void ProcessTemplate(string templateName, string inputFolder, IEnumerable <InternalManifestItem> items, object model, string outputFolder, params Tuple <string, string>[] templateFiles) { var rootTemplateFolder = "tmpl"; var templateFolder = Path.Combine(rootTemplateFolder, templateName); if (Directory.Exists(templateFolder)) { Directory.Delete(templateFolder, true); } WriteTemplate(templateFolder, templateFiles); using var resource = new ResourceFinder(null, null).Find(templateFolder); var context = new DocumentBuildContext(inputFolder); var processor = new TemplateProcessor(resource, context, 4); foreach (var item in items) { if (item.ResourceFile != null) { var dir = Path.GetDirectoryName(item.ResourceFile); if (!string.IsNullOrEmpty(dir)) { Directory.CreateDirectory(dir); } File.Create(item.ResourceFile).Dispose(); } if (string.IsNullOrEmpty(item.InputFolder)) { item.InputFolder = Directory.GetCurrentDirectory(); } item.Model = new ModelWithCache(model); } var settings = new ApplyTemplateSettings(inputFolder, outputFolder); EnvironmentContext.SetBaseDirectory(inputFolder); EnvironmentContext.SetOutputDirectory(outputFolder); try { processor.Process(items.ToList(), settings); } finally { EnvironmentContext.Clean(); } }
public ConceptualDocumentProcessorTest() { _outputFolder = GetRandomFolder(); _inputFolder = GetRandomFolder(); _templateFolder = GetRandomFolder(); _fileCreator = new FileCreator(_inputFolder); _defaultFiles = new FileCollection(_inputFolder); _applyTemplateSettings = new ApplyTemplateSettings(_inputFolder, _outputFolder) { RawModelExportSettings = { Export = true }, TransformDocument = true }; EnvironmentContext.SetBaseDirectory(_inputFolder); EnvironmentContext.SetOutputDirectory(_outputFolder); // Prepare conceptual template var templateCreator = new FileCreator(_templateFolder); var file = templateCreator.CreateFile(@"{{{conceptual}}}", "conceptual.html.tmpl", "default"); _templateManager = new TemplateManager(null, null, new List <string> { "default" }, null, _templateFolder); }
public ValidateBookmarkTest() { _outputFolder = GetRandomFolder(); EnvironmentContext.SetBaseDirectory(_outputFolder); EnvironmentContext.SetOutputDirectory(_outputFolder); }
public RemoveDebugInfoTest() { _outputFolder = GetRandomFolder(); EnvironmentContext.SetBaseDirectory(_outputFolder); EnvironmentContext.SetOutputDirectory(_outputFolder); }