From 2bb37beda887d120a0ddabf874ad25357101faa1 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 1 Nov 2017 10:59:45 -0700 Subject: Update to WiX Intermediate Representation --- src/WixToolset.Core/CommandLine/CompileCommand.cs | 27 ++++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) (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 855e7c6a..58ba9d29 100644 --- a/src/WixToolset.Core/CommandLine/CompileCommand.cs +++ b/src/WixToolset.Core/CommandLine/CompileCommand.cs @@ -2,32 +2,47 @@ namespace WixToolset.Core { + using System; using System.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility; using WixToolset.Extensibility.Services; internal class CompileCommand : ICommandLineCommand { - public CompileCommand(IEnumerable sources, IDictionary preprocessorVariables) + public CompileCommand(IServiceProvider serviceProvider, IExtensionManager extensions, IEnumerable sources, IDictionary preprocessorVariables) { this.PreprocessorVariables = preprocessorVariables; + this.ServiceProvider = serviceProvider; + this.ExtensionManager = extensions; this.SourceFiles = sources; } + private IServiceProvider ServiceProvider { get; } + + private IExtensionManager ExtensionManager { get; } + private IEnumerable SourceFiles { get; } private IDictionary PreprocessorVariables { get; } public int Execute() { - var preprocessor = new Preprocessor(); - - var compiler = new Compiler(); - foreach (var sourceFile in this.SourceFiles) { + var preprocessor = new Preprocessor(); var document = preprocessor.Process(sourceFile.SourcePath, this.PreprocessorVariables); - var intermediate = compiler.Compile(document); + var compileContext = this.ServiceProvider.GetService(); + compileContext.Messaging = Messaging.Instance; + compileContext.CompilationId = Guid.NewGuid().ToString("N"); + compileContext.Extensions = this.ExtensionManager.Create(); + compileContext.OutputPath = sourceFile.OutputPath; + compileContext.Platform = Platform.X86; // TODO: set this correctly + compileContext.Source = document; + + var compiler = new Compiler(); + var intermediate = compiler.Compile(compileContext); intermediate.Save(sourceFile.OutputPath); } -- cgit v1.2.3-55-g6feb