aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/CommandLine/CommandLine.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-12-19 12:25:40 -0800
committerRob Mensching <rob@firegiant.com>2017-12-19 12:25:40 -0800
commit155a6e96346e0cb3d9ab6f5372fa29b46ebaee89 (patch)
tree59d1f151bfde8068b6014b05b5c8cfea3402c974 /src/WixToolset.Core/CommandLine/CommandLine.cs
parent6f1665ed759b31bd095f186f9239232c653597cd (diff)
downloadwix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.gz
wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.bz2
wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.zip
Integrate simplified message handling
Diffstat (limited to 'src/WixToolset.Core/CommandLine/CommandLine.cs')
-rw-r--r--src/WixToolset.Core/CommandLine/CommandLine.cs26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/WixToolset.Core/CommandLine/CommandLine.cs b/src/WixToolset.Core/CommandLine/CommandLine.cs
index 9bedca9a..9db1b2f9 100644
--- a/src/WixToolset.Core/CommandLine/CommandLine.cs
+++ b/src/WixToolset.Core/CommandLine/CommandLine.cs
@@ -24,12 +24,10 @@ namespace WixToolset.Core
24 24
25 internal class CommandLine : ICommandLine, IParseCommandLine 25 internal class CommandLine : ICommandLine, IParseCommandLine
26 { 26 {
27 public CommandLine()
28 {
29 }
30
31 private IServiceProvider ServiceProvider { get; set; } 27 private IServiceProvider ServiceProvider { get; set; }
32 28
29 private IMessaging Messaging { get; set; }
30
33 public static string ExpectedArgument { get; } = "expected argument"; 31 public static string ExpectedArgument { get; } = "expected argument";
34 32
35 public string ActiveCommand { get; private set; } 33 public string ActiveCommand { get; private set; }
@@ -48,6 +46,8 @@ namespace WixToolset.Core
48 { 46 {
49 this.ServiceProvider = context.ServiceProvider; 47 this.ServiceProvider = context.ServiceProvider;
50 48
49 this.Messaging = context.Messaging ?? this.ServiceProvider.GetService<IMessaging>();
50
51 this.ExtensionManager = context.ExtensionManager ?? this.ServiceProvider.GetService<IExtensionManager>(); 51 this.ExtensionManager = context.ExtensionManager ?? this.ServiceProvider.GetService<IExtensionManager>();
52 52
53 var args = context.ParsedArguments ?? Array.Empty<string>(); 53 var args = context.ParsedArguments ?? Array.Empty<string>();
@@ -186,7 +186,7 @@ namespace WixToolset.Core
186 } 186 }
187 }); 187 });
188 188
189 Messaging.Instance.ShowVerboseMessages = verbose; 189 this.Messaging.ShowVerboseMessages = verbose;
190 190
191 if (showVersion) 191 if (showVersion)
192 { 192 {
@@ -208,17 +208,17 @@ namespace WixToolset.Core
208 case Commands.Build: 208 case Commands.Build:
209 { 209 {
210 var sourceFiles = GatherSourceFiles(files, outputFolder); 210 var sourceFiles = GatherSourceFiles(files, outputFolder);
211 var variables = GatherPreprocessorVariables(defines); 211 var variables = this.GatherPreprocessorVariables(defines);
212 var bindPathList = GatherBindPaths(bindPaths); 212 var bindPathList = this.GatherBindPaths(bindPaths);
213 var type = CalculateOutputType(outputType, outputFile); 213 var type = CalculateOutputType(outputType, outputFile);
214 return new BuildCommand(this.ServiceProvider, this.ExtensionManager, sourceFiles, variables, locFiles, libraryFiles, outputFile, type, cabCachePath, cultures, bindFiles, bindPathList, intermediateFolder, contentsFile, outputsFile, builtOutputsFile, wixProjectFile); 214 return new BuildCommand(this.ServiceProvider, this.Messaging, this.ExtensionManager, sourceFiles, variables, locFiles, libraryFiles, outputFile, type, cabCachePath, cultures, bindFiles, bindPathList, intermediateFolder, contentsFile, outputsFile, builtOutputsFile, wixProjectFile);
215 } 215 }
216 216
217 case Commands.Compile: 217 case Commands.Compile:
218 { 218 {
219 var sourceFiles = GatherSourceFiles(files, outputFolder); 219 var sourceFiles = GatherSourceFiles(files, outputFolder);
220 var variables = GatherPreprocessorVariables(defines); 220 var variables = GatherPreprocessorVariables(defines);
221 return new CompileCommand(this.ServiceProvider, this.ExtensionManager, sourceFiles, variables); 221 return new CompileCommand(this.ServiceProvider, this.Messaging, this.ExtensionManager, sourceFiles, variables);
222 } 222 }
223 } 223 }
224 224
@@ -305,7 +305,7 @@ namespace WixToolset.Core
305 return files; 305 return files;
306 } 306 }
307 307
308 private static IDictionary<string, string> GatherPreprocessorVariables(IEnumerable<string> defineConstants) 308 private IDictionary<string, string> GatherPreprocessorVariables(IEnumerable<string> defineConstants)
309 { 309 {
310 var variables = new Dictionary<string, string>(); 310 var variables = new Dictionary<string, string>();
311 311
@@ -315,7 +315,7 @@ namespace WixToolset.Core
315 315
316 if (variables.ContainsKey(value[0])) 316 if (variables.ContainsKey(value[0]))
317 { 317 {
318 Messaging.Instance.OnMessage(WixErrors.DuplicateVariableDefinition(value[0], (1 == value.Length) ? String.Empty : value[1], variables[value[0]])); 318 this.Messaging.Write(ErrorMessages.DuplicateVariableDefinition(value[0], (1 == value.Length) ? String.Empty : value[1], variables[value[0]]));
319 continue; 319 continue;
320 } 320 }
321 321
@@ -325,7 +325,7 @@ namespace WixToolset.Core
325 return variables; 325 return variables;
326 } 326 }
327 327
328 private static IEnumerable<BindPath> GatherBindPaths(IEnumerable<string> bindPaths) 328 private IEnumerable<BindPath> GatherBindPaths(IEnumerable<string> bindPaths)
329 { 329 {
330 var result = new List<BindPath>(); 330 var result = new List<BindPath>();
331 331
@@ -339,7 +339,7 @@ namespace WixToolset.Core
339 } 339 }
340 else if (File.Exists(bp.Path)) 340 else if (File.Exists(bp.Path))
341 { 341 {
342 Messaging.Instance.OnMessage(WixErrors.ExpectedDirectoryGotFile("-bindpath", bp.Path)); 342 this.Messaging.Write(ErrorMessages.ExpectedDirectoryGotFile("-bindpath", bp.Path));
343 } 343 }
344 } 344 }
345 345