diff options
Diffstat (limited to 'src/WixToolset.Core/CommandLine/CompileCommand.cs')
-rw-r--r-- | src/WixToolset.Core/CommandLine/CompileCommand.cs | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/WixToolset.Core/CommandLine/CompileCommand.cs b/src/WixToolset.Core/CommandLine/CompileCommand.cs index 6bd0f25a..ec1ce602 100644 --- a/src/WixToolset.Core/CommandLine/CompileCommand.cs +++ b/src/WixToolset.Core/CommandLine/CompileCommand.cs | |||
@@ -4,26 +4,31 @@ namespace WixToolset.Core.CommandLine | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.Xml.Linq; | ||
7 | using WixToolset.Data; | 8 | using WixToolset.Data; |
8 | using WixToolset.Extensibility.Data; | 9 | using WixToolset.Extensibility.Data; |
10 | using WixToolset.Extensibility.Services; | ||
9 | 11 | ||
10 | internal class CompileCommand : ICommandLineCommand | 12 | internal class CompileCommand : ICommandLineCommand |
11 | { | 13 | { |
12 | public CompileCommand(IServiceProvider serviceProvider, IEnumerable<SourceFile> sources, IDictionary<string, string> preprocessorVariables) | 14 | public CompileCommand(IServiceProvider serviceProvider, IEnumerable<SourceFile> sources, IDictionary<string, string> preprocessorVariables) |
13 | { | 15 | { |
14 | this.PreprocessorVariables = preprocessorVariables; | ||
15 | this.ServiceProvider = serviceProvider; | 16 | this.ServiceProvider = serviceProvider; |
17 | this.Messaging = serviceProvider.GetService<IMessaging>(); | ||
16 | this.SourceFiles = sources; | 18 | this.SourceFiles = sources; |
19 | this.PreprocessorVariables = preprocessorVariables; | ||
17 | } | 20 | } |
18 | 21 | ||
19 | private IServiceProvider ServiceProvider { get; } | 22 | private IServiceProvider ServiceProvider { get; } |
20 | 23 | ||
21 | public IEnumerable<string> IncludeSearchPaths { get; } | 24 | public IMessaging Messaging { get; } |
22 | 25 | ||
23 | private IEnumerable<SourceFile> SourceFiles { get; } | 26 | private IEnumerable<SourceFile> SourceFiles { get; } |
24 | 27 | ||
25 | private IDictionary<string, string> PreprocessorVariables { get; } | 28 | private IDictionary<string, string> PreprocessorVariables { get; } |
26 | 29 | ||
30 | public IEnumerable<string> IncludeSearchPaths { get; } | ||
31 | |||
27 | public int Execute() | 32 | public int Execute() |
28 | { | 33 | { |
29 | foreach (var sourceFile in this.SourceFiles) | 34 | foreach (var sourceFile in this.SourceFiles) |
@@ -33,7 +38,21 @@ namespace WixToolset.Core.CommandLine | |||
33 | preprocessor.Platform = Platform.X86; // TODO: set this correctly | 38 | preprocessor.Platform = Platform.X86; // TODO: set this correctly |
34 | preprocessor.SourcePath = sourceFile.SourcePath; | 39 | preprocessor.SourcePath = sourceFile.SourcePath; |
35 | preprocessor.Variables = new Dictionary<string, string>(this.PreprocessorVariables); | 40 | preprocessor.Variables = new Dictionary<string, string>(this.PreprocessorVariables); |
36 | var document = preprocessor.Execute(); | 41 | |
42 | XDocument document = null; | ||
43 | try | ||
44 | { | ||
45 | document = preprocessor.Execute(); | ||
46 | } | ||
47 | catch (WixException e) | ||
48 | { | ||
49 | this.Messaging.Write(e.Error); | ||
50 | } | ||
51 | |||
52 | if (this.Messaging.EncounteredError) | ||
53 | { | ||
54 | continue; | ||
55 | } | ||
37 | 56 | ||
38 | var compiler = new Compiler(this.ServiceProvider); | 57 | var compiler = new Compiler(this.ServiceProvider); |
39 | compiler.OutputPath = sourceFile.OutputPath; | 58 | compiler.OutputPath = sourceFile.OutputPath; |