diff options
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | 68 |
1 files changed, 32 insertions, 36 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 4b3d554a..012c7c4c 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
@@ -301,41 +301,49 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
301 | command.Execute(); | 301 | command.Execute(); |
302 | } | 302 | } |
303 | 303 | ||
304 | #if TODO_FINISH_UPDATE // use symbols instead of rows | 304 | // Update symbols that reference text files on disk. |
305 | // Extended binder extensions can be called now that fields are resolved. | ||
306 | { | 305 | { |
307 | Table updatedFiles = this.Output.EnsureTable(this.TableDefinitions["WixBindUpdatedFiles"]); | 306 | var command = new UpdateFromTextFilesCommand(this.Messaging, section); |
308 | 307 | command.Execute(); | |
309 | foreach (IBinderExtension extension in this.Extensions) | 308 | } |
310 | { | ||
311 | extension.AfterResolvedFields(this.Output); | ||
312 | } | ||
313 | 309 | ||
314 | List<FileFacade> updatedFileFacades = new List<FileFacade>(); | 310 | // Add missing CreateFolder symbols to null-keypath components. |
311 | { | ||
312 | var command = new AddCreateFoldersCommand(section); | ||
313 | command.Execute(); | ||
314 | } | ||
315 | 315 | ||
316 | foreach (Row updatedFile in updatedFiles.Rows) | 316 | // If there are any backend extensions, give them the opportunity to process |
317 | // the section now that the fields have all be resolved. | ||
318 | // | ||
319 | if (this.BackendExtensions.Any()) | ||
320 | { | ||
321 | using (new IntermediateFieldContext("wix.bind.finalize")) | ||
317 | { | 322 | { |
318 | string updatedId = updatedFile.FieldAsString(0); | 323 | foreach (var extension in this.BackendExtensions) |
324 | { | ||
325 | extension.SymbolsFinalized(section); | ||
326 | } | ||
327 | |||
328 | var reresolvedFiles = section.Symbols | ||
329 | .OfType<FileSymbol>() | ||
330 | .Where(s => s.Fields.Any(f => f?.Context == "wix.bind.finalize")) | ||
331 | .ToList(); | ||
319 | 332 | ||
320 | FileFacade updatedFacade = fileFacades.First(f => f.File.File.Equals(updatedId)); | 333 | if (reresolvedFiles.Any()) |
334 | { | ||
335 | var updatedFacades = reresolvedFiles.Select(f => fileFacades.First(ff => ff.Id == f.Id?.Id)); | ||
321 | 336 | ||
322 | updatedFileFacades.Add(updatedFacade); | 337 | var command = new UpdateFileFacadesCommand(this.Messaging, section, fileFacades, updatedFacades, variableCache, overwriteHash: false); |
338 | command.Execute(); | ||
339 | } | ||
323 | } | 340 | } |
324 | 341 | ||
325 | if (updatedFileFacades.Any()) | 342 | if (this.Messaging.EncounteredError) |
326 | { | 343 | { |
327 | UpdateFileFacadesCommand command = new UpdateFileFacadesCommand(this.Messaging, section, fileFacades, updateFileFacades, variableCache, overwriteHash: false); | 344 | return null; |
328 | //command.FileFacades = fileFacades; | ||
329 | //command.UpdateFileFacades = updatedFileFacades; | ||
330 | //command.ModularizationGuid = modularizationGuid; | ||
331 | //command.Output = this.Output; | ||
332 | //command.OverwriteHash = true; | ||
333 | //command.TableDefinitions = this.TableDefinitions; | ||
334 | //command.VariableCache = variableCache; | ||
335 | command.Execute(); | ||
336 | } | 345 | } |
337 | } | 346 | } |
338 | #endif | ||
339 | 347 | ||
340 | // Set generated component guids. | 348 | // Set generated component guids. |
341 | { | 349 | { |
@@ -348,18 +356,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
348 | command.Execute(); | 356 | command.Execute(); |
349 | } | 357 | } |
350 | 358 | ||
351 | // Add missing CreateFolder symbols to null-keypath components. | ||
352 | { | ||
353 | var command = new AddCreateFoldersCommand(section); | ||
354 | command.Execute(); | ||
355 | } | ||
356 | |||
357 | // Update symbols that reference text files on disk. | ||
358 | { | ||
359 | var command = new UpdateFromTextFilesCommand(this.Messaging, section); | ||
360 | command.Execute(); | ||
361 | } | ||
362 | |||
363 | // Assign files to media and update file sequences. | 359 | // Assign files to media and update file sequences. |
364 | Dictionary<MediaSymbol, IEnumerable<FileFacade>> filesByCabinetMedia; | 360 | Dictionary<MediaSymbol, IEnumerable<FileFacade>> filesByCabinetMedia; |
365 | IEnumerable<FileFacade> uncompressedFiles; | 361 | IEnumerable<FileFacade> uncompressedFiles; |