aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/CommandLine/CommandLineParser.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-12-31 02:17:12 -0800
committerRob Mensching <rob@firegiant.com>2017-12-31 02:17:12 -0800
commit651ad904724f32f5e993fa73aa11a611d95a1a10 (patch)
treec3f3541f36fe0dda04f2b756b59a0d7c535dbffa /src/WixToolset.Core/CommandLine/CommandLineParser.cs
parent84d1f05fee656c01938613bcc50bd8139006bbf6 (diff)
downloadwix-651ad904724f32f5e993fa73aa11a611d95a1a10.tar.gz
wix-651ad904724f32f5e993fa73aa11a611d95a1a10.tar.bz2
wix-651ad904724f32f5e993fa73aa11a611d95a1a10.zip
Support filtering localizations by culture
Diffstat (limited to 'src/WixToolset.Core/CommandLine/CommandLineParser.cs')
-rw-r--r--src/WixToolset.Core/CommandLine/CommandLineParser.cs32
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))