From 615bc202834ac45a9a107e5fccd900081a4abf74 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 1 Mar 2019 16:45:55 -0800 Subject: Include the preprocessed include files with the processed document This change also cleans up the internal state handling of the preprocesor to pass the processing state around rather than depend on "global state" in member variables. This removes the need to "reset" the member variables before preprocessing which is much cleaner. --- src/WixToolset.Core/CommandLine/BuildCommand.cs | 6 +++--- src/WixToolset.Core/CommandLine/CompileCommand.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/WixToolset.Core/CommandLine') diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index b83aaec4..7e6ddd64 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs @@ -377,18 +377,18 @@ namespace WixToolset.Core.CommandLine context.SourcePath = sourcePath; context.Variables = preprocessorVariables; - XDocument document = null; + IPreprocessResult result = null; try { var preprocessor = this.ServiceProvider.GetService(); - document = preprocessor.Preprocess(context); + result = preprocessor.Preprocess(context); } catch (WixException e) { this.Messaging.Write(e.Error); } - return document; + return result?.Document; } private class CommandLine diff --git a/src/WixToolset.Core/CommandLine/CompileCommand.cs b/src/WixToolset.Core/CommandLine/CompileCommand.cs index 69e35cab..bc37ee8c 100644 --- a/src/WixToolset.Core/CommandLine/CompileCommand.cs +++ b/src/WixToolset.Core/CommandLine/CompileCommand.cs @@ -63,11 +63,11 @@ namespace WixToolset.Core.CommandLine context.SourcePath = sourceFile.SourcePath; context.Variables = this.PreprocessorVariables; - XDocument document = null; + IPreprocessResult result = null; try { var preprocessor = this.ServiceProvider.GetService(); - document = preprocessor.Preprocess(context); + result = preprocessor.Preprocess(context); } catch (WixException e) { @@ -83,7 +83,7 @@ namespace WixToolset.Core.CommandLine compileContext.Extensions = this.ExtensionManager.Create(); compileContext.OutputPath = sourceFile.OutputPath; compileContext.Platform = this.Platform; - compileContext.Source = document; + compileContext.Source = result?.Document; var compiler = this.ServiceProvider.GetService(); var intermediate = compiler.Compile(compileContext); -- cgit v1.2.3-55-g6feb