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.cs39
1 files changed, 39 insertions, 0 deletions
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 @@
1// 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.
2
3namespace WixToolset.Core
4{
5 using System;
6 using System.Collections.Generic;
7 using WixToolset.Data;
8
9 internal class CompileCommand : ICommand
10 {
11 public CompileCommand(IEnumerable<SourceFile> sources, IDictionary<string, string> preprocessorVariables)
12 {
13 this.PreprocessorVariables = preprocessorVariables;
14 this.SourceFiles = sources;
15 }
16
17 private IEnumerable<SourceFile> SourceFiles { get; }
18
19 private IDictionary<string, string> PreprocessorVariables { get; }
20
21 public int Execute()
22 {
23 var preprocessor = new Preprocessor();
24
25 var compiler = new Compiler();
26
27 foreach (var sourceFile in this.SourceFiles)
28 {
29 var document = preprocessor.Process(sourceFile.SourcePath, this.PreprocessorVariables);
30
31 var intermediate = compiler.Compile(document);
32
33 intermediate.Save(sourceFile.OutputPath);
34 }
35
36 return 0;
37 }
38 }
39}