aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-02-23 09:27:05 -0800
committerRob Mensching <rob@firegiant.com>2021-02-27 07:47:08 -0800
commit4536440f8d76346bcd120fe9e1410e428f855ee9 (patch)
tree908ff2921d64664cb7af624d24ca7b47b17da4aa
parent52f4ea0a7d85c2c83c7d6c771a3bdc6dd74fdbc0 (diff)
downloadwix-4536440f8d76346bcd120fe9e1410e428f855ee9.tar.gz
wix-4536440f8d76346bcd120fe9e1410e428f855ee9.tar.bz2
wix-4536440f8d76346bcd120fe9e1410e428f855ee9.zip
Complete implementation of extension handling for finalized symbols
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs68
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;