// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. namespace WixToolset.Core { using System; using System.Collections.Generic; using WixToolset.Data; internal class CompileCommand : ICommandLineCommand { public CompileCommand(IEnumerable sources, IDictionary preprocessorVariables) { this.PreprocessorVariables = preprocessorVariables; this.SourceFiles = sources; } 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 document = preprocessor.Process(sourceFile.SourcePath, this.PreprocessorVariables); var intermediate = compiler.Compile(document); intermediate.Save(sourceFile.OutputPath); } return 0; } } }