aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-12-27 22:58:19 -0800
committerRob Mensching <rob@firegiant.com>2017-12-27 22:58:19 -0800
commit58b8be53fd966e3d475362912477a422f5b5aa11 (patch)
treed6bb3edd0d4e7344777de802b32151f35987884a /src
parentfe7112d862cab6ba28ee40e5539de8e297e0bbf2 (diff)
downloadwix-58b8be53fd966e3d475362912477a422f5b5aa11.tar.gz
wix-58b8be53fd966e3d475362912477a422f5b5aa11.tar.bz2
wix-58b8be53fd966e3d475362912477a422f5b5aa11.zip
Correctly join command line arguments and other small clean up and optimizations
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs83
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs (renamed from src/WixToolset.Core.WindowsInstaller/Bind/ModularaizeCommand.cs)13
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs2
-rw-r--r--src/WixToolset.Core/CommandLine/CommandLineParser.cs2
-rw-r--r--src/WixToolset.Core/Librarian.cs2
-rw-r--r--src/test/TestData/Example.Extension/ExampleTableDefinitions.cs1
6 files changed, 45 insertions, 58 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
index c47a1e56..205feeac 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
@@ -39,7 +39,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
39 this.PdbFile = context.OutputPdbPath; 39 this.PdbFile = context.OutputPdbPath;
40 this.IntermediateFolder = context.IntermediateFolder; 40 this.IntermediateFolder = context.IntermediateFolder;
41 this.Validator = validator; 41 this.Validator = validator;
42 42
43 this.BackendExtensions = backendExtension; 43 this.BackendExtensions = backendExtension;
44 } 44 }
45 45
@@ -90,6 +90,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
90 90
91 var fileTransfers = new List<FileTransfer>(); 91 var fileTransfers = new List<FileTransfer>();
92 92
93 var containsMergeModules = false;
93 var suppressedTableNames = new HashSet<string>(); 94 var suppressedTableNames = new HashSet<string>();
94 95
95 // If there are any fields to resolve later, create the cache to populate during bind. 96 // If there are any fields to resolve later, create the cache to populate during bind.
@@ -209,7 +210,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
209 command.Execute(); 210 command.Execute();
210 } 211 }
211 212
212 // Gather information about files that did not come from merge modules (i.e. rows with a reference to the File table). 213 // Gather information about files that do not come from merge modules.
213 { 214 {
214 var command = new UpdateFileFacadesCommand(this.Messaging, section); 215 var command = new UpdateFileFacadesCommand(this.Messaging, section);
215 command.FileFacades = fileFacades; 216 command.FileFacades = fileFacades;
@@ -233,13 +234,15 @@ namespace WixToolset.Core.WindowsInstaller.Bind
233 command.Execute(); 234 command.Execute();
234 } 235 }
235 236
237 // Retrieve file information from merge modules.
236 if (SectionType.Product == section.Type) 238 if (SectionType.Product == section.Type)
237 { 239 {
238 // Retrieve files and their information from merge modules.
239 var wixMergeTuples = section.Tuples.OfType<WixMergeTuple>().ToList(); 240 var wixMergeTuples = section.Tuples.OfType<WixMergeTuple>().ToList();
240 241
241 if (wixMergeTuples.Any()) 242 if (wixMergeTuples.Any())
242 { 243 {
244 containsMergeModules = true;
245
243 var command = new ExtractMergeModuleFilesCommand(this.Messaging, section, wixMergeTuples); 246 var command = new ExtractMergeModuleFilesCommand(this.Messaging, section, wixMergeTuples);
244 command.FileFacades = fileFacades; 247 command.FileFacades = fileFacades;
245 command.OutputInstallerVersion = installerVersion; 248 command.OutputInstallerVersion = installerVersion;
@@ -266,11 +269,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
266 return; 269 return;
267 } 270 }
268 271
269#if TODO_FIX_INSTANCE_TRANSFORM
270 // With the Component Guids set now we can create instance transforms.
271 this.CreateInstanceTransforms(this.Output);
272#endif
273
274 // Assign files to media. 272 // Assign files to media.
275 Dictionary<int, MediaTuple> assignedMediaRows; 273 Dictionary<int, MediaTuple> assignedMediaRows;
276 Dictionary<MediaTuple, IEnumerable<FileFacade>> filesByCabinetMedia; 274 Dictionary<MediaTuple, IEnumerable<FileFacade>> filesByCabinetMedia;
@@ -292,7 +290,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
292 return; 290 return;
293 } 291 }
294 292
295 // Try to put as much above here as possible, updating the IR is better. 293 // Time to create the output object. Try to put as much above here as possible, updating the IR is better.
296 Output output; 294 Output output;
297 { 295 {
298 var command = new CreateOutputFromIRCommand(section, this.TableDefinitions, this.BackendExtensions); 296 var command = new CreateOutputFromIRCommand(section, this.TableDefinitions, this.BackendExtensions);
@@ -307,12 +305,18 @@ namespace WixToolset.Core.WindowsInstaller.Bind
307 command.Execute(); 305 command.Execute();
308 } 306 }
309 307
310 // Modularize identifiers and add tables with real streams to the import tables. 308 // Modularize identifiers.
311 if (OutputType.Module == output.Type) 309 if (OutputType.Module == output.Type)
312 { 310 {
313 var command = new ModularaizeCommand(output, modularizationGuid, section.Tuples.OfType<WixSuppressModularizationTuple>()); 311 var command = new ModularizeCommand(output, modularizationGuid, section.Tuples.OfType<WixSuppressModularizationTuple>());
314 command.Execute(); 312 command.Execute();
315 } 313 }
314 else // we can create instance transforms since Component Guids are set.
315 {
316#if TODO_FIX_INSTANCE_TRANSFORM
317 this.CreateInstanceTransforms(this.Output);
318#endif
319 }
316 320
317#if TODO_FINISH_UPDATE 321#if TODO_FINISH_UPDATE
318 // Extended binder extensions can be called now that fields are resolved. 322 // Extended binder extensions can be called now that fields are resolved.
@@ -367,7 +371,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
367 } 371 }
368 372
369 // create cabinet files and process uncompressed files 373 // create cabinet files and process uncompressed files
370 string layoutDirectory = Path.GetDirectoryName(this.OutputPath); 374 var layoutDirectory = Path.GetDirectoryName(this.OutputPath);
371 if (!this.SuppressLayout || OutputType.Module == output.Type) 375 if (!this.SuppressLayout || OutputType.Module == output.Type)
372 { 376 {
373 this.Messaging.Write(VerboseMessages.CreatingCabinetFiles()); 377 this.Messaging.Write(VerboseMessages.CreatingCabinetFiles());
@@ -399,36 +403,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
399 } 403 }
400#endif 404#endif
401 405
402 // Add back suppressed tables which must be present prior to merging in modules.
403 if (OutputType.Product == output.Type)
404 {
405 Table wixMergeTable = output.Tables["WixMerge"];
406
407 if (null != wixMergeTable && 0 < wixMergeTable.Rows.Count)
408 {
409 foreach (SequenceTable sequence in Enum.GetValues(typeof(SequenceTable)))
410 {
411 string sequenceTableName = sequence.ToString();
412 Table sequenceTable = output.Tables[sequenceTableName];
413
414 if (null == sequenceTable)
415 {
416 sequenceTable = output.EnsureTable(this.TableDefinitions[sequenceTableName]);
417 }
418
419 if (0 == sequenceTable.Rows.Count)
420 {
421 suppressedTableNames.Add(sequenceTableName);
422 }
423 }
424 }
425 }
426
427 //foreach (BinderExtension extension in this.Extensions)
428 //{
429 // extension.PostBind(this.Context);
430 //}
431
432 this.ValidateComponentGuids(output); 406 this.ValidateComponentGuids(output);
433 407
434 // stop processing if an error previously occurred 408 // stop processing if an error previously occurred
@@ -455,18 +429,37 @@ namespace WixToolset.Core.WindowsInstaller.Bind
455 } 429 }
456 430
457 // Output the output to a file. 431 // Output the output to a file.
458 Pdb pdb = new Pdb();
459 pdb.Output = output;
460 if (!String.IsNullOrEmpty(this.PdbFile)) 432 if (!String.IsNullOrEmpty(this.PdbFile))
461 { 433 {
434 Pdb pdb = new Pdb();
435 pdb.Output = output;
462 pdb.Save(this.PdbFile); 436 pdb.Save(this.PdbFile);
463 } 437 }
464 438
465 // Merge modules. 439 // Merge modules.
466 if (OutputType.Product == output.Type) 440 if (containsMergeModules)
467 { 441 {
468 this.Messaging.Write(VerboseMessages.MergingModules()); 442 this.Messaging.Write(VerboseMessages.MergingModules());
469 443
444 // Add back possibly suppressed sequence tables since all sequence tables must be present
445 // for the merge process to work. We'll drop the suppressed sequence tables again as
446 // necessary.
447 foreach (SequenceTable sequence in Enum.GetValues(typeof(SequenceTable)))
448 {
449 var sequenceTableName = sequence.ToString();
450 var sequenceTable = output.Tables[sequenceTableName];
451
452 if (null == sequenceTable)
453 {
454 sequenceTable = output.EnsureTable(this.TableDefinitions[sequenceTableName]);
455 }
456
457 if (0 == sequenceTable.Rows.Count)
458 {
459 suppressedTableNames.Add(sequenceTableName);
460 }
461 }
462
470 var command = new MergeModulesCommand(); 463 var command = new MergeModulesCommand();
471 command.FileFacades = fileFacades; 464 command.FileFacades = fileFacades;
472 command.Output = output; 465 command.Output = output;
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ModularaizeCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs
index 8c6e3831..ba6af986 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/ModularaizeCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs
@@ -13,9 +13,9 @@ namespace WixToolset.Core.WindowsInstaller.Bind
13 using WixToolset.Data.Tuples; 13 using WixToolset.Data.Tuples;
14 using WixToolset.Data.WindowsInstaller; 14 using WixToolset.Data.WindowsInstaller;
15 15
16 internal class ModularaizeCommand 16 internal class ModularizeCommand
17 { 17 {
18 public ModularaizeCommand(Output output, string modularizationGuid, IEnumerable<WixSuppressModularizationTuple> suppressTuples) 18 public ModularizeCommand(Output output, string modularizationGuid, IEnumerable<WixSuppressModularizationTuple> suppressTuples)
19 { 19 {
20 this.Output = output; 20 this.Output = output;
21 this.ModularizationGuid = modularizationGuid; 21 this.ModularizationGuid = modularizationGuid;
@@ -38,12 +38,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
38 } 38 }
39 } 39 }
40 40
41 /// <summary> 41 private void ModularizeTable(Table table)
42 /// Modularize the table.
43 /// </summary>
44 /// <param name="modularizationGuid">String containing the GUID of the Merge Module, if appropriate.</param>
45 /// <param name="suppressModularizationIdentifiers">Optional collection of identifiers that should not be modularized.</param>
46 public void ModularizeTable(Table table)
47 { 42 {
48 var modularizedColumns = new List<int>(); 43 var modularizedColumns = new List<int>();
49 44
@@ -79,7 +74,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
79 74
80 if (!(WindowsInstallerStandard.IsStandardAction(fieldData) || WindowsInstallerStandard.IsStandardProperty(fieldData))) 75 if (!(WindowsInstallerStandard.IsStandardAction(fieldData) || WindowsInstallerStandard.IsStandardProperty(fieldData)))
81 { 76 {
82 ColumnModularizeType modularizeType = field.Column.ModularizeType; 77 var modularizeType = field.Column.ModularizeType;
83 78
84 // special logic for the ControlEvent table's Argument column 79 // special logic for the ControlEvent table's Argument column
85 // this column requires different modularization methods depending upon the value of the Event column 80 // this column requires different modularization methods depending upon the value of the Event column
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs
index 39771508..56c86b11 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs
@@ -41,7 +41,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
41 41
42 public void Execute() 42 public void Execute()
43 { 43 {
44 List<FileTransfer> fileTransfers = new List<FileTransfer>(); 44 var fileTransfers = new List<FileTransfer>();
45 45
46 var directories = new Dictionary<string, ResolvedDirectory>(); 46 var directories = new Dictionary<string, ResolvedDirectory>();
47 47
diff --git a/src/WixToolset.Core/CommandLine/CommandLineParser.cs b/src/WixToolset.Core/CommandLine/CommandLineParser.cs
index 017810e0..3c7f3d1e 100644
--- a/src/WixToolset.Core/CommandLine/CommandLineParser.cs
+++ b/src/WixToolset.Core/CommandLine/CommandLineParser.cs
@@ -54,7 +54,7 @@ namespace WixToolset.Core.CommandLine
54 54
55 if (!String.IsNullOrEmpty(context.Arguments)) 55 if (!String.IsNullOrEmpty(context.Arguments))
56 { 56 {
57 args = CommandLineParser.ParseArgumentsToArray(context.Arguments).Union(args).ToArray(); 57 args = CommandLineParser.ParseArgumentsToArray(context.Arguments).Concat(args).ToArray();
58 } 58 }
59 59
60 return this.ParseStandardCommandLine(context, args); 60 return this.ParseStandardCommandLine(context, args);
diff --git a/src/WixToolset.Core/Librarian.cs b/src/WixToolset.Core/Librarian.cs
index 3e843070..f4191e86 100644
--- a/src/WixToolset.Core/Librarian.cs
+++ b/src/WixToolset.Core/Librarian.cs
@@ -143,7 +143,7 @@ namespace WixToolset.Core
143 143
144 foreach (var tuple in sections.SelectMany(s => s.Tuples)) 144 foreach (var tuple in sections.SelectMany(s => s.Tuples))
145 { 145 {
146 foreach (var field in tuple.Fields.Where(f => f.Type == IntermediateFieldType.Path)) 146 foreach (var field in tuple.Fields.Where(f => f?.Type == IntermediateFieldType.Path))
147 { 147 {
148 var pathField = field.AsPath(); 148 var pathField = field.AsPath();
149 149
diff --git a/src/test/TestData/Example.Extension/ExampleTableDefinitions.cs b/src/test/TestData/Example.Extension/ExampleTableDefinitions.cs
index 16da1316..dbd6491b 100644
--- a/src/test/TestData/Example.Extension/ExampleTableDefinitions.cs
+++ b/src/test/TestData/Example.Extension/ExampleTableDefinitions.cs
@@ -2,7 +2,6 @@
2 2
3namespace Example.Extension 3namespace Example.Extension
4{ 4{
5 using System.Collections.Generic;
6 using WixToolset.Data.WindowsInstaller; 5 using WixToolset.Data.WindowsInstaller;
7 6
8 public static class ExampleTableDefinitions 7 public static class ExampleTableDefinitions