From 190135bbe8e941dee1d60d10b03e11a91574c11f Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 18 Apr 2020 21:17:51 +1000 Subject: Implement Burn pdb. --- src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs | 46 ++++++++----- src/WixToolset.Core.Burn/BundleBackend.cs | 1 + ...CreateBootstrapperApplicationManifestCommand.cs | 6 +- .../CreateBundleExtensionManifestCommand.cs | 6 +- .../BundleFixture.cs | 77 ++++++++++------------ .../WixlibFixture.cs | 14 ---- 6 files changed, 76 insertions(+), 74 deletions(-) (limited to 'src') diff --git a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs index 989a1b65..af129998 100644 --- a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs +++ b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs @@ -74,6 +74,8 @@ namespace WixToolset.Core.Burn public IEnumerable TrackedFiles { get; private set; } + public WixOutput Wixout { get; private set; } + public void Execute() { var section = this.Output.Sections.Single(); @@ -381,21 +383,25 @@ namespace WixToolset.Core.Burn this.ResolveBundleInstallScope(section, bundleTuple, orderedFacades); // Generate the core-defined BA manifest tables... + string baManifestPath; { var command = new CreateBootstrapperApplicationManifestCommand(section, bundleTuple, orderedFacades, uxPayloadIndex, payloadTuples, this.IntermediateFolder); command.Execute(); var baManifestPayload = command.BootstrapperApplicationManifestPayloadRow; + baManifestPath = command.OutputPath; payloadTuples.Add(baManifestPayload.Id.Id, baManifestPayload); ++uxPayloadIndex; } // Generate the bundle extension manifest... + string bextManifestPath; { var command = new CreateBundleExtensionManifestCommand(section, bundleTuple, extensionSearchTuplesById, uxPayloadIndex, this.IntermediateFolder); command.Execute(); var bextManifestPayload = command.BundleExtensionManifestPayloadRow; + bextManifestPath = command.OutputPath; payloadTuples.Add(bextManifestPayload.Id.Id, bextManifestPayload); ++uxPayloadIndex; } @@ -450,29 +456,39 @@ namespace WixToolset.Core.Burn fileTransfers.Add(command.Transfer); } -#if TODO - this.Pdb = new Pdb { Output = output }; +#if TODO // does this need to come back, or do they only need to be in TrackedFiles? + this.ContentFilePaths = payloadTuples.Values.Where(p => p.ContentFile).Select(p => p.FullFileName).ToList(); +#endif + this.FileTransfers = fileTransfers; + this.TrackedFiles = trackedFiles; + this.Wixout = this.CreateWixout(trackedFiles, this.Output, manifestPath, baManifestPath, bextManifestPath); + } + + private WixOutput CreateWixout(List trackedFiles, Intermediate intermediate, string manifestPath, string baDataPath, string bextDataPath) + { + WixOutput wixout; - if (!String.IsNullOrEmpty(this.OutputPdbPath)) + if (String.IsNullOrEmpty(this.OutputPdbPath)) + { + wixout = WixOutput.Create(); + } + else { var trackPdb = this.BackendHelper.TrackFile(this.OutputPdbPath, TrackedFileType.Final); trackedFiles.Add(trackPdb); - this.Pdb.Save(trackPdb.Path); + wixout = WixOutput.Create(trackPdb.Path); } -#endif -#if TODO // does this need to come back, or do they only need to be in TrackedFiles? - this.ContentFilePaths = payloadTuples.Values.Where(p => p.ContentFile).Select(p => p.FullFileName).ToList(); -#endif - this.FileTransfers = fileTransfers; - this.TrackedFiles = trackedFiles; + intermediate.Save(wixout); + + wixout.ImportDataStream(BurnConstants.BurnManifestWixOutputStreamName, manifestPath); + wixout.ImportDataStream(BurnConstants.BootstrapperApplicationDataWixOutputStreamName, baDataPath); + wixout.ImportDataStream(BurnConstants.BundleExtensionDataWixOutputStreamName, bextDataPath); + + wixout.Reopen(); - // TODO: Eventually this gets removed - var intermediate = new Intermediate(this.Output.Id, new[] { section }, this.Output.Localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase)); - var trackIntermediate = this.BackendHelper.TrackFile(Path.Combine(this.IntermediateFolder, Path.GetFileName(Path.ChangeExtension(this.OutputPath, "wir"))), TrackedFileType.Intermediate); - intermediate.Save(trackIntermediate.Path); - trackedFiles.Add(trackIntermediate); + return wixout; } /// diff --git a/src/WixToolset.Core.Burn/BundleBackend.cs b/src/WixToolset.Core.Burn/BundleBackend.cs index 99442403..4a2f44b1 100644 --- a/src/WixToolset.Core.Burn/BundleBackend.cs +++ b/src/WixToolset.Core.Burn/BundleBackend.cs @@ -30,6 +30,7 @@ namespace WixToolset.Core.Burn var result = context.ServiceProvider.GetService(); result.FileTransfers = command.FileTransfers; result.TrackedFiles = command.TrackedFiles; + result.Wixout = command.Wixout; foreach (var extension in backendExtensions) { diff --git a/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs b/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs index 231be7a5..cdab21fb 100644 --- a/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs @@ -40,11 +40,13 @@ namespace WixToolset.Core.Burn.Bundles public WixBundlePayloadTuple BootstrapperApplicationManifestPayloadRow { get; private set; } + public string OutputPath { get; private set; } + public void Execute() { - var baManifestPath = this.CreateBootstrapperApplicationManifest(); + this.OutputPath = this.CreateBootstrapperApplicationManifest(); - this.BootstrapperApplicationManifestPayloadRow = this.CreateBootstrapperApplicationManifestPayloadRow(baManifestPath); + this.BootstrapperApplicationManifestPayloadRow = this.CreateBootstrapperApplicationManifestPayloadRow(this.OutputPath); } private string CreateBootstrapperApplicationManifest() diff --git a/src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs b/src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs index 73ad5174..b4739775 100644 --- a/src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs @@ -37,11 +37,13 @@ namespace WixToolset.Core.Burn.Bundles public WixBundlePayloadTuple BundleExtensionManifestPayloadRow { get; private set; } + public string OutputPath { get; private set; } + public void Execute() { - var bextManifestPath = this.CreateBundleExtensionManifest(); + this.OutputPath = this.CreateBundleExtensionManifest(); - this.BundleExtensionManifestPayloadRow = this.CreateBundleExtensionManifestPayloadRow(bextManifestPath); + this.BundleExtensionManifestPayloadRow = this.CreateBundleExtensionManifestPayloadRow(this.OutputPath); } private string CreateBundleExtensionManifest() diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs index 58f61ab8..31cfed34 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs @@ -5,10 +5,12 @@ namespace WixToolsetTest.CoreIntegration using System; using System.IO; using System.Linq; + using System.Text; using Example.Extension; using WixBuildTools.TestSupport; using WixToolset.Core.TestPackage; using WixToolset.Data; + using WixToolset.Data.Burn; using WixToolset.Data.Tuples; using Xunit; @@ -40,21 +42,7 @@ namespace WixToolsetTest.CoreIntegration result.AssertSuccess(); Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); -#if TODO Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); -#endif - - var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); - var section = intermediate.Sections.Single(); - - var bundleTuple = section.Tuples.OfType().Single(); - Assert.Equal("1.0.0.0", bundleTuple.Version); - - var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue; - Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString()); - - var msiTuple = section.Tuples.OfType().Single(); - Assert.Equal("test.msi", msiTuple.Id.Id); } } @@ -68,6 +56,10 @@ namespace WixToolsetTest.CoreIntegration { var baseFolder = fs.GetFolder(); var intermediateFolder = Path.Combine(baseFolder, "obj"); + var exePath = Path.Combine(baseFolder, @"bin\test.exe"); + var pdbPath = Path.Combine(baseFolder, @"bin\test.wixpdb"); + var baFolderPath = Path.Combine(baseFolder, "ba"); + var extractFolderPath = Path.Combine(baseFolder, "extract"); var result = WixRunner.Execute(new[] { @@ -77,27 +69,44 @@ namespace WixToolsetTest.CoreIntegration "-bindpath", Path.Combine(folder, "data"), "-intermediateFolder", intermediateFolder, "-burnStub", burnStubPath, - "-o", Path.Combine(baseFolder, @"bin\test.exe") + "-o", exePath, }); result.AssertSuccess(); - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); -#if TODO - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); -#endif + Assert.True(File.Exists(exePath)); + Assert.True(File.Exists(pdbPath)); + + using (var wixOutput = WixOutput.Read(pdbPath)) + { - var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); - var section = intermediate.Sections.Single(); + var intermediate = Intermediate.Load(wixOutput); + var section = intermediate.Sections.Single(); - var bundleTuple = section.Tuples.OfType().Single(); - Assert.Equal("1.0.0.0", bundleTuple.Version); + var bundleTuple = section.Tuples.OfType().Single(); + Assert.Equal("1.0.0.0", bundleTuple.Version); - var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue; - Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString()); + var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue; + Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString()); - var msiTuple = section.Tuples.OfType().Single(); - Assert.Equal("test.msi", msiTuple.Id.Id); + var msiTuple = section.Tuples.OfType().Single(); + Assert.Equal("test.msi", msiTuple.Id.Id); + + var extractResult = BundleExtractor.ExtractBAContainer(null, exePath, baFolderPath, extractFolderPath); + extractResult.AssertSuccess(); + + var burnManifestData = wixOutput.GetData(BurnConstants.BurnManifestWixOutputStreamName); + var extractedBurnManifestData = File.ReadAllText(Path.Combine(baFolderPath, "manifest.xml"), Encoding.UTF8); + Assert.Equal(extractedBurnManifestData, burnManifestData); + + var baManifestData = wixOutput.GetData(BurnConstants.BootstrapperApplicationDataWixOutputStreamName); + var extractedBaManifestData = File.ReadAllText(Path.Combine(baFolderPath, "BootstrapperApplicationData.xml"), Encoding.UTF8); + Assert.Equal(extractedBaManifestData, baManifestData); + + var bextManifestData = wixOutput.GetData(BurnConstants.BundleExtensionDataWixOutputStreamName); + var extractedBextManifestData = File.ReadAllText(Path.Combine(baFolderPath, "BundleExtensionData.xml"), Encoding.UTF8); + Assert.Equal(extractedBextManifestData, bextManifestData); + } } } @@ -128,21 +137,7 @@ namespace WixToolsetTest.CoreIntegration result.AssertSuccess(); Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); -#if TODO Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); -#endif - - var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); - var section = intermediate.Sections.Single(); - - var bundleTuple = section.Tuples.OfType().Single(); - Assert.Equal("1.0.0.0", bundleTuple.Version); - - var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue; - Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString()); - - var msiTuple = section.Tuples.OfType().Single(); - Assert.Equal("test.msi", msiTuple.Id.Id); } } } diff --git a/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs index 0e740554..44a0e283 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs @@ -50,21 +50,7 @@ namespace WixToolsetTest.CoreIntegration result.AssertSuccess(); Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); -#if TODO Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); -#endif - - var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); - var section = intermediate.Sections.Single(); - - var bundleTuple = section.Tuples.OfType().Single(); - Assert.Equal("1.0.0.0", bundleTuple.Version); - - var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue; - Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString()); - - var msiTuple = section.Tuples.OfType().Single(); - Assert.Equal("test.msi", msiTuple.Id.Id); } } -- cgit v1.2.3-55-g6feb