aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/CommandLine/CommandLineParser.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/CommandLine/CommandLineParser.cs')
-rw-r--r--src/WixToolset.Core/CommandLine/CommandLineParser.cs23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/WixToolset.Core/CommandLine/CommandLineParser.cs b/src/WixToolset.Core/CommandLine/CommandLineParser.cs
index b0ad6cad..d0484e45 100644
--- a/src/WixToolset.Core/CommandLine/CommandLineParser.cs
+++ b/src/WixToolset.Core/CommandLine/CommandLineParser.cs
@@ -59,6 +59,7 @@ namespace WixToolset.Core.CommandLine
59 var outputFolder = String.Empty; 59 var outputFolder = String.Empty;
60 var outputFile = String.Empty; 60 var outputFile = String.Empty;
61 var outputType = String.Empty; 61 var outputType = String.Empty;
62 var platformType = String.Empty;
62 var verbose = false; 63 var verbose = false;
63 var files = new List<string>(); 64 var files = new List<string>();
64 var defines = new List<string>(); 65 var defines = new List<string>();
@@ -91,6 +92,11 @@ namespace WixToolset.Core.CommandLine
91 cmdline.ShowHelp = true; 92 cmdline.ShowHelp = true;
92 return true; 93 return true;
93 94
95 case "arch":
96 case "platform":
97 platformType = parser.GetNextArgumentOrError(arg);
98 return true;
99
94 case "bindfiles": 100 case "bindfiles":
95 bindFiles = true; 101 bindFiles = true;
96 return true; 102 return true;
@@ -211,14 +217,16 @@ namespace WixToolset.Core.CommandLine
211 var bindPathList = this.GatherBindPaths(bindPaths); 217 var bindPathList = this.GatherBindPaths(bindPaths);
212 var filterCultures = CalculateFilterCultures(cultures); 218 var filterCultures = CalculateFilterCultures(cultures);
213 var type = CalculateOutputType(outputType, outputFile); 219 var type = CalculateOutputType(outputType, outputFile);
214 return new BuildCommand(this.ServiceProvider, sourceFiles, variables, locFiles, libraryFiles, filterCultures, outputFile, type, cabCachePath, bindFiles, bindPathList, includePaths, intermediateFolder, contentsFile, outputsFile, builtOutputsFile); 220 var platform = CalculatePlatform(platformType);
221 return new BuildCommand(this.ServiceProvider, sourceFiles, variables, locFiles, libraryFiles, filterCultures, outputFile, type, platform, cabCachePath, bindFiles, bindPathList, includePaths, intermediateFolder, contentsFile, outputsFile, builtOutputsFile);
215 } 222 }
216 223
217 case Commands.Compile: 224 case Commands.Compile:
218 { 225 {
219 var sourceFiles = GatherSourceFiles(files, outputFolder); 226 var sourceFiles = GatherSourceFiles(files, outputFolder);
220 var variables = GatherPreprocessorVariables(defines); 227 var variables = this.GatherPreprocessorVariables(defines);
221 return new CompileCommand(this.ServiceProvider, sourceFiles, variables); 228 var platform = CalculatePlatform(platformType);
229 return new CompileCommand(this.ServiceProvider, sourceFiles, variables, platform);
222 } 230 }
223 } 231 }
224 232
@@ -297,6 +305,11 @@ namespace WixToolset.Core.CommandLine
297 return OutputType.Unknown; 305 return OutputType.Unknown;
298 } 306 }
299 307
308 private static Platform CalculatePlatform(string platformType)
309 {
310 return Enum.TryParse(platformType, true, out Platform platform) ? platform : Platform.X86;
311 }
312
300 private ICommandLineParser Parse(ICommandLineContext context, Func<CommandLineParser, string, bool> parseCommand, Func<CommandLineParser, IParseCommandLine, string, bool> parseArgument) 313 private ICommandLineParser Parse(ICommandLineContext context, Func<CommandLineParser, string, bool> parseCommand, Func<CommandLineParser, IParseCommandLine, string, bool> parseArgument)
301 { 314 {
302 var extensions = this.ExtensionManager.Create<IExtensionCommandLine>(); 315 var extensions = this.ExtensionManager.Create<IExtensionCommandLine>();
@@ -372,7 +385,7 @@ namespace WixToolset.Core.CommandLine
372 385
373 foreach (var pair in defineConstants) 386 foreach (var pair in defineConstants)
374 { 387 {
375 string[] value = pair.Split(new[] { '=' }, 2); 388 var value = pair.Split(new[] { '=' }, 2);
376 389
377 if (variables.ContainsKey(value[0])) 390 if (variables.ContainsKey(value[0]))
378 { 391 {
@@ -422,7 +435,7 @@ namespace WixToolset.Core.CommandLine
422 435
423 public static BindPath ParseBindPath(string bindPath) 436 public static BindPath ParseBindPath(string bindPath)
424 { 437 {
425 string[] namedPath = bindPath.Split(BindPathSplit, 2); 438 var namedPath = bindPath.Split(BindPathSplit, 2);
426 return (1 == namedPath.Length) ? new BindPath(namedPath[0]) : new BindPath(namedPath[0], namedPath[1]); 439 return (1 == namedPath.Length) ? new BindPath(namedPath[0]) : new BindPath(namedPath[0], namedPath[1]);
427 } 440 }
428 } 441 }