From 95f2f4425b900374c7d7b583ae810b096121b3c4 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 2 Dec 2017 00:46:11 -0800 Subject: Implement support for IExtensionCommandLine and IPreprocessorExtension --- src/WixToolset.Core/CommandLine/CompileCommand.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/WixToolset.Core/CommandLine/CompileCommand.cs') 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 { using System; using System.Collections.Generic; + using System.Linq; using WixToolset.Data; using WixToolset.Extensibility; using WixToolset.Extensibility.Services; @@ -22,6 +23,8 @@ namespace WixToolset.Core private IExtensionManager ExtensionManager { get; } + public IEnumerable IncludeSearchPaths { get; } + private IEnumerable SourceFiles { get; } private IDictionary PreprocessorVariables { get; } @@ -30,8 +33,16 @@ namespace WixToolset.Core { foreach (var sourceFile in this.SourceFiles) { + var preprocessContext = this.ServiceProvider.GetService(); + preprocessContext.Messaging = Messaging.Instance; + preprocessContext.Extensions = this.ExtensionManager.Create(); + preprocessContext.Platform = Platform.X86; // TODO: set this correctly + preprocessContext.IncludeSearchPaths = this.IncludeSearchPaths?.ToList() ?? new List(); + preprocessContext.SourceFile = sourceFile.SourcePath; + preprocessContext.Variables = new Dictionary(this.PreprocessorVariables); + var preprocessor = new Preprocessor(); - var document = preprocessor.Process(sourceFile.SourcePath, this.PreprocessorVariables); + var document = preprocessor.Process(preprocessContext); var compileContext = this.ServiceProvider.GetService(); compileContext.Messaging = Messaging.Instance; -- cgit v1.2.3-55-g6feb