From d3d3649a68cb1fa589fdd987a6690dbd5d671f0d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 17 Sep 2017 15:35:20 -0700 Subject: Initial code commit --- src/WixToolset.Core/CommandLine/CompileCommand.cs | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/WixToolset.Core/CommandLine/CompileCommand.cs (limited to 'src/WixToolset.Core/CommandLine/CompileCommand.cs') diff --git a/src/WixToolset.Core/CommandLine/CompileCommand.cs b/src/WixToolset.Core/CommandLine/CompileCommand.cs new file mode 100644 index 00000000..17847b57 --- /dev/null +++ b/src/WixToolset.Core/CommandLine/CompileCommand.cs @@ -0,0 +1,39 @@ +// 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 : ICommand + { + 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; + } + } +} -- cgit v1.2.3-55-g6feb