aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/CommandLine/CompileCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/CommandLine/CompileCommand.cs')
-rw-r--r--src/WixToolset.Core/CommandLine/CompileCommand.cs13
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;