diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-12-27 22:58:19 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-12-27 22:58:19 -0800 |
| commit | 58b8be53fd966e3d475362912477a422f5b5aa11 (patch) | |
| tree | d6bb3edd0d4e7344777de802b32151f35987884a /src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |
| parent | fe7112d862cab6ba28ee40e5539de8e297e0bbf2 (diff) | |
| download | wix-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/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | 83 |
1 files changed, 38 insertions, 45 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; |
