diff options
author | Rob Mensching <rob@firegiant.com> | 2019-03-01 16:45:55 -0800 |
---|---|---|
committer | Rob Mensching <rob@robmensching.com> | 2019-03-01 16:51:02 -0800 |
commit | 615bc202834ac45a9a107e5fccd900081a4abf74 (patch) | |
tree | ceebc5b3652f0274bee745701a3538439b0275d1 /src/WixToolset.Core/CommandLine | |
parent | 009f11ca9cf8674b40b74888aae90bcd4817828b (diff) | |
download | wix-615bc202834ac45a9a107e5fccd900081a4abf74.tar.gz wix-615bc202834ac45a9a107e5fccd900081a4abf74.tar.bz2 wix-615bc202834ac45a9a107e5fccd900081a4abf74.zip |
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.
Diffstat (limited to 'src/WixToolset.Core/CommandLine')
-rw-r--r-- | src/WixToolset.Core/CommandLine/BuildCommand.cs | 6 | ||||
-rw-r--r-- | src/WixToolset.Core/CommandLine/CompileCommand.cs | 6 |
2 files changed, 6 insertions, 6 deletions
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 | |||
377 | context.SourcePath = sourcePath; | 377 | context.SourcePath = sourcePath; |
378 | context.Variables = preprocessorVariables; | 378 | context.Variables = preprocessorVariables; |
379 | 379 | ||
380 | XDocument document = null; | 380 | IPreprocessResult result = null; |
381 | try | 381 | try |
382 | { | 382 | { |
383 | var preprocessor = this.ServiceProvider.GetService<IPreprocessor>(); | 383 | var preprocessor = this.ServiceProvider.GetService<IPreprocessor>(); |
384 | document = preprocessor.Preprocess(context); | 384 | result = preprocessor.Preprocess(context); |
385 | } | 385 | } |
386 | catch (WixException e) | 386 | catch (WixException e) |
387 | { | 387 | { |
388 | this.Messaging.Write(e.Error); | 388 | this.Messaging.Write(e.Error); |
389 | } | 389 | } |
390 | 390 | ||
391 | return document; | 391 | return result?.Document; |
392 | } | 392 | } |
393 | 393 | ||
394 | private class CommandLine | 394 | 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 | |||
63 | context.SourcePath = sourceFile.SourcePath; | 63 | context.SourcePath = sourceFile.SourcePath; |
64 | context.Variables = this.PreprocessorVariables; | 64 | context.Variables = this.PreprocessorVariables; |
65 | 65 | ||
66 | XDocument document = null; | 66 | IPreprocessResult result = null; |
67 | try | 67 | try |
68 | { | 68 | { |
69 | var preprocessor = this.ServiceProvider.GetService<IPreprocessor>(); | 69 | var preprocessor = this.ServiceProvider.GetService<IPreprocessor>(); |
70 | document = preprocessor.Preprocess(context); | 70 | result = preprocessor.Preprocess(context); |
71 | } | 71 | } |
72 | catch (WixException e) | 72 | catch (WixException e) |
73 | { | 73 | { |
@@ -83,7 +83,7 @@ namespace WixToolset.Core.CommandLine | |||
83 | compileContext.Extensions = this.ExtensionManager.Create<ICompilerExtension>(); | 83 | compileContext.Extensions = this.ExtensionManager.Create<ICompilerExtension>(); |
84 | compileContext.OutputPath = sourceFile.OutputPath; | 84 | compileContext.OutputPath = sourceFile.OutputPath; |
85 | compileContext.Platform = this.Platform; | 85 | compileContext.Platform = this.Platform; |
86 | compileContext.Source = document; | 86 | compileContext.Source = result?.Document; |
87 | 87 | ||
88 | var compiler = this.ServiceProvider.GetService<ICompiler>(); | 88 | var compiler = this.ServiceProvider.GetService<ICompiler>(); |
89 | var intermediate = compiler.Compile(compileContext); | 89 | var intermediate = compiler.Compile(compileContext); |