aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/CommandLine/CompileCommand.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-09-17 15:35:20 -0700
committerRob Mensching <rob@firegiant.com>2017-09-17 16:00:11 -0700
commitd3d3649a68cb1fa589fdd987a6690dbd5d671f0d (patch)
tree44fe37ee352b7e3a355cc1e08b1d7d5988c14cc0 /src/WixToolset.Core/CommandLine/CompileCommand.cs
parenta62610d23d6feb98be3b1e529a4e81b19d77d9d8 (diff)
downloadwix-d3d3649a68cb1fa589fdd987a6690dbd5d671f0d.tar.gz
wix-d3d3649a68cb1fa589fdd987a6690dbd5d671f0d.tar.bz2
wix-d3d3649a68cb1fa589fdd987a6690dbd5d671f0d.zip
Initial code commit
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}