diff options
Diffstat (limited to 'src/WixToolset.Core/CommandLine/CompileCommand.cs')
-rw-r--r-- | src/WixToolset.Core/CommandLine/CompileCommand.cs | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/WixToolset.Core/CommandLine/CompileCommand.cs b/src/WixToolset.Core/CommandLine/CompileCommand.cs index 621571b1..4007c263 100644 --- a/src/WixToolset.Core/CommandLine/CompileCommand.cs +++ b/src/WixToolset.Core/CommandLine/CompileCommand.cs | |||
@@ -6,6 +6,7 @@ namespace WixToolset.Core.CommandLine | |||
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.Xml.Linq; | 7 | using System.Xml.Linq; |
8 | using WixToolset.Data; | 8 | using WixToolset.Data; |
9 | using WixToolset.Extensibility; | ||
9 | using WixToolset.Extensibility.Data; | 10 | using WixToolset.Extensibility.Data; |
10 | using WixToolset.Extensibility.Services; | 11 | using WixToolset.Extensibility.Services; |
11 | 12 | ||
@@ -15,6 +16,7 @@ namespace WixToolset.Core.CommandLine | |||
15 | { | 16 | { |
16 | this.ServiceProvider = serviceProvider; | 17 | this.ServiceProvider = serviceProvider; |
17 | this.Messaging = serviceProvider.GetService<IMessaging>(); | 18 | this.Messaging = serviceProvider.GetService<IMessaging>(); |
19 | this.ExtensionManager = serviceProvider.GetService<IExtensionManager>(); | ||
18 | this.SourceFiles = sources; | 20 | this.SourceFiles = sources; |
19 | this.PreprocessorVariables = preprocessorVariables; | 21 | this.PreprocessorVariables = preprocessorVariables; |
20 | this.Platform = platform; | 22 | this.Platform = platform; |
@@ -24,6 +26,8 @@ namespace WixToolset.Core.CommandLine | |||
24 | 26 | ||
25 | public IMessaging Messaging { get; } | 27 | public IMessaging Messaging { get; } |
26 | 28 | ||
29 | public IExtensionManager ExtensionManager { get; } | ||
30 | |||
27 | private IEnumerable<SourceFile> SourceFiles { get; } | 31 | private IEnumerable<SourceFile> SourceFiles { get; } |
28 | 32 | ||
29 | private IDictionary<string, string> PreprocessorVariables { get; } | 33 | private IDictionary<string, string> PreprocessorVariables { get; } |
@@ -36,16 +40,18 @@ namespace WixToolset.Core.CommandLine | |||
36 | { | 40 | { |
37 | foreach (var sourceFile in this.SourceFiles) | 41 | foreach (var sourceFile in this.SourceFiles) |
38 | { | 42 | { |
39 | var preprocessor = new Preprocessor(this.ServiceProvider); | 43 | var context = this.ServiceProvider.GetService<IPreprocessContext>(); |
40 | preprocessor.IncludeSearchPaths = this.IncludeSearchPaths; | 44 | context.Extensions = this.ExtensionManager.Create<IPreprocessorExtension>(); |
41 | preprocessor.Platform = Platform.X86; // TODO: set this correctly | 45 | context.Platform = this.Platform; |
42 | preprocessor.SourcePath = sourceFile.SourcePath; | 46 | context.IncludeSearchPaths = this.IncludeSearchPaths; |
43 | preprocessor.Variables = new Dictionary<string, string>(this.PreprocessorVariables); | 47 | context.SourcePath = sourceFile.SourcePath; |
48 | context.Variables = this.PreprocessorVariables; | ||
44 | 49 | ||
45 | XDocument document = null; | 50 | XDocument document = null; |
46 | try | 51 | try |
47 | { | 52 | { |
48 | document = preprocessor.Execute(); | 53 | var preprocessor = this.ServiceProvider.GetService<IPreprocessor>(); |
54 | document = preprocessor.Preprocess(context); | ||
49 | } | 55 | } |
50 | catch (WixException e) | 56 | catch (WixException e) |
51 | { | 57 | { |
@@ -57,11 +63,14 @@ namespace WixToolset.Core.CommandLine | |||
57 | continue; | 63 | continue; |
58 | } | 64 | } |
59 | 65 | ||
60 | var compiler = new Compiler(this.ServiceProvider); | 66 | var compileContext = this.ServiceProvider.GetService<ICompileContext>(); |
61 | compiler.OutputPath = sourceFile.OutputPath; | 67 | compileContext.Extensions = this.ExtensionManager.Create<ICompilerExtension>(); |
62 | compiler.Platform = this.Platform; | 68 | compileContext.OutputPath = sourceFile.OutputPath; |
63 | compiler.SourceDocument = document; | 69 | compileContext.Platform = this.Platform; |
64 | var intermediate = compiler.Execute(); | 70 | compileContext.Source = document; |
71 | |||
72 | var compiler = this.ServiceProvider.GetService<ICompiler>(); | ||
73 | var intermediate = compiler.Compile(compileContext); | ||
65 | 74 | ||
66 | intermediate.Save(sourceFile.OutputPath); | 75 | intermediate.Save(sourceFile.OutputPath); |
67 | } | 76 | } |