diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-12-02 00:46:11 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-12-02 00:46:11 -0800 |
| commit | 95f2f4425b900374c7d7b583ae810b096121b3c4 (patch) | |
| tree | 0ede0972e849bdc2c57e9535e31fbdd0df113f8d /src/WixToolset.Core/CommandLine/CompileCommand.cs | |
| parent | 720c4a0db1a2fb2aa3e08e5c99d5198873e448ba (diff) | |
| download | wix-95f2f4425b900374c7d7b583ae810b096121b3c4.tar.gz wix-95f2f4425b900374c7d7b583ae810b096121b3c4.tar.bz2 wix-95f2f4425b900374c7d7b583ae810b096121b3c4.zip | |
Implement support for IExtensionCommandLine and IPreprocessorExtension
Diffstat (limited to 'src/WixToolset.Core/CommandLine/CompileCommand.cs')
| -rw-r--r-- | src/WixToolset.Core/CommandLine/CompileCommand.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/WixToolset.Core/CommandLine/CompileCommand.cs b/src/WixToolset.Core/CommandLine/CompileCommand.cs index 58ba9d29..e7fcdd4d 100644 --- a/src/WixToolset.Core/CommandLine/CompileCommand.cs +++ b/src/WixToolset.Core/CommandLine/CompileCommand.cs | |||
| @@ -4,6 +4,7 @@ namespace WixToolset.Core | |||
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using System.Linq; | ||
| 7 | using WixToolset.Data; | 8 | using WixToolset.Data; |
| 8 | using WixToolset.Extensibility; | 9 | using WixToolset.Extensibility; |
| 9 | using WixToolset.Extensibility.Services; | 10 | using WixToolset.Extensibility.Services; |
| @@ -22,6 +23,8 @@ namespace WixToolset.Core | |||
| 22 | 23 | ||
| 23 | private IExtensionManager ExtensionManager { get; } | 24 | private IExtensionManager ExtensionManager { get; } |
| 24 | 25 | ||
| 26 | public IEnumerable<string> IncludeSearchPaths { get; } | ||
| 27 | |||
| 25 | private IEnumerable<SourceFile> SourceFiles { get; } | 28 | private IEnumerable<SourceFile> SourceFiles { get; } |
| 26 | 29 | ||
| 27 | private IDictionary<string, string> PreprocessorVariables { get; } | 30 | private IDictionary<string, string> PreprocessorVariables { get; } |
| @@ -30,8 +33,16 @@ namespace WixToolset.Core | |||
| 30 | { | 33 | { |
| 31 | foreach (var sourceFile in this.SourceFiles) | 34 | foreach (var sourceFile in this.SourceFiles) |
| 32 | { | 35 | { |
| 36 | var preprocessContext = this.ServiceProvider.GetService<IPreprocessContext>(); | ||
| 37 | preprocessContext.Messaging = Messaging.Instance; | ||
| 38 | preprocessContext.Extensions = this.ExtensionManager.Create<IPreprocessorExtension>(); | ||
| 39 | preprocessContext.Platform = Platform.X86; // TODO: set this correctly | ||
| 40 | preprocessContext.IncludeSearchPaths = this.IncludeSearchPaths?.ToList() ?? new List<string>(); | ||
| 41 | preprocessContext.SourceFile = sourceFile.SourcePath; | ||
| 42 | preprocessContext.Variables = new Dictionary<string, string>(this.PreprocessorVariables); | ||
| 43 | |||
| 33 | var preprocessor = new Preprocessor(); | 44 | var preprocessor = new Preprocessor(); |
| 34 | var document = preprocessor.Process(sourceFile.SourcePath, this.PreprocessorVariables); | 45 | var document = preprocessor.Process(preprocessContext); |
| 35 | 46 | ||
| 36 | var compileContext = this.ServiceProvider.GetService<ICompileContext>(); | 47 | var compileContext = this.ServiceProvider.GetService<ICompileContext>(); |
| 37 | compileContext.Messaging = Messaging.Instance; | 48 | compileContext.Messaging = Messaging.Instance; |
