diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-12-19 12:25:40 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-12-19 12:25:40 -0800 |
| commit | 155a6e96346e0cb3d9ab6f5372fa29b46ebaee89 (patch) | |
| tree | 59d1f151bfde8068b6014b05b5c8cfea3402c974 /src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |
| parent | 6f1665ed759b31bd095f186f9239232c653597cd (diff) | |
| download | wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.gz wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.tar.bz2 wix-155a6e96346e0cb3d9ab6f5372fa29b46ebaee89.zip | |
Integrate simplified message handling
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 9e30aed2..410e462a 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
| @@ -35,6 +35,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 35 | this.ExpectedEmbeddedFiles = context.ExpectedEmbeddedFiles; | 35 | this.ExpectedEmbeddedFiles = context.ExpectedEmbeddedFiles; |
| 36 | this.Extensions = context.Extensions; | 36 | this.Extensions = context.Extensions; |
| 37 | this.Intermediate = context.IntermediateRepresentation; | 37 | this.Intermediate = context.IntermediateRepresentation; |
| 38 | this.Messaging = context.Messaging; | ||
| 38 | this.OutputPath = context.OutputPath; | 39 | this.OutputPath = context.OutputPath; |
| 39 | this.PdbFile = context.OutputPdbPath; | 40 | this.PdbFile = context.OutputPdbPath; |
| 40 | this.IntermediateFolder = context.IntermediateFolder; | 41 | this.IntermediateFolder = context.IntermediateFolder; |
| @@ -68,6 +69,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 68 | 69 | ||
| 69 | private Intermediate Intermediate { get; } | 70 | private Intermediate Intermediate { get; } |
| 70 | 71 | ||
| 72 | private IMessaging Messaging { get; } | ||
| 73 | |||
| 71 | private string OutputPath { get; } | 74 | private string OutputPath { get; } |
| 72 | 75 | ||
| 73 | private bool SuppressAddingValidationRows { get; } | 76 | private bool SuppressAddingValidationRows { get; } |
| @@ -160,7 +163,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 160 | // Sequence all the actions. | 163 | // Sequence all the actions. |
| 161 | { | 164 | { |
| 162 | var command = new SequenceActionsCommand(section); | 165 | var command = new SequenceActionsCommand(section); |
| 163 | command.Messaging = Messaging.Instance; | 166 | command.Messaging = this.Messaging; |
| 164 | command.Execute(); | 167 | command.Execute(); |
| 165 | } | 168 | } |
| 166 | 169 | ||
| @@ -191,12 +194,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 191 | ////} | 194 | ////} |
| 192 | #endif | 195 | #endif |
| 193 | 196 | ||
| 194 | if (Messaging.Instance.EncounteredError) | 197 | if (this.Messaging.EncounteredError) |
| 195 | { | 198 | { |
| 196 | return; | 199 | return; |
| 197 | } | 200 | } |
| 198 | 201 | ||
| 199 | Messaging.Instance.OnMessage(WixVerboses.UpdatingFileInformation()); | 202 | this.Messaging.Write(VerboseMessages.UpdatingFileInformation()); |
| 200 | 203 | ||
| 201 | // This must occur after all variables and source paths have been resolved. | 204 | // This must occur after all variables and source paths have been resolved. |
| 202 | List<FileFacade> fileFacades; | 205 | List<FileFacade> fileFacades; |
| @@ -215,7 +218,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 215 | 218 | ||
| 216 | // Gather information about files that did not come from merge modules (i.e. rows with a reference to the File table). | 219 | // Gather information about files that did not come from merge modules (i.e. rows with a reference to the File table). |
| 217 | { | 220 | { |
| 218 | var command = new UpdateFileFacadesCommand(section); | 221 | var command = new UpdateFileFacadesCommand(this.Messaging, section); |
| 219 | command.FileFacades = fileFacades; | 222 | command.FileFacades = fileFacades; |
| 220 | command.UpdateFileFacades = fileFacades.Where(f => !f.FromModule); | 223 | command.UpdateFileFacades = fileFacades.Where(f => !f.FromModule); |
| 221 | command.OverwriteHash = true; | 224 | command.OverwriteHash = true; |
| @@ -227,13 +230,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 227 | // Now that the variable cache is populated, resolve any delayed fields. | 230 | // Now that the variable cache is populated, resolve any delayed fields. |
| 228 | if (this.DelayedFields.Any()) | 231 | if (this.DelayedFields.Any()) |
| 229 | { | 232 | { |
| 230 | var command = new ResolveDelayedFieldsCommand(this.DelayedFields, variableCache); | 233 | var command = new ResolveDelayedFieldsCommand(this.Messaging, this.DelayedFields, variableCache); |
| 231 | command.Execute(); | 234 | command.Execute(); |
| 232 | } | 235 | } |
| 233 | 236 | ||
| 234 | // Set generated component guids. | 237 | // Set generated component guids. |
| 235 | { | 238 | { |
| 236 | var command = new CalculateComponentGuids(section); | 239 | var command = new CalculateComponentGuids(this.Messaging, section); |
| 237 | command.Execute(); | 240 | command.Execute(); |
| 238 | } | 241 | } |
| 239 | 242 | ||
| @@ -244,7 +247,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 244 | 247 | ||
| 245 | if (wixMergeTuples.Any()) | 248 | if (wixMergeTuples.Any()) |
| 246 | { | 249 | { |
| 247 | var command = new ExtractMergeModuleFilesCommand(section, wixMergeTuples); | 250 | var command = new ExtractMergeModuleFilesCommand(this.Messaging, section, wixMergeTuples); |
| 248 | command.FileFacades = fileFacades; | 251 | command.FileFacades = fileFacades; |
| 249 | command.OutputInstallerVersion = installerVersion; | 252 | command.OutputInstallerVersion = installerVersion; |
| 250 | command.SuppressLayout = this.SuppressLayout; | 253 | command.SuppressLayout = this.SuppressLayout; |
| @@ -265,7 +268,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 265 | #endif | 268 | #endif |
| 266 | 269 | ||
| 267 | // stop processing if an error previously occurred | 270 | // stop processing if an error previously occurred |
| 268 | if (Messaging.Instance.EncounteredError) | 271 | if (this.Messaging.EncounteredError) |
| 269 | { | 272 | { |
| 270 | return; | 273 | return; |
| 271 | } | 274 | } |
| @@ -280,7 +283,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 280 | Dictionary<MediaTuple, IEnumerable<FileFacade>> filesByCabinetMedia; | 283 | Dictionary<MediaTuple, IEnumerable<FileFacade>> filesByCabinetMedia; |
| 281 | IEnumerable<FileFacade> uncompressedFiles; | 284 | IEnumerable<FileFacade> uncompressedFiles; |
| 282 | { | 285 | { |
| 283 | var command = new AssignMediaCommand(section); | 286 | var command = new AssignMediaCommand(section, this.Messaging); |
| 284 | command.FileFacades = fileFacades; | 287 | command.FileFacades = fileFacades; |
| 285 | command.FilesCompressed = compressed; | 288 | command.FilesCompressed = compressed; |
| 286 | command.Execute(); | 289 | command.Execute(); |
| @@ -291,7 +294,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 291 | } | 294 | } |
| 292 | 295 | ||
| 293 | // stop processing if an error previously occurred | 296 | // stop processing if an error previously occurred |
| 294 | if (Messaging.Instance.EncounteredError) | 297 | if (this.Messaging.EncounteredError) |
| 295 | { | 298 | { |
| 296 | return; | 299 | return; |
| 297 | } | 300 | } |
| @@ -355,7 +358,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 355 | #endif | 358 | #endif |
| 356 | 359 | ||
| 357 | // Stop processing if an error previously occurred. | 360 | // Stop processing if an error previously occurred. |
| 358 | if (Messaging.Instance.EncounteredError) | 361 | if (this.Messaging.EncounteredError) |
| 359 | { | 362 | { |
| 360 | return; | 363 | return; |
| 361 | } | 364 | } |
| @@ -374,13 +377,14 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 374 | string layoutDirectory = Path.GetDirectoryName(this.OutputPath); | 377 | string layoutDirectory = Path.GetDirectoryName(this.OutputPath); |
| 375 | if (!this.SuppressLayout || OutputType.Module == output.Type) | 378 | if (!this.SuppressLayout || OutputType.Module == output.Type) |
| 376 | { | 379 | { |
| 377 | Messaging.Instance.OnMessage(WixVerboses.CreatingCabinetFiles()); | 380 | this.Messaging.Write(VerboseMessages.CreatingCabinetFiles()); |
| 378 | 381 | ||
| 379 | var command = new CreateCabinetsCommand(); | 382 | var command = new CreateCabinetsCommand(); |
| 380 | command.CabbingThreadCount = this.CabbingThreadCount; | 383 | command.CabbingThreadCount = this.CabbingThreadCount; |
| 381 | command.CabCachePath = this.CabCachePath; | 384 | command.CabCachePath = this.CabCachePath; |
| 382 | command.DefaultCompressionLevel = this.DefaultCompressionLevel; | 385 | command.DefaultCompressionLevel = this.DefaultCompressionLevel; |
| 383 | command.Output = output; | 386 | command.Output = output; |
| 387 | command.Messaging = this.Messaging; | ||
| 384 | command.BackendExtensions = this.BackendExtensions; | 388 | command.BackendExtensions = this.BackendExtensions; |
| 385 | command.LayoutDirectory = layoutDirectory; | 389 | command.LayoutDirectory = layoutDirectory; |
| 386 | command.Compressed = compressed; | 390 | command.Compressed = compressed; |
| @@ -435,13 +439,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 435 | this.ValidateComponentGuids(output); | 439 | this.ValidateComponentGuids(output); |
| 436 | 440 | ||
| 437 | // stop processing if an error previously occurred | 441 | // stop processing if an error previously occurred |
| 438 | if (Messaging.Instance.EncounteredError) | 442 | if (this.Messaging.EncounteredError) |
| 439 | { | 443 | { |
| 440 | return; | 444 | return; |
| 441 | } | 445 | } |
| 442 | 446 | ||
| 443 | // Generate database file. | 447 | // Generate database file. |
| 444 | Messaging.Instance.OnMessage(WixVerboses.GeneratingDatabase()); | 448 | this.Messaging.Write(VerboseMessages.GeneratingDatabase()); |
| 445 | string tempDatabaseFile = Path.Combine(this.IntermediateFolder, Path.GetFileName(this.OutputPath)); | 449 | string tempDatabaseFile = Path.Combine(this.IntermediateFolder, Path.GetFileName(this.OutputPath)); |
| 446 | this.GenerateDatabase(output, tempDatabaseFile, false, false); | 450 | this.GenerateDatabase(output, tempDatabaseFile, false, false); |
| 447 | 451 | ||
| @@ -452,7 +456,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 452 | } | 456 | } |
| 453 | 457 | ||
| 454 | // Stop processing if an error previously occurred. | 458 | // Stop processing if an error previously occurred. |
| 455 | if (Messaging.Instance.EncounteredError) | 459 | if (this.Messaging.EncounteredError) |
| 456 | { | 460 | { |
| 457 | return; | 461 | return; |
| 458 | } | 462 | } |
| @@ -468,7 +472,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 468 | // Merge modules. | 472 | // Merge modules. |
| 469 | if (OutputType.Product == output.Type) | 473 | if (OutputType.Product == output.Type) |
| 470 | { | 474 | { |
| 471 | Messaging.Instance.OnMessage(WixVerboses.MergingModules()); | 475 | this.Messaging.Write(VerboseMessages.MergingModules()); |
| 472 | 476 | ||
| 473 | var command = new MergeModulesCommand(); | 477 | var command = new MergeModulesCommand(); |
| 474 | command.FileFacades = fileFacades; | 478 | command.FileFacades = fileFacades; |
| @@ -478,7 +482,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 478 | command.Execute(); | 482 | command.Execute(); |
| 479 | } | 483 | } |
| 480 | 484 | ||
| 481 | if (Messaging.Instance.EncounteredError) | 485 | if (this.Messaging.EncounteredError) |
| 482 | { | 486 | { |
| 483 | return; | 487 | return; |
| 484 | } | 488 | } |
| @@ -492,12 +496,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 492 | // set the output file for source line information | 496 | // set the output file for source line information |
| 493 | this.Validator.Output = this.Output; | 497 | this.Validator.Output = this.Output; |
| 494 | 498 | ||
| 495 | Messaging.Instance.OnMessage(WixVerboses.ValidatingDatabase()); | 499 | Messaging.Instance.Write(WixVerboses.ValidatingDatabase()); |
| 496 | 500 | ||
| 497 | this.Validator.Validate(tempDatabaseFile); | 501 | this.Validator.Validate(tempDatabaseFile); |
| 498 | 502 | ||
| 499 | stopwatch.Stop(); | 503 | stopwatch.Stop(); |
| 500 | Messaging.Instance.OnMessage(WixVerboses.ValidatedDatabase(stopwatch.ElapsedMilliseconds)); | 504 | Messaging.Instance.Write(WixVerboses.ValidatedDatabase(stopwatch.ElapsedMilliseconds)); |
| 501 | 505 | ||
| 502 | // Stop processing if an error occurred. | 506 | // Stop processing if an error occurred. |
| 503 | if (Messaging.Instance.EncounteredError) | 507 | if (Messaging.Instance.EncounteredError) |
| @@ -508,7 +512,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 508 | #endif | 512 | #endif |
| 509 | 513 | ||
| 510 | // Process uncompressed files. | 514 | // Process uncompressed files. |
| 511 | if (!Messaging.Instance.EncounteredError && !this.SuppressLayout && uncompressedFiles.Any()) | 515 | if (!this.Messaging.EncounteredError && !this.SuppressLayout && uncompressedFiles.Any()) |
| 512 | { | 516 | { |
| 513 | var command = new ProcessUncompressedFilesCommand(section); | 517 | var command = new ProcessUncompressedFilesCommand(section); |
| 514 | command.Compressed = compressed; | 518 | command.Compressed = compressed; |
| @@ -908,11 +912,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 908 | 912 | ||
| 909 | if (allComponentsHaveConditions) | 913 | if (allComponentsHaveConditions) |
| 910 | { | 914 | { |
| 911 | Messaging.Instance.OnMessage(WixWarnings.DuplicateComponentGuidsMustHaveMutuallyExclusiveConditions(row.SourceLineNumbers, row.Component, row.Guid)); | 915 | this.Messaging.Write(WarningMessages.DuplicateComponentGuidsMustHaveMutuallyExclusiveConditions(row.SourceLineNumbers, row.Component, row.Guid)); |
| 912 | } | 916 | } |
| 913 | else | 917 | else |
| 914 | { | 918 | { |
| 915 | Messaging.Instance.OnMessage(WixErrors.DuplicateComponentGuids(row.SourceLineNumbers, row.Component, row.Guid)); | 919 | this.Messaging.Write(ErrorMessages.DuplicateComponentGuids(row.SourceLineNumbers, row.Component, row.Guid)); |
| 916 | } | 920 | } |
| 917 | } | 921 | } |
| 918 | 922 | ||
| @@ -929,6 +933,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 929 | private void UpdateControlText(Output output) | 933 | private void UpdateControlText(Output output) |
| 930 | { | 934 | { |
| 931 | var command = new UpdateControlTextCommand(); | 935 | var command = new UpdateControlTextCommand(); |
| 936 | command.Messaging = this.Messaging; | ||
| 932 | command.BBControlTable = output.Tables["BBControl"]; | 937 | command.BBControlTable = output.Tables["BBControl"]; |
| 933 | command.WixBBControlTable = output.Tables["WixBBControl"]; | 938 | command.WixBBControlTable = output.Tables["WixBBControl"]; |
| 934 | command.ControlTable = output.Tables["Control"]; | 939 | command.ControlTable = output.Tables["Control"]; |
