diff options
Diffstat (limited to 'src/WixToolset.Core/CommandLine/CommandLineParser.cs')
| -rw-r--r-- | src/WixToolset.Core/CommandLine/CommandLineParser.cs | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/WixToolset.Core/CommandLine/CommandLineParser.cs b/src/WixToolset.Core/CommandLine/CommandLineParser.cs index 500bed08..f4bc8ade 100644 --- a/src/WixToolset.Core/CommandLine/CommandLineParser.cs +++ b/src/WixToolset.Core/CommandLine/CommandLineParser.cs | |||
| @@ -114,7 +114,7 @@ namespace WixToolset.Core.CommandLine | |||
| 114 | cmdline.GetNextArgumentOrError(ref cabCachePath); | 114 | cmdline.GetNextArgumentOrError(ref cabCachePath); |
| 115 | return true; | 115 | return true; |
| 116 | 116 | ||
| 117 | case "cultures": | 117 | case "culture": |
| 118 | cmdline.GetNextArgumentOrError(cultures); | 118 | cmdline.GetNextArgumentOrError(cultures); |
| 119 | return true; | 119 | return true; |
| 120 | case "contentsfile": | 120 | case "contentsfile": |
| @@ -210,8 +210,9 @@ namespace WixToolset.Core.CommandLine | |||
| 210 | var sourceFiles = GatherSourceFiles(files, outputFolder); | 210 | var sourceFiles = GatherSourceFiles(files, outputFolder); |
| 211 | var variables = this.GatherPreprocessorVariables(defines); | 211 | var variables = this.GatherPreprocessorVariables(defines); |
| 212 | var bindPathList = this.GatherBindPaths(bindPaths); | 212 | var bindPathList = this.GatherBindPaths(bindPaths); |
| 213 | var filterCultures = CalculateFilterCultures(cultures); | ||
| 213 | var type = CalculateOutputType(outputType, outputFile); | 214 | var type = CalculateOutputType(outputType, outputFile); |
| 214 | return new BuildCommand(this.ServiceProvider, sourceFiles, variables, locFiles, libraryFiles, outputFile, type, cabCachePath, cultures, bindFiles, bindPathList, includePaths, intermediateFolder, contentsFile, outputsFile, builtOutputsFile); | 215 | return new BuildCommand(this.ServiceProvider, sourceFiles, variables, locFiles, libraryFiles, filterCultures, outputFile, type, cabCachePath, bindFiles, bindPathList, includePaths, intermediateFolder, contentsFile, outputsFile, builtOutputsFile); |
| 215 | } | 216 | } |
| 216 | 217 | ||
| 217 | case Commands.Compile: | 218 | case Commands.Compile: |
| @@ -225,6 +226,33 @@ namespace WixToolset.Core.CommandLine | |||
| 225 | return null; | 226 | return null; |
| 226 | } | 227 | } |
| 227 | 228 | ||
| 229 | private static IEnumerable<string> CalculateFilterCultures(List<string> cultures) | ||
| 230 | { | ||
| 231 | var result = new List<string>(); | ||
| 232 | |||
| 233 | if (cultures == null) | ||
| 234 | { | ||
| 235 | } | ||
| 236 | else if (cultures.Count == 1 && cultures[0].Equals("null", StringComparison.OrdinalIgnoreCase)) | ||
| 237 | { | ||
| 238 | // When null is used treat it as if cultures wasn't specified. This is | ||
| 239 | // needed for batching in the MSBuild task since MSBuild doesn't support | ||
| 240 | // empty items. | ||
| 241 | } | ||
| 242 | else | ||
| 243 | { | ||
| 244 | foreach (var culture in cultures) | ||
| 245 | { | ||
| 246 | // Neutral is different from null. For neutral we still want to do culture filtering. | ||
| 247 | // Set the culture to the empty string = identifier for the invariant culture. | ||
| 248 | var filter = (culture.Equals("neutral", StringComparison.OrdinalIgnoreCase)) ? String.Empty : culture; | ||
| 249 | result.Add(filter); | ||
| 250 | } | ||
| 251 | } | ||
| 252 | |||
| 253 | return result; | ||
| 254 | } | ||
| 255 | |||
| 228 | private static OutputType CalculateOutputType(string outputType, string outputFile) | 256 | private static OutputType CalculateOutputType(string outputType, string outputFile) |
| 229 | { | 257 | { |
| 230 | if (String.IsNullOrEmpty(outputType)) | 258 | if (String.IsNullOrEmpty(outputType)) |
