diff options
Diffstat (limited to 'src/WixToolset.Core/CommandLine')
-rw-r--r-- | src/WixToolset.Core/CommandLine/BuildCommand.cs | 9 | ||||
-rw-r--r-- | src/WixToolset.Core/CommandLine/CommandLineParser.cs | 32 |
2 files changed, 35 insertions, 6 deletions
diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index 48f1b214..5097bd9b 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs | |||
@@ -13,20 +13,20 @@ namespace WixToolset.Core.CommandLine | |||
13 | 13 | ||
14 | internal class BuildCommand : ICommandLineCommand | 14 | internal class BuildCommand : ICommandLineCommand |
15 | { | 15 | { |
16 | public BuildCommand(IServiceProvider serviceProvider, IEnumerable<SourceFile> sources, IDictionary<string, string> preprocessorVariables, IEnumerable<string> locFiles, IEnumerable<string> libraryFiles, string outputPath, OutputType outputType, string cabCachePath, IEnumerable<string> cultures, bool bindFiles, IEnumerable<BindPath> bindPaths, IEnumerable<string> includeSearchPaths, string intermediateFolder, string contentsFile, string outputsFile, string builtOutputsFile) | 16 | public BuildCommand(IServiceProvider serviceProvider, IEnumerable<SourceFile> sources, IDictionary<string, string> preprocessorVariables, IEnumerable<string> locFiles, IEnumerable<string> libraryFiles, IEnumerable<string> filterCultures, string outputPath, OutputType outputType, string cabCachePath, bool bindFiles, IEnumerable<BindPath> bindPaths, IEnumerable<string> includeSearchPaths, string intermediateFolder, string contentsFile, string outputsFile, string builtOutputsFile) |
17 | { | 17 | { |
18 | this.ServiceProvider = serviceProvider; | 18 | this.ServiceProvider = serviceProvider; |
19 | this.Messaging = serviceProvider.GetService<IMessaging>(); | 19 | this.Messaging = serviceProvider.GetService<IMessaging>(); |
20 | this.ExtensionManager = serviceProvider.GetService<IExtensionManager>(); | 20 | this.ExtensionManager = serviceProvider.GetService<IExtensionManager>(); |
21 | this.LocFiles = locFiles; | 21 | this.LocFiles = locFiles; |
22 | this.LibraryFiles = libraryFiles; | 22 | this.LibraryFiles = libraryFiles; |
23 | this.FilterCultures = filterCultures; | ||
23 | this.PreprocessorVariables = preprocessorVariables; | 24 | this.PreprocessorVariables = preprocessorVariables; |
24 | this.SourceFiles = sources; | 25 | this.SourceFiles = sources; |
25 | this.OutputPath = outputPath; | 26 | this.OutputPath = outputPath; |
26 | this.OutputType = outputType; | 27 | this.OutputType = outputType; |
27 | 28 | ||
28 | this.CabCachePath = cabCachePath; | 29 | this.CabCachePath = cabCachePath; |
29 | this.Cultures = cultures; | ||
30 | this.BindFiles = bindFiles; | 30 | this.BindFiles = bindFiles; |
31 | this.BindPaths = bindPaths; | 31 | this.BindPaths = bindPaths; |
32 | this.IncludeSearchPaths = includeSearchPaths; | 32 | this.IncludeSearchPaths = includeSearchPaths; |
@@ -43,6 +43,8 @@ namespace WixToolset.Core.CommandLine | |||
43 | 43 | ||
44 | public IExtensionManager ExtensionManager { get; } | 44 | public IExtensionManager ExtensionManager { get; } |
45 | 45 | ||
46 | public IEnumerable<string> FilterCultures { get; } | ||
47 | |||
46 | public IEnumerable<string> IncludeSearchPaths { get; } | 48 | public IEnumerable<string> IncludeSearchPaths { get; } |
47 | 49 | ||
48 | public IEnumerable<string> LocFiles { get; } | 50 | public IEnumerable<string> LocFiles { get; } |
@@ -59,8 +61,6 @@ namespace WixToolset.Core.CommandLine | |||
59 | 61 | ||
60 | public string CabCachePath { get; } | 62 | public string CabCachePath { get; } |
61 | 63 | ||
62 | public IEnumerable<string> Cultures { get; } | ||
63 | |||
64 | public bool BindFiles { get; } | 64 | public bool BindFiles { get; } |
65 | 65 | ||
66 | public IEnumerable<BindPath> BindPaths { get; } | 66 | public IEnumerable<BindPath> BindPaths { get; } |
@@ -205,6 +205,7 @@ namespace WixToolset.Core.CommandLine | |||
205 | { | 205 | { |
206 | var resolver = new Resolver(this.ServiceProvider); | 206 | var resolver = new Resolver(this.ServiceProvider); |
207 | resolver.BindPaths = this.BindPaths; | 207 | resolver.BindPaths = this.BindPaths; |
208 | resolver.FilterCultures = this.FilterCultures; | ||
208 | resolver.IntermediateFolder = this.IntermediateFolder; | 209 | resolver.IntermediateFolder = this.IntermediateFolder; |
209 | resolver.IntermediateRepresentation = output; | 210 | resolver.IntermediateRepresentation = output; |
210 | resolver.Localizations = localizations; | 211 | resolver.Localizations = localizations; |
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)) |