@joebigelow / wix-1 / commits / 190135bb

Implement Burn pdb.

Sean Hall committed Apr 18, 2020 at 21:17 UTC 190135bbe8e941dee1d60d10b03e11a91574c11f
6 files changed +76 -74
src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs
+31 -15
@@ -74,6 +74,8 @@ namespace WixToolset.Core.Burn
74
75 public IEnumerable<ITrackedFile> TrackedFiles { get; private set; }
76
77 + public WixOutput Wixout { get; private set; }
78 +
79 public void Execute()
80 {
81 var section = this.Output.Sections.Single();
@@ -381,21 +383,25 @@ namespace WixToolset.Core.Burn
383 this.ResolveBundleInstallScope(section, bundleTuple, orderedFacades);
384
385 // Generate the core-defined BA manifest tables...
386 + string baManifestPath;
387 {
388 var command = new CreateBootstrapperApplicationManifestCommand(section, bundleTuple, orderedFacades, uxPayloadIndex, payloadTuples, this.IntermediateFolder);
389 command.Execute();
390
391 var baManifestPayload = command.BootstrapperApplicationManifestPayloadRow;
392 + baManifestPath = command.OutputPath;
393 payloadTuples.Add(baManifestPayload.Id.Id, baManifestPayload);
394 ++uxPayloadIndex;
395 }
396
397 // Generate the bundle extension manifest...
398 + string bextManifestPath;
399 {
400 var command = new CreateBundleExtensionManifestCommand(section, bundleTuple, extensionSearchTuplesById, uxPayloadIndex, this.IntermediateFolder);
401 command.Execute();
402
403 var bextManifestPayload = command.BundleExtensionManifestPayloadRow;
404 + bextManifestPath = command.OutputPath;
405 payloadTuples.Add(bextManifestPayload.Id.Id, bextManifestPayload);
406 ++uxPayloadIndex;
407 }
@@ -450,29 +456,39 @@ namespace WixToolset.Core.Burn
456 fileTransfers.Add(command.Transfer);
457 }
458
453 -#if TODO
454 - this.Pdb = new Pdb { Output = output };
459 +#if TODO // does this need to come back, or do they only need to be in TrackedFiles?
460 + this.ContentFilePaths = payloadTuples.Values.Where(p => p.ContentFile).Select(p => p.FullFileName).ToList();
461 +#endif
462 + this.FileTransfers = fileTransfers;
463 + this.TrackedFiles = trackedFiles;
464 + this.Wixout = this.CreateWixout(trackedFiles, this.Output, manifestPath, baManifestPath, bextManifestPath);
465 + }
466 +
467 + private WixOutput CreateWixout(List<ITrackedFile> trackedFiles, Intermediate intermediate, string manifestPath, string baDataPath, string bextDataPath)
468 + {
469 + WixOutput wixout;
470
456 - if (!String.IsNullOrEmpty(this.OutputPdbPath))
471 + if (String.IsNullOrEmpty(this.OutputPdbPath))
472 + {
473 + wixout = WixOutput.Create();
474 + }
475 + else
476 {
477 var trackPdb = this.BackendHelper.TrackFile(this.OutputPdbPath, TrackedFileType.Final);
478 trackedFiles.Add(trackPdb);
479
461 - this.Pdb.Save(trackPdb.Path);
480 + wixout = WixOutput.Create(trackPdb.Path);
481 }
463 -#endif
482
465 -#if TODO // does this need to come back, or do they only need to be in TrackedFiles?
466 - this.ContentFilePaths = payloadTuples.Values.Where(p => p.ContentFile).Select(p => p.FullFileName).ToList();
467 -#endif
468 - this.FileTransfers = fileTransfers;
469 - this.TrackedFiles = trackedFiles;
483 + intermediate.Save(wixout);
484 +
485 + wixout.ImportDataStream(BurnConstants.BurnManifestWixOutputStreamName, manifestPath);
486 + wixout.ImportDataStream(BurnConstants.BootstrapperApplicationDataWixOutputStreamName, baDataPath);
487 + wixout.ImportDataStream(BurnConstants.BundleExtensionDataWixOutputStreamName, bextDataPath);
488 +
489 + wixout.Reopen();
490
471 - // TODO: Eventually this gets removed
472 - var intermediate = new Intermediate(this.Output.Id, new[] { section }, this.Output.Localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase));
473 - var trackIntermediate = this.BackendHelper.TrackFile(Path.Combine(this.IntermediateFolder, Path.GetFileName(Path.ChangeExtension(this.OutputPath, "wir"))), TrackedFileType.Intermediate);
474 - intermediate.Save(trackIntermediate.Path);
475 - trackedFiles.Add(trackIntermediate);
491 + return wixout;
492 }
493
494 /// <summary>
src/WixToolset.Core.Burn/BundleBackend.cs
+1
@@ -30,6 +30,7 @@ namespace WixToolset.Core.Burn
30 var result = context.ServiceProvider.GetService<IBindResult>();
31 result.FileTransfers = command.FileTransfers;
32 result.TrackedFiles = command.TrackedFiles;
33 + result.Wixout = command.Wixout;
34
35 foreach (var extension in backendExtensions)
36 {
src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs
+4 -2
@@ -40,11 +40,13 @@ namespace WixToolset.Core.Burn.Bundles
40
41 public WixBundlePayloadTuple BootstrapperApplicationManifestPayloadRow { get; private set; }
42
43 + public string OutputPath { get; private set; }
44 +
45 public void Execute()
46 {
45 - var baManifestPath = this.CreateBootstrapperApplicationManifest();
47 + this.OutputPath = this.CreateBootstrapperApplicationManifest();
48
47 - this.BootstrapperApplicationManifestPayloadRow = this.CreateBootstrapperApplicationManifestPayloadRow(baManifestPath);
49 + this.BootstrapperApplicationManifestPayloadRow = this.CreateBootstrapperApplicationManifestPayloadRow(this.OutputPath);
50 }
51
52 private string CreateBootstrapperApplicationManifest()
src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs
+4 -2
@@ -37,11 +37,13 @@ namespace WixToolset.Core.Burn.Bundles
37
38 public WixBundlePayloadTuple BundleExtensionManifestPayloadRow { get; private set; }
39
40 + public string OutputPath { get; private set; }
41 +
42 public void Execute()
43 {
42 - var bextManifestPath = this.CreateBundleExtensionManifest();
44 + this.OutputPath = this.CreateBundleExtensionManifest();
45
44 - this.BundleExtensionManifestPayloadRow = this.CreateBundleExtensionManifestPayloadRow(bextManifestPath);
46 + this.BundleExtensionManifestPayloadRow = this.CreateBundleExtensionManifestPayloadRow(this.OutputPath);
47 }
48
49 private string CreateBundleExtensionManifest()
src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
+36 -41
@@ -5,10 +5,12 @@ namespace WixToolsetTest.CoreIntegration
5 using System;
6 using System.IO;
7 using System.Linq;
8 + using System.Text;
9 using Example.Extension;
10 using WixBuildTools.TestSupport;
11 using WixToolset.Core.TestPackage;
12 using WixToolset.Data;
13 + using WixToolset.Data.Burn;
14 using WixToolset.Data.Tuples;
15 using Xunit;
16
@@ -40,21 +42,7 @@ namespace WixToolsetTest.CoreIntegration
42 result.AssertSuccess();
43
44 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe")));
43 -#if TODO
45 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
45 -#endif
46 -
47 - var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir"));
48 - var section = intermediate.Sections.Single();
49 -
50 - var bundleTuple = section.Tuples.OfType<WixBundleTuple>().Single();
51 - Assert.Equal("1.0.0.0", bundleTuple.Version);
52 -
53 - var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue;
54 - Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString());
55 -
56 - var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single();
57 - Assert.Equal("test.msi", msiTuple.Id.Id);
46 }
47 }
48
@@ -68,6 +56,10 @@ namespace WixToolsetTest.CoreIntegration
56 {
57 var baseFolder = fs.GetFolder();
58 var intermediateFolder = Path.Combine(baseFolder, "obj");
59 + var exePath = Path.Combine(baseFolder, @"bin\test.exe");
60 + var pdbPath = Path.Combine(baseFolder, @"bin\test.wixpdb");
61 + var baFolderPath = Path.Combine(baseFolder, "ba");
62 + var extractFolderPath = Path.Combine(baseFolder, "extract");
63
64 var result = WixRunner.Execute(new[]
65 {
@@ -77,27 +69,44 @@ namespace WixToolsetTest.CoreIntegration
69 "-bindpath", Path.Combine(folder, "data"),
70 "-intermediateFolder", intermediateFolder,
71 "-burnStub", burnStubPath,
80 - "-o", Path.Combine(baseFolder, @"bin\test.exe")
72 + "-o", exePath,
73 });
74
75 result.AssertSuccess();
76
85 - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe")));
86 -#if TODO
87 - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
88 -#endif
77 + Assert.True(File.Exists(exePath));
78 + Assert.True(File.Exists(pdbPath));
79 +
80 + using (var wixOutput = WixOutput.Read(pdbPath))
81 + {
82
90 - var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir"));
91 - var section = intermediate.Sections.Single();
83 + var intermediate = Intermediate.Load(wixOutput);
84 + var section = intermediate.Sections.Single();
85
93 - var bundleTuple = section.Tuples.OfType<WixBundleTuple>().Single();
94 - Assert.Equal("1.0.0.0", bundleTuple.Version);
86 + var bundleTuple = section.Tuples.OfType<WixBundleTuple>().Single();
87 + Assert.Equal("1.0.0.0", bundleTuple.Version);
88
96 - var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue;
97 - Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString());
89 + var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue;
90 + Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString());
91
99 - var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single();
100 - Assert.Equal("test.msi", msiTuple.Id.Id);
92 + var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single();
93 + Assert.Equal("test.msi", msiTuple.Id.Id);
94 +
95 + var extractResult = BundleExtractor.ExtractBAContainer(null, exePath, baFolderPath, extractFolderPath);
96 + extractResult.AssertSuccess();
97 +
98 + var burnManifestData = wixOutput.GetData(BurnConstants.BurnManifestWixOutputStreamName);
99 + var extractedBurnManifestData = File.ReadAllText(Path.Combine(baFolderPath, "manifest.xml"), Encoding.UTF8);
100 + Assert.Equal(extractedBurnManifestData, burnManifestData);
101 +
102 + var baManifestData = wixOutput.GetData(BurnConstants.BootstrapperApplicationDataWixOutputStreamName);
103 + var extractedBaManifestData = File.ReadAllText(Path.Combine(baFolderPath, "BootstrapperApplicationData.xml"), Encoding.UTF8);
104 + Assert.Equal(extractedBaManifestData, baManifestData);
105 +
106 + var bextManifestData = wixOutput.GetData(BurnConstants.BundleExtensionDataWixOutputStreamName);
107 + var extractedBextManifestData = File.ReadAllText(Path.Combine(baFolderPath, "BundleExtensionData.xml"), Encoding.UTF8);
108 + Assert.Equal(extractedBextManifestData, bextManifestData);
109 + }
110 }
111 }
112
@@ -128,21 +137,7 @@ namespace WixToolsetTest.CoreIntegration
137 result.AssertSuccess();
138
139 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe")));
131 -#if TODO
140 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
133 -#endif
134 -
135 - var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir"));
136 - var section = intermediate.Sections.Single();
137 -
138 - var bundleTuple = section.Tuples.OfType<WixBundleTuple>().Single();
139 - Assert.Equal("1.0.0.0", bundleTuple.Version);
140 -
141 - var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue;
142 - Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString());
143 -
144 - var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single();
145 - Assert.Equal("test.msi", msiTuple.Id.Id);
141 }
142 }
143 }
src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs
-14
@@ -50,21 +50,7 @@ namespace WixToolsetTest.CoreIntegration
50 result.AssertSuccess();
51
52 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe")));
53 -#if TODO
53 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
55 -#endif
56 -
57 - var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir"));
58 - var section = intermediate.Sections.Single();
59 -
60 - var bundleTuple = section.Tuples.OfType<WixBundleTuple>().Single();
61 - Assert.Equal("1.0.0.0", bundleTuple.Version);
62 -
63 - var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue;
64 - Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString());
65 -
66 - var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single();
67 - Assert.Equal("test.msi", msiTuple.Id.Id);
54 }
55 }
56