diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-01-24 15:27:20 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-02-05 16:15:47 -0800 |
| commit | 6ff680e386b1543ad1a58d1b1d465ce8aa20bc7d (patch) | |
| tree | c717333cd10d5592e59dfb898b391275bba1f389 /src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |
| parent | 6e2e67ab55c75f4655397588c0dcc64f50d22f92 (diff) | |
| download | wix-6ff680e386b1543ad1a58d1b1d465ce8aa20bc7d.tar.gz wix-6ff680e386b1543ad1a58d1b1d465ce8aa20bc7d.tar.bz2 wix-6ff680e386b1543ad1a58d1b1d465ce8aa20bc7d.zip | |
Start on new patch infrastructure
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | 490 |
1 files changed, 257 insertions, 233 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 175203ce..34104ef5 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
| @@ -24,7 +24,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 24 | 24 | ||
| 25 | private bool disposed; | 25 | private bool disposed; |
| 26 | 26 | ||
| 27 | public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBackendBinderExtension> backendExtension, Validator validator) | 27 | public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBackendBinderExtension> backendExtension, Validator validator):this(context, backendExtension, null, validator) |
| 28 | { | ||
| 29 | } | ||
| 30 | |||
| 31 | public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBackendBinderExtension> backendExtension, IEnumerable<SubStorage> subStorages, Validator validator) | ||
| 28 | { | 32 | { |
| 29 | this.ServiceProvider = context.ServiceProvider; | 33 | this.ServiceProvider = context.ServiceProvider; |
| 30 | 34 | ||
| @@ -45,6 +49,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 45 | this.OutputPath = context.OutputPath; | 49 | this.OutputPath = context.OutputPath; |
| 46 | this.OutputPdbPath = context.OutputPdbPath; | 50 | this.OutputPdbPath = context.OutputPdbPath; |
| 47 | this.IntermediateFolder = context.IntermediateFolder; | 51 | this.IntermediateFolder = context.IntermediateFolder; |
| 52 | this.SubStorages = subStorages; | ||
| 48 | this.Validator = validator; | 53 | this.Validator = validator; |
| 49 | 54 | ||
| 50 | this.BackendExtensions = backendExtension; | 55 | this.BackendExtensions = backendExtension; |
| @@ -76,6 +81,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 76 | 81 | ||
| 77 | private IEnumerable<IWindowsInstallerBackendBinderExtension> BackendExtensions { get; } | 82 | private IEnumerable<IWindowsInstallerBackendBinderExtension> BackendExtensions { get; } |
| 78 | 83 | ||
| 84 | private IEnumerable<SubStorage> SubStorages { get; } | ||
| 85 | |||
| 79 | private Intermediate Intermediate { get; } | 86 | private Intermediate Intermediate { get; } |
| 80 | 87 | ||
| 81 | private string OutputPath { get; } | 88 | private string OutputPath { get; } |
| @@ -112,18 +119,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 112 | // Load standard tables, authored custom tables, and extension custom tables. | 119 | // Load standard tables, authored custom tables, and extension custom tables. |
| 113 | TableDefinitionCollection tableDefinitions; | 120 | TableDefinitionCollection tableDefinitions; |
| 114 | { | 121 | { |
| 115 | var command = new LoadTableDefinitionsCommand(section); | 122 | var command = new LoadTableDefinitionsCommand(section, this.BackendExtensions); |
| 116 | command.Execute(); | 123 | command.Execute(); |
| 117 | 124 | ||
| 118 | tableDefinitions = command.TableDefinitions; | 125 | tableDefinitions = command.TableDefinitions; |
| 119 | |||
| 120 | foreach (var backendExtension in this.BackendExtensions) | ||
| 121 | { | ||
| 122 | foreach (var tableDefinition in backendExtension.TableDefinitions) | ||
| 123 | { | ||
| 124 | tableDefinitions.Add(tableDefinition); | ||
| 125 | } | ||
| 126 | } | ||
| 127 | } | 126 | } |
| 128 | 127 | ||
| 129 | // Process the summary information table before the other tables. | 128 | // Process the summary information table before the other tables. |
| @@ -186,8 +185,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 186 | 185 | ||
| 187 | // Sequence all the actions. | 186 | // Sequence all the actions. |
| 188 | { | 187 | { |
| 189 | var command = new SequenceActionsCommand(section); | 188 | var command = new SequenceActionsCommand(this.Messaging, section); |
| 190 | command.Messaging = this.Messaging; | ||
| 191 | command.Execute(); | 189 | command.Execute(); |
| 192 | } | 190 | } |
| 193 | 191 | ||
| @@ -196,7 +194,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 196 | command.Execute(); | 194 | command.Execute(); |
| 197 | } | 195 | } |
| 198 | 196 | ||
| 199 | #if TODO_FINISH_PATCH | 197 | #if TODO_PATCHING |
| 200 | ////if (OutputType.Patch == this.Output.Type) | 198 | ////if (OutputType.Patch == this.Output.Type) |
| 201 | ////{ | 199 | ////{ |
| 202 | //// foreach (SubStorage substorage in this.Output.SubStorages) | 200 | //// foreach (SubStorage substorage in this.Output.SubStorages) |
| @@ -223,130 +221,162 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 223 | return; | 221 | return; |
| 224 | } | 222 | } |
| 225 | 223 | ||
| 226 | this.Messaging.Write(VerboseMessages.UpdatingFileInformation()); | 224 | // Call extension |
| 225 | var ExtensionSaidSkip = false; | ||
| 227 | 226 | ||
| 228 | // This must occur after all variables and source paths have been resolved. | 227 | WindowsInstallerData output; |
| 229 | List<FileFacade> fileFacades; | 228 | if (ExtensionSaidSkip) |
| 230 | { | 229 | { |
| 231 | var command = new GetFileFacadesCommand(section); | 230 | // Time to create the output object, since we're bypassing everything that touches files. |
| 231 | var command = new CreateOutputFromIRCommand(this.Messaging, section, tableDefinitions, this.BackendExtensions); | ||
| 232 | command.Execute(); | 232 | command.Execute(); |
| 233 | 233 | ||
| 234 | fileFacades = command.FileFacades; | 234 | output = command.Output; |
| 235 | } | 235 | } |
| 236 | 236 | else | |
| 237 | // Extract files that come from binary .wixlibs and WixExtensions (this does not extract files from merge modules). | ||
| 238 | { | 237 | { |
| 239 | var command = new ExtractEmbeddedFilesCommand(this.ExpectedEmbeddedFiles); | 238 | this.Messaging.Write(VerboseMessages.UpdatingFileInformation()); |
| 240 | command.Execute(); | ||
| 241 | } | ||
| 242 | 239 | ||
| 243 | // Gather information about files that do not come from merge modules. | 240 | // Extract files that come from binary .wixlibs and WixExtensions (this does not extract files from merge modules). |
| 244 | { | 241 | { |
| 245 | var command = new UpdateFileFacadesCommand(this.Messaging, section); | 242 | var command = new ExtractEmbeddedFilesCommand(this.ExpectedEmbeddedFiles); |
| 246 | command.FileFacades = fileFacades; | 243 | command.Execute(); |
| 247 | command.UpdateFileFacades = fileFacades.Where(f => !f.FromModule); | 244 | } |
| 248 | command.OverwriteHash = true; | ||
| 249 | command.TableDefinitions = tableDefinitions; | ||
| 250 | command.VariableCache = variableCache; | ||
| 251 | command.Execute(); | ||
| 252 | } | ||
| 253 | 245 | ||
| 254 | // Now that the variable cache is populated, resolve any delayed fields. | 246 | // This must occur after all variables and source paths have been resolved. |
| 255 | if (this.DelayedFields.Any()) | 247 | List<FileFacade> fileFacades; |
| 256 | { | 248 | { |
| 257 | var command = new ResolveDelayedFieldsCommand(this.Messaging, this.DelayedFields, variableCache); | 249 | var command = new GetFileFacadesCommand(section); |
| 258 | command.Execute(); | 250 | command.Execute(); |
| 259 | } | ||
| 260 | 251 | ||
| 261 | // Set generated component guids. | 252 | fileFacades = command.FileFacades; |
| 262 | { | 253 | } |
| 263 | var command = new CalculateComponentGuids(this.Messaging, this.BackendHelper, this.PathResolver, section); | ||
| 264 | command.Execute(); | ||
| 265 | } | ||
| 266 | 254 | ||
| 267 | // Retrieve file information from merge modules. | 255 | // Retrieve file information from merge modules. |
| 268 | if (SectionType.Product == section.Type) | 256 | if (SectionType.Product == section.Type) |
| 269 | { | 257 | { |
| 270 | var wixMergeTuples = section.Tuples.OfType<WixMergeTuple>().ToList(); | 258 | var wixMergeTuples = section.Tuples.OfType<WixMergeTuple>().ToList(); |
| 259 | |||
| 260 | if (wixMergeTuples.Any()) | ||
| 261 | { | ||
| 262 | containsMergeModules = true; | ||
| 263 | |||
| 264 | var command = new ExtractMergeModuleFilesCommand(this.Messaging, section, wixMergeTuples); | ||
| 265 | command.FileFacades = fileFacades; | ||
| 266 | command.OutputInstallerVersion = installerVersion; | ||
| 267 | command.SuppressLayout = this.SuppressLayout; | ||
| 268 | command.IntermediateFolder = this.IntermediateFolder; | ||
| 269 | command.Execute(); | ||
| 271 | 270 | ||
| 272 | if (wixMergeTuples.Any()) | 271 | fileFacades.AddRange(command.MergeModulesFileFacades); |
| 272 | } | ||
| 273 | } | ||
| 274 | else if (SectionType.Patch == section.Type) | ||
| 273 | { | 275 | { |
| 274 | containsMergeModules = true; | 276 | // Merge transform data into the output object. |
| 277 | //IEnumerable<FileFacade> filesFromTransform = this.CopyFromTransformData(this.Output); | ||
| 278 | |||
| 279 | //var command = new CopyTransformDataCommand(this.Messaging, /*output*/this.SubStorages, tableDefinitions, copyOutFileRows: true); | ||
| 280 | //command.Output = output; | ||
| 281 | //command.TableDefinitions = this.TableDefinitions; | ||
| 282 | //command.CopyOutFileRows = true; | ||
| 283 | var command = new GetFileFacadesFromTransforms(this.Messaging, this.SubStorages, tableDefinitions); | ||
| 284 | command.Execute(); | ||
| 285 | var filesFromTransforms = command.FileFacades; | ||
| 275 | 286 | ||
| 276 | var command = new ExtractMergeModuleFilesCommand(this.Messaging, section, wixMergeTuples); | 287 | fileFacades.AddRange(filesFromTransforms); |
| 288 | } | ||
| 289 | |||
| 290 | // stop processing if an error previously occurred | ||
| 291 | if (this.Messaging.EncounteredError) | ||
| 292 | { | ||
| 293 | return; | ||
| 294 | } | ||
| 295 | |||
| 296 | // Gather information about files that do not come from merge modules. | ||
| 297 | { | ||
| 298 | var command = new UpdateFileFacadesCommand(this.Messaging, section); | ||
| 277 | command.FileFacades = fileFacades; | 299 | command.FileFacades = fileFacades; |
| 278 | command.OutputInstallerVersion = installerVersion; | 300 | command.UpdateFileFacades = fileFacades.Where(f => !f.FromModule); |
| 279 | command.SuppressLayout = this.SuppressLayout; | 301 | command.OverwriteHash = true; |
| 280 | command.IntermediateFolder = this.IntermediateFolder; | 302 | command.TableDefinitions = tableDefinitions; |
| 303 | command.VariableCache = variableCache; | ||
| 281 | command.Execute(); | 304 | command.Execute(); |
| 282 | |||
| 283 | fileFacades.AddRange(command.MergeModulesFileFacades); | ||
| 284 | } | 305 | } |
| 285 | } | ||
| 286 | #if TODO_FINISH_PATCH | ||
| 287 | else if (OutputType.Patch == this.Output.Type) | ||
| 288 | { | ||
| 289 | // Merge transform data into the output object. | ||
| 290 | IEnumerable<FileFacade> filesFromTransform = this.CopyFromTransformData(this.Output); | ||
| 291 | 306 | ||
| 292 | fileFacades.AddRange(filesFromTransform); | 307 | // Assign files to media. |
| 293 | } | 308 | Dictionary<int, MediaTuple> assignedMediaRows; |
| 294 | #endif | 309 | Dictionary<MediaTuple, IEnumerable<FileFacade>> filesByCabinetMedia; |
| 310 | IEnumerable<FileFacade> uncompressedFiles; | ||
| 311 | { | ||
| 312 | var command = new AssignMediaCommand(section, this.Messaging); | ||
| 313 | command.FileFacades = fileFacades; | ||
| 314 | command.FilesCompressed = compressed; | ||
| 315 | command.Execute(); | ||
| 295 | 316 | ||
| 296 | // stop processing if an error previously occurred | 317 | assignedMediaRows = command.MediaRows; |
| 297 | if (this.Messaging.EncounteredError) | 318 | filesByCabinetMedia = command.FileFacadesByCabinetMedia; |
| 298 | { | 319 | uncompressedFiles = command.UncompressedFileFacades; |
| 299 | return; | 320 | } |
| 300 | } | ||
| 301 | 321 | ||
| 302 | // Assign files to media. | 322 | // stop processing if an error previously occurred |
| 303 | Dictionary<int, MediaTuple> assignedMediaRows; | 323 | if (this.Messaging.EncounteredError) |
| 304 | Dictionary<MediaTuple, IEnumerable<FileFacade>> filesByCabinetMedia; | 324 | { |
| 305 | IEnumerable<FileFacade> uncompressedFiles; | 325 | return; |
| 306 | { | 326 | } |
| 307 | var command = new AssignMediaCommand(section, this.Messaging); | ||
| 308 | command.FileFacades = fileFacades; | ||
| 309 | command.FilesCompressed = compressed; | ||
| 310 | command.Execute(); | ||
| 311 | 327 | ||
| 312 | assignedMediaRows = command.MediaRows; | 328 | // Now that the variable cache is populated, resolve any delayed fields. |
| 313 | filesByCabinetMedia = command.FileFacadesByCabinetMedia; | 329 | if (this.DelayedFields.Any()) |
| 314 | uncompressedFiles = command.UncompressedFileFacades; | 330 | { |
| 315 | } | 331 | var command = new ResolveDelayedFieldsCommand(this.Messaging, this.DelayedFields, variableCache); |
| 332 | command.Execute(); | ||
| 333 | } | ||
| 316 | 334 | ||
| 317 | // stop processing if an error previously occurred | 335 | // Set generated component guids. |
| 318 | if (this.Messaging.EncounteredError) | 336 | { |
| 319 | { | 337 | var command = new CalculateComponentGuids(this.Messaging, this.BackendHelper, this.PathResolver, section); |
| 320 | return; | 338 | command.Execute(); |
| 321 | } | 339 | } |
| 322 | 340 | ||
| 323 | // Time to create the output object. Try to put as much above here as possible, updating the IR is better. | 341 | // stop processing if an error previously occurred |
| 324 | WindowsInstallerData output; | 342 | if (this.Messaging.EncounteredError) |
| 325 | { | 343 | { |
| 326 | var command = new CreateOutputFromIRCommand(this.Messaging, section, tableDefinitions, this.BackendExtensions); | 344 | return; |
| 327 | command.Execute(); | 345 | } |
| 328 | 346 | ||
| 329 | output = command.Output; | 347 | // Time to create the output object. Try to put as much above here as possible, updating the IR is better. |
| 330 | } | 348 | { |
| 349 | var command = new CreateOutputFromIRCommand(this.Messaging, section, tableDefinitions, this.BackendExtensions); | ||
| 350 | command.Execute(); | ||
| 331 | 351 | ||
| 332 | // Update file sequence. | 352 | output = command.Output; |
| 333 | { | 353 | } |
| 334 | var command = new UpdateMediaSequencesCommand(output, fileFacades); | ||
| 335 | command.Execute(); | ||
| 336 | } | ||
| 337 | 354 | ||
| 338 | // Modularize identifiers. | 355 | // Update file sequence. |
| 339 | if (OutputType.Module == output.Type) | 356 | { |
| 340 | { | 357 | var command = new UpdateMediaSequencesCommand(output, fileFacades); |
| 341 | var command = new ModularizeCommand(output, modularizationGuid, section.Tuples.OfType<WixSuppressModularizationTuple>()); | 358 | command.Execute(); |
| 342 | command.Execute(); | 359 | } |
| 343 | } | 360 | |
| 344 | else // we can create instance transforms since Component Guids are set. | 361 | // Modularize identifiers. |
| 345 | { | 362 | if (OutputType.Module == output.Type) |
| 363 | { | ||
| 364 | var command = new ModularizeCommand(output, modularizationGuid, section.Tuples.OfType<WixSuppressModularizationTuple>()); | ||
| 365 | command.Execute(); | ||
| 366 | } | ||
| 367 | else if (output.Type == OutputType.Patch) | ||
| 368 | { | ||
| 369 | foreach (var storage in this.SubStorages) | ||
| 370 | { | ||
| 371 | output.SubStorages.Add(storage); | ||
| 372 | } | ||
| 373 | } | ||
| 374 | else // we can create instance transforms since Component Guids are set. | ||
| 375 | { | ||
| 346 | #if TODO_FIX_INSTANCE_TRANSFORM | 376 | #if TODO_FIX_INSTANCE_TRANSFORM |
| 347 | this.CreateInstanceTransforms(this.Output); | 377 | this.CreateInstanceTransforms(this.Output); |
| 348 | #endif | 378 | #endif |
| 349 | } | 379 | } |
| 350 | 380 | ||
| 351 | #if TODO_FINISH_UPDATE | 381 | #if TODO_FINISH_UPDATE |
| 352 | // Extended binder extensions can be called now that fields are resolved. | 382 | // Extended binder extensions can be called now that fields are resolved. |
| @@ -384,116 +414,121 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 384 | } | 414 | } |
| 385 | #endif | 415 | #endif |
| 386 | 416 | ||
| 387 | // Stop processing if an error previously occurred. | 417 | this.ValidateComponentGuids(output); |
| 388 | if (this.Messaging.EncounteredError) | ||
| 389 | { | ||
| 390 | return; | ||
| 391 | } | ||
| 392 | 418 | ||
| 393 | // Ensure the intermediate folder is created since delta patches will be | 419 | // Stop processing if an error previously occurred. |
| 394 | // created there. | 420 | if (this.Messaging.EncounteredError) |
| 395 | Directory.CreateDirectory(this.IntermediateFolder); | 421 | { |
| 422 | return; | ||
| 423 | } | ||
| 396 | 424 | ||
| 397 | if (SectionType.Patch == section.Type && this.DeltaBinaryPatch) | 425 | // Ensure the intermediate folder is created since delta patches will be |
| 398 | { | 426 | // created there. |
| 399 | var command = new CreateDeltaPatchesCommand(fileFacades, this.IntermediateFolder, section.Tuples.OfType<WixPatchIdTuple>().FirstOrDefault()); | 427 | Directory.CreateDirectory(this.IntermediateFolder); |
| 400 | command.Execute(); | ||
| 401 | } | ||
| 402 | 428 | ||
| 403 | // create cabinet files and process uncompressed files | 429 | if (SectionType.Patch == section.Type && this.DeltaBinaryPatch) |
| 404 | var layoutDirectory = Path.GetDirectoryName(this.OutputPath); | 430 | { |
| 405 | if (!this.SuppressLayout || OutputType.Module == output.Type) | 431 | var command = new CreateDeltaPatchesCommand(fileFacades, this.IntermediateFolder, section.Tuples.OfType<WixPatchIdTuple>().FirstOrDefault()); |
| 406 | { | 432 | command.Execute(); |
| 407 | this.Messaging.Write(VerboseMessages.CreatingCabinetFiles()); | 433 | } |
| 408 | |||
| 409 | var command = new CreateCabinetsCommand(this.ServiceProvider, this.BackendHelper); | ||
| 410 | command.CabbingThreadCount = this.CabbingThreadCount; | ||
| 411 | command.CabCachePath = this.CabCachePath; | ||
| 412 | command.DefaultCompressionLevel = this.DefaultCompressionLevel; | ||
| 413 | command.Output = output; | ||
| 414 | command.Messaging = this.Messaging; | ||
| 415 | command.BackendExtensions = this.BackendExtensions; | ||
| 416 | command.LayoutDirectory = layoutDirectory; | ||
| 417 | command.Compressed = compressed; | ||
| 418 | command.FileRowsByCabinet = filesByCabinetMedia; | ||
| 419 | command.ResolveMedia = this.ResolveMedia; | ||
| 420 | command.TableDefinitions = tableDefinitions; | ||
| 421 | command.TempFilesLocation = this.IntermediateFolder; | ||
| 422 | command.Execute(); | ||
| 423 | 434 | ||
| 424 | fileTransfers.AddRange(command.FileTransfers); | 435 | // create cabinet files and process uncompressed files |
| 425 | trackedFiles.AddRange(command.TrackedFiles); | 436 | var layoutDirectory = Path.GetDirectoryName(this.OutputPath); |
| 426 | } | 437 | if (!this.SuppressLayout || OutputType.Module == output.Type) |
| 438 | { | ||
| 439 | this.Messaging.Write(VerboseMessages.CreatingCabinetFiles()); | ||
| 440 | |||
| 441 | var command = new CreateCabinetsCommand(this.ServiceProvider, this.BackendHelper); | ||
| 442 | command.CabbingThreadCount = this.CabbingThreadCount; | ||
| 443 | command.CabCachePath = this.CabCachePath; | ||
| 444 | command.DefaultCompressionLevel = this.DefaultCompressionLevel; | ||
| 445 | command.Output = output; | ||
| 446 | command.Messaging = this.Messaging; | ||
| 447 | command.BackendExtensions = this.BackendExtensions; | ||
| 448 | command.LayoutDirectory = layoutDirectory; | ||
| 449 | command.Compressed = compressed; | ||
| 450 | command.FileRowsByCabinet = filesByCabinetMedia; | ||
| 451 | command.ResolveMedia = this.ResolveMedia; | ||
| 452 | command.TableDefinitions = tableDefinitions; | ||
| 453 | command.TempFilesLocation = this.IntermediateFolder; | ||
| 454 | command.Execute(); | ||
| 427 | 455 | ||
| 428 | #if TODO_FINISH_PATCH | 456 | fileTransfers.AddRange(command.FileTransfers); |
| 429 | if (OutputType.Patch == this.Output.Type) | 457 | trackedFiles.AddRange(command.TrackedFiles); |
| 430 | { | 458 | } |
| 431 | // copy output data back into the transforms | ||
| 432 | this.CopyToTransformData(this.Output); | ||
| 433 | } | ||
| 434 | #endif | ||
| 435 | 459 | ||
| 436 | this.ValidateComponentGuids(output); | 460 | #if DELETE |
| 461 | if (OutputType.Patch == output.Type) | ||
| 462 | { | ||
| 463 | // Copy output data back into the transforms. | ||
| 464 | #if TODO_PATCHING | ||
| 465 | var command = new CopyTransformDataCommand(this.Messaging, output, tableDefinitions, copyOutFileRows: false); | ||
| 466 | command.Execute(); | ||
| 437 | 467 | ||
| 438 | // stop processing if an error previously occurred | 468 | this.CopyToTransformData(this.Output); |
| 439 | if (this.Messaging.EncounteredError) | 469 | #endif |
| 440 | { | 470 | } |
| 441 | return; | 471 | #endif |
| 442 | } | ||
| 443 | 472 | ||
| 444 | // Generate database file. | 473 | // stop processing if an error previously occurred |
| 445 | this.Messaging.Write(VerboseMessages.GeneratingDatabase()); | 474 | if (this.Messaging.EncounteredError) |
| 475 | { | ||
| 476 | return; | ||
| 477 | } | ||
| 446 | 478 | ||
| 447 | { | 479 | // Generate database file. |
| 448 | var trackMsi = this.BackendHelper.TrackFile(this.OutputPath, TrackedFileType.Final); | 480 | this.Messaging.Write(VerboseMessages.GeneratingDatabase()); |
| 449 | trackedFiles.Add(trackMsi); | ||
| 450 | 481 | ||
| 451 | var temporaryFiles = this.GenerateDatabase(output, tableDefinitions, trackMsi.Path, false, false); | 482 | { |
| 452 | trackedFiles.AddRange(temporaryFiles); | 483 | var trackMsi = this.BackendHelper.TrackFile(this.OutputPath, TrackedFileType.Final); |
| 453 | } | 484 | trackedFiles.Add(trackMsi); |
| 454 | 485 | ||
| 455 | // Stop processing if an error previously occurred. | 486 | var temporaryFiles = this.GenerateDatabase(output, tableDefinitions, trackMsi.Path, false, false); |
| 456 | if (this.Messaging.EncounteredError) | 487 | trackedFiles.AddRange(temporaryFiles); |
| 457 | { | 488 | } |
| 458 | return; | ||
| 459 | } | ||
| 460 | 489 | ||
| 461 | // Merge modules. | 490 | // Stop processing if an error previously occurred. |
| 462 | if (containsMergeModules) | 491 | if (this.Messaging.EncounteredError) |
| 463 | { | 492 | { |
| 464 | this.Messaging.Write(VerboseMessages.MergingModules()); | 493 | return; |
| 494 | } | ||
| 465 | 495 | ||
| 466 | // Add back possibly suppressed sequence tables since all sequence tables must be present | 496 | // Merge modules. |
| 467 | // for the merge process to work. We'll drop the suppressed sequence tables again as | 497 | if (containsMergeModules) |
| 468 | // necessary. | ||
| 469 | foreach (SequenceTable sequence in Enum.GetValues(typeof(SequenceTable))) | ||
| 470 | { | 498 | { |
| 471 | var sequenceTableName = sequence.ToString(); | 499 | this.Messaging.Write(VerboseMessages.MergingModules()); |
| 472 | var sequenceTable = output.Tables[sequenceTableName]; | ||
| 473 | 500 | ||
| 474 | if (null == sequenceTable) | 501 | // Add back possibly suppressed sequence tables since all sequence tables must be present |
| 502 | // for the merge process to work. We'll drop the suppressed sequence tables again as | ||
| 503 | // necessary. | ||
| 504 | foreach (SequenceTable sequence in Enum.GetValues(typeof(SequenceTable))) | ||
| 475 | { | 505 | { |
| 476 | sequenceTable = output.EnsureTable(tableDefinitions[sequenceTableName]); | 506 | var sequenceTableName = sequence.ToString(); |
| 477 | } | 507 | var sequenceTable = output.Tables[sequenceTableName]; |
| 478 | 508 | ||
| 479 | if (0 == sequenceTable.Rows.Count) | 509 | if (null == sequenceTable) |
| 480 | { | 510 | { |
| 481 | suppressedTableNames.Add(sequenceTableName); | 511 | sequenceTable = output.EnsureTable(tableDefinitions[sequenceTableName]); |
| 512 | } | ||
| 513 | |||
| 514 | if (0 == sequenceTable.Rows.Count) | ||
| 515 | { | ||
| 516 | suppressedTableNames.Add(sequenceTableName); | ||
| 517 | } | ||
| 482 | } | 518 | } |
| 483 | } | ||
| 484 | 519 | ||
| 485 | var command = new MergeModulesCommand(); | 520 | var command = new MergeModulesCommand(); |
| 486 | command.FileFacades = fileFacades; | 521 | command.FileFacades = fileFacades; |
| 487 | command.Output = output; | 522 | command.Output = output; |
| 488 | command.OutputPath = this.OutputPath; | 523 | command.OutputPath = this.OutputPath; |
| 489 | command.SuppressedTableNames = suppressedTableNames; | 524 | command.SuppressedTableNames = suppressedTableNames; |
| 490 | command.Execute(); | 525 | command.Execute(); |
| 491 | } | 526 | } |
| 492 | 527 | ||
| 493 | if (this.Messaging.EncounteredError) | 528 | if (this.Messaging.EncounteredError) |
| 494 | { | 529 | { |
| 495 | return; | 530 | return; |
| 496 | } | 531 | } |
| 497 | 532 | ||
| 498 | #if TODO_FINISH_VALIDATION | 533 | #if TODO_FINISH_VALIDATION |
| 499 | // Validate the output if there is an MSI validator. | 534 | // Validate the output if there is an MSI validator. |
| @@ -519,27 +554,29 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 519 | } | 554 | } |
| 520 | #endif | 555 | #endif |
| 521 | 556 | ||
| 522 | // Process uncompressed files. | 557 | // Process uncompressed files. |
| 523 | if (!this.Messaging.EncounteredError && !this.SuppressLayout && uncompressedFiles.Any()) | 558 | if (!this.Messaging.EncounteredError && !this.SuppressLayout && uncompressedFiles.Any()) |
| 524 | { | 559 | { |
| 525 | var command = new ProcessUncompressedFilesCommand(section, this.BackendHelper, this.PathResolver); | 560 | var command = new ProcessUncompressedFilesCommand(section, this.BackendHelper, this.PathResolver); |
| 526 | command.Compressed = compressed; | 561 | command.Compressed = compressed; |
| 527 | command.FileFacades = uncompressedFiles; | 562 | command.FileFacades = uncompressedFiles; |
| 528 | command.LayoutDirectory = layoutDirectory; | 563 | command.LayoutDirectory = layoutDirectory; |
| 529 | command.LongNamesInImage = longNames; | 564 | command.LongNamesInImage = longNames; |
| 530 | command.ResolveMedia = this.ResolveMedia; | 565 | command.ResolveMedia = this.ResolveMedia; |
| 531 | command.DatabasePath = this.OutputPath; | 566 | command.DatabasePath = this.OutputPath; |
| 532 | command.Execute(); | 567 | command.Execute(); |
| 533 | 568 | ||
| 534 | fileTransfers.AddRange(command.FileTransfers); | 569 | fileTransfers.AddRange(command.FileTransfers); |
| 535 | trackedFiles.AddRange(command.TrackedFiles); | 570 | trackedFiles.AddRange(command.TrackedFiles); |
| 571 | } | ||
| 572 | |||
| 573 | // TODO: this is not sufficient to collect all Input files (for example, it misses Binary and Icon tables). | ||
| 574 | trackedFiles.AddRange(fileFacades.Select(f => this.BackendHelper.TrackFile(f.SourcePath, TrackedFileType.Input, f.SourceLineNumber))); | ||
| 536 | } | 575 | } |
| 537 | 576 | ||
| 538 | this.Wixout = this.CreateWixout(trackedFiles, this.Intermediate, output); | 577 | this.Wixout = this.CreateWixout(trackedFiles, this.Intermediate, output); |
| 539 | 578 | ||
| 540 | this.FileTransfers = fileTransfers; | 579 | this.FileTransfers = fileTransfers; |
| 541 | // TODO: this is not sufficient to collect all Input files (for example, it misses Binary and Icon tables). | ||
| 542 | trackedFiles.AddRange(fileFacades.Select(f => this.BackendHelper.TrackFile(f.File.Source.Path, TrackedFileType.Input, f.File.SourceLineNumbers))); | ||
| 543 | this.TrackedFiles = trackedFiles; | 580 | this.TrackedFiles = trackedFiles; |
| 544 | } | 581 | } |
| 545 | 582 | ||
| @@ -566,7 +603,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 566 | return wixout; | 603 | return wixout; |
| 567 | } | 604 | } |
| 568 | 605 | ||
| 569 | #if TODO_FINISH_PATCH | 606 | #if TODO_PATCHING |
| 570 | /// <summary> | 607 | /// <summary> |
| 571 | /// Copy file data between transform substorages and the patch output object | 608 | /// Copy file data between transform substorages and the patch output object |
| 572 | /// </summary> | 609 | /// </summary> |
| @@ -936,28 +973,15 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 936 | /// <param name="useSubdirectory">Whether to use a subdirectory based on the <paramref name="databaseFile"/> file name for intermediate files.</param> | 973 | /// <param name="useSubdirectory">Whether to use a subdirectory based on the <paramref name="databaseFile"/> file name for intermediate files.</param> |
| 937 | private IEnumerable<ITrackedFile> GenerateDatabase(WindowsInstallerData output, TableDefinitionCollection tableDefinitions, string databaseFile, bool keepAddedColumns, bool useSubdirectory) | 974 | private IEnumerable<ITrackedFile> GenerateDatabase(WindowsInstallerData output, TableDefinitionCollection tableDefinitions, string databaseFile, bool keepAddedColumns, bool useSubdirectory) |
| 938 | { | 975 | { |
| 939 | var command = new GenerateDatabaseCommand(); | 976 | var command = new GenerateDatabaseCommand(this.Messaging, this.BackendHelper, this.FileSystemExtensions, output, databaseFile, tableDefinitions, this.IntermediateFolder, this.Codepage, keepAddedColumns, this.SuppressAddingValidationRows, useSubdirectory); |
| 940 | command.BackendHelper = this.BackendHelper; | ||
| 941 | command.Extensions = this.FileSystemExtensions; | ||
| 942 | command.Output = output; | ||
| 943 | command.OutputPath = databaseFile; | ||
| 944 | command.KeepAddedColumns = keepAddedColumns; | ||
| 945 | command.UseSubDirectory = useSubdirectory; | ||
| 946 | command.SuppressAddingValidationRows = this.SuppressAddingValidationRows; | ||
| 947 | command.TableDefinitions = tableDefinitions; | ||
| 948 | command.IntermediateFolder = this.IntermediateFolder; | ||
| 949 | command.Codepage = this.Codepage; | ||
| 950 | command.Execute(); | 977 | command.Execute(); |
| 951 | 978 | ||
| 952 | return command.GeneratedTemporaryFiles; | 979 | return command.GeneratedTemporaryFiles; |
| 953 | } | 980 | } |
| 954 | 981 | ||
| 955 | #region IDisposable Support | 982 | #region IDisposable Support |
| 956 | 983 | ||
| 957 | public void Dispose() | 984 | public void Dispose() => this.Dispose(true); |
| 958 | { | ||
| 959 | this.Dispose(true); | ||
| 960 | } | ||
| 961 | 985 | ||
| 962 | protected virtual void Dispose(bool disposing) | 986 | protected virtual void Dispose(bool disposing) |
| 963 | { | 987 | { |
| @@ -972,6 +996,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 972 | } | 996 | } |
| 973 | } | 997 | } |
| 974 | 998 | ||
| 975 | #endregion | 999 | #endregion |
| 976 | } | 1000 | } |
| 977 | } | 1001 | } |
