@joebigelow / wix / commits / 93d3a9e1

Track files in BindBundleCommand.

Sean Hall committed May 10, 2020 at 19:31 UTC 93d3a9e1f9cdc05456a612e238a83738cfd1750f
5 files changed +52 -13
src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs
+24 -10
@@ -123,8 +123,10 @@ namespace WixToolset.Core.Burn
123
124 // Extract files that come from binary .wixlibs and WixExtensions (this does not extract files from merge modules).
125 {
126 - var command = new ExtractEmbeddedFilesCommand(this.ExpectedEmbeddedFiles);
126 + var command = new ExtractEmbeddedFilesCommand(this.BackendHelper, this.ExpectedEmbeddedFiles);
127 command.Execute();
128 +
129 + trackedFiles.AddRange(command.TrackedFiles);
130 }
131
132 // Get the explicit payloads.
@@ -164,6 +166,7 @@ namespace WixToolset.Core.Burn
166 command.Execute();
167
168 fileTransfers.AddRange(command.FileTransfers);
169 + trackedFiles.AddRange(command.TrackedFiles);
170
171 processedPayloads = new HashSet<string>(payloadTuples.Keys);
172 }
@@ -245,6 +248,7 @@ namespace WixToolset.Core.Burn
248 command.Execute();
249
250 fileTransfers.AddRange(command.FileTransfers);
251 + trackedFiles.AddRange(command.TrackedFiles);
252
253 processedPayloads = null;
254 }
@@ -379,6 +383,17 @@ namespace WixToolset.Core.Burn
383 // Update the bundle per-machine/per-user scope based on the chained packages.
384 this.ResolveBundleInstallScope(section, bundleTuple, orderedFacades);
385
386 + // Give the extension one last hook before generating the output files.
387 + foreach (var extension in this.BackendExtensions)
388 + {
389 + extension.BundleFinalize();
390 + }
391 +
392 + if (this.Messaging.EncounteredError)
393 + {
394 + return;
395 + }
396 +
397 // Generate the core-defined BA manifest tables...
398 string baManifestPath;
399 {
@@ -389,6 +404,8 @@ namespace WixToolset.Core.Burn
404 baManifestPath = command.OutputPath;
405 payloadTuples.Add(baManifestPayload.Id.Id, baManifestPayload);
406 ++uxPayloadIndex;
407 +
408 + trackedFiles.Add(this.BackendHelper.TrackFile(baManifestPath, TrackedFileType.Temporary));
409 }
410
411 // Generate the bundle extension manifest...
@@ -401,16 +418,8 @@ namespace WixToolset.Core.Burn
418 bextManifestPath = command.OutputPath;
419 payloadTuples.Add(bextManifestPayload.Id.Id, bextManifestPayload);
420 ++uxPayloadIndex;
404 - }
421
406 - foreach (var extension in this.BackendExtensions)
407 - {
408 - extension.BundleFinalize();
409 - }
410 -
411 - if (this.Messaging.EncounteredError)
412 - {
413 - return;
422 + trackedFiles.Add(this.BackendHelper.TrackFile(bextManifestPath, TrackedFileType.Temporary));
423 }
424
425 // Create all the containers except the UX container first so the manifest (that goes in the UX container)
@@ -423,6 +432,7 @@ namespace WixToolset.Core.Burn
432 command.Execute();
433
434 fileTransfers.AddRange(command.FileTransfers);
435 + trackedFiles.AddRange(command.TrackedFiles);
436
437 uxContainer = command.UXContainer;
438 uxPayloads = command.UXContainerPayloads;
@@ -438,6 +448,7 @@ namespace WixToolset.Core.Burn
448 command.Execute();
449
450 manifestPath = command.OutputPath;
451 + trackedFiles.Add(this.BackendHelper.TrackFile(manifestPath, TrackedFileType.Temporary));
452 }
453
454 // Create the UX container.
@@ -447,6 +458,8 @@ namespace WixToolset.Core.Burn
458
459 uxContainer.Hash = command.Hash;
460 uxContainer.Size = command.Size;
461 +
462 + trackedFiles.Add(this.BackendHelper.TrackFile(uxContainer.WorkingPath, TrackedFileType.Temporary));
463 }
464
465 {
@@ -454,6 +467,7 @@ namespace WixToolset.Core.Burn
467 command.Execute();
468
469 fileTransfers.Add(command.Transfer);
470 + trackedFiles.Add(this.BackendHelper.TrackFile(this.OutputPath, TrackedFileType.Final));
471 }
472
473 #if TODO // does this need to come back, or do they only need to be in TrackedFiles?
src/WixToolset.Core.Burn/Bundles/CreateNonUXContainers.cs
+5 -1
@@ -27,6 +27,8 @@ namespace WixToolset.Core.Burn.Bundles
27
28 public IEnumerable<IFileTransfer> FileTransfers { get; private set; }
29
30 + public IEnumerable<ITrackedFile> TrackedFiles { get; private set; }
31 +
32 public WixBundleContainerTuple UXContainer { get; set; }
33
34 public IEnumerable<WixBundlePayloadTuple> UXContainerPayloads { get; private set; }
@@ -50,7 +52,7 @@ namespace WixToolset.Core.Burn.Bundles
52 public void Execute()
53 {
54 var fileTransfers = new List<IFileTransfer>();
53 -
55 + var trackedFiles = new List<ITrackedFile>();
56 var uxPayloadTuples = new List<WixBundlePayloadTuple>();
57
58 var attachedContainerIndex = 1; // count starts at one because UX container is "0".
@@ -114,12 +116,14 @@ namespace WixToolset.Core.Burn.Bundles
116 }
117
118 this.CreateContainer(container, containerPayloads);
119 + trackedFiles.Add(this.BackendHelper.TrackFile(container.WorkingPath, TrackedFileType.Temporary, container.SourceLineNumbers));
120 }
121 }
122
123 this.Containers = containerTuples;
124 this.UXContainerPayloads = uxPayloadTuples;
125 this.FileTransfers = fileTransfers;
126 + this.TrackedFiles = trackedFiles;
127 }
128
129 private void CreateContainer(WixBundleContainerTuple container, IEnumerable<WixBundlePayloadTuple> containerPayloads)
src/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs
+9
@@ -31,6 +31,8 @@ namespace WixToolset.Core.Burn.Bundles
31
32 public IEnumerable<IFileTransfer> FileTransfers { get; private set; }
33
34 + public IEnumerable<ITrackedFile> TrackedFiles { get; private set; }
35 +
36 private IMessaging Messaging { get; }
37
38 private IBackendHelper BackendHelper { get; }
@@ -44,6 +46,7 @@ namespace WixToolset.Core.Burn.Bundles
46 public void Execute()
47 {
48 var fileTransfers = new List<IFileTransfer>();
49 + var trackedFiles = new List<ITrackedFile>();
50
51 foreach (var payload in this.Payloads)
52 {
@@ -77,10 +80,16 @@ namespace WixToolset.Core.Burn.Bundles
80 var transfer = this.BackendHelper.CreateFileTransfer(sourceFile.Path, Path.Combine(this.LayoutDirectory, payload.Name), false, payload.SourceLineNumbers);
81 fileTransfers.Add(transfer);
82 }
83 +
84 + if (payload.ContentFile)
85 + {
86 + trackedFiles.Add(this.BackendHelper.TrackFile(sourceFile.Path, TrackedFileType.Input, payload.SourceLineNumbers));
87 + }
88 }
89 }
90
91 this.FileTransfers = fileTransfers;
92 + this.TrackedFiles = trackedFiles;
93 }
94
95 private void UpdatePayloadPackagingType(WixBundlePayloadTuple payload)
src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
+3 -1
@@ -232,8 +232,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind
232
233 // Extract files that come from binary .wixlibs and WixExtensions (this does not extract files from merge modules).
234 {
235 - var command = new ExtractEmbeddedFilesCommand(this.ExpectedEmbeddedFiles);
235 + var command = new ExtractEmbeddedFilesCommand(this.BackendHelper, this.ExpectedEmbeddedFiles);
236 command.Execute();
237 +
238 + trackedFiles.AddRange(command.TrackedFiles);
239 }
240
241 // This must occur after all variables and source paths have been resolved.
src/WixToolset.Core/Bind/ExtractEmbeddedFilesCommand.cs
+11 -1
@@ -7,18 +7,25 @@ namespace WixToolset.Core.Bind
7 using System.Linq;
8 using WixToolset.Data;
9 using WixToolset.Extensibility.Data;
10 + using WixToolset.Extensibility.Services;
11
12 public class ExtractEmbeddedFilesCommand
13 {
13 - public ExtractEmbeddedFilesCommand(IEnumerable<IExpectedExtractFile> embeddedFiles)
14 + public ExtractEmbeddedFilesCommand(IBackendHelper backendHelper, IEnumerable<IExpectedExtractFile> embeddedFiles)
15 {
16 + this.BackendHelper = backendHelper;
17 this.FilesWithEmbeddedFiles = embeddedFiles;
18 }
19
20 + public IEnumerable<ITrackedFile> TrackedFiles { get; private set; }
21 +
22 + private IBackendHelper BackendHelper { get; }
23 +
24 private IEnumerable<IExpectedExtractFile> FilesWithEmbeddedFiles { get; }
25
26 public void Execute()
27 {
28 + var trackedFiles = new List<ITrackedFile>();
29 var group = this.FilesWithEmbeddedFiles.GroupBy(e => e.Uri);
30
31 foreach (var expectedEmbeddedFileByUri in group)
@@ -34,10 +41,13 @@ namespace WixToolset.Core.Bind
41 if (uniqueIds.Add(embeddedFile.EmbeddedFileId))
42 {
43 wixout.ExtractEmbeddedFile(embeddedFile.EmbeddedFileId, embeddedFile.OutputPath);
44 + trackedFiles.Add(this.BackendHelper.TrackFile(embeddedFile.OutputPath, TrackedFileType.Temporary));
45 }
46 }
47 }
48 }
49 +
50 + this.TrackedFiles = trackedFiles;
51 }
52 }
53 }