aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-04-18 21:17:51 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-04-18 21:31:28 +1000
commit190135bbe8e941dee1d60d10b03e11a91574c11f (patch)
tree381651cfbb157c0b46768fed705e6026ad2d3a2e /src
parenta6091afa5bd24fe65e7fc20f179ed888301afdf8 (diff)
downloadwix-190135bbe8e941dee1d60d10b03e11a91574c11f.tar.gz
wix-190135bbe8e941dee1d60d10b03e11a91574c11f.tar.bz2
wix-190135bbe8e941dee1d60d10b03e11a91574c11f.zip
Implement Burn pdb.
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs46
-rw-r--r--src/WixToolset.Core.Burn/BundleBackend.cs1
-rw-r--r--src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs6
-rw-r--r--src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs6
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs77
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs14
6 files changed, 76 insertions, 74 deletions
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
74 74
75 public IEnumerable<ITrackedFile> TrackedFiles { get; private set; } 75 public IEnumerable<ITrackedFile> TrackedFiles { get; private set; }
76 76
77 public WixOutput Wixout { get; private set; }
78
77 public void Execute() 79 public void Execute()
78 { 80 {
79 var section = this.Output.Sections.Single(); 81 var section = this.Output.Sections.Single();
@@ -381,21 +383,25 @@ namespace WixToolset.Core.Burn
381 this.ResolveBundleInstallScope(section, bundleTuple, orderedFacades); 383 this.ResolveBundleInstallScope(section, bundleTuple, orderedFacades);
382 384
383 // Generate the core-defined BA manifest tables... 385 // Generate the core-defined BA manifest tables...
386 string baManifestPath;
384 { 387 {
385 var command = new CreateBootstrapperApplicationManifestCommand(section, bundleTuple, orderedFacades, uxPayloadIndex, payloadTuples, this.IntermediateFolder); 388 var command = new CreateBootstrapperApplicationManifestCommand(section, bundleTuple, orderedFacades, uxPayloadIndex, payloadTuples, this.IntermediateFolder);
386 command.Execute(); 389 command.Execute();
387 390
388 var baManifestPayload = command.BootstrapperApplicationManifestPayloadRow; 391 var baManifestPayload = command.BootstrapperApplicationManifestPayloadRow;
392 baManifestPath = command.OutputPath;
389 payloadTuples.Add(baManifestPayload.Id.Id, baManifestPayload); 393 payloadTuples.Add(baManifestPayload.Id.Id, baManifestPayload);
390 ++uxPayloadIndex; 394 ++uxPayloadIndex;
391 } 395 }
392 396
393 // Generate the bundle extension manifest... 397 // Generate the bundle extension manifest...
398 string bextManifestPath;
394 { 399 {
395 var command = new CreateBundleExtensionManifestCommand(section, bundleTuple, extensionSearchTuplesById, uxPayloadIndex, this.IntermediateFolder); 400 var command = new CreateBundleExtensionManifestCommand(section, bundleTuple, extensionSearchTuplesById, uxPayloadIndex, this.IntermediateFolder);
396 command.Execute(); 401 command.Execute();
397 402
398 var bextManifestPayload = command.BundleExtensionManifestPayloadRow; 403 var bextManifestPayload = command.BundleExtensionManifestPayloadRow;
404 bextManifestPath = command.OutputPath;
399 payloadTuples.Add(bextManifestPayload.Id.Id, bextManifestPayload); 405 payloadTuples.Add(bextManifestPayload.Id.Id, bextManifestPayload);
400 ++uxPayloadIndex; 406 ++uxPayloadIndex;
401 } 407 }
@@ -450,29 +456,39 @@ namespace WixToolset.Core.Burn
450 fileTransfers.Add(command.Transfer); 456 fileTransfers.Add(command.Transfer);
451 } 457 }
452 458
453#if TODO 459#if TODO // does this need to come back, or do they only need to be in TrackedFiles?
454 this.Pdb = new Pdb { Output = output }; 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;
455 470
456 if (!String.IsNullOrEmpty(this.OutputPdbPath)) 471 if (String.IsNullOrEmpty(this.OutputPdbPath))
472 {
473 wixout = WixOutput.Create();
474 }
475 else
457 { 476 {
458 var trackPdb = this.BackendHelper.TrackFile(this.OutputPdbPath, TrackedFileType.Final); 477 var trackPdb = this.BackendHelper.TrackFile(this.OutputPdbPath, TrackedFileType.Final);
459 trackedFiles.Add(trackPdb); 478 trackedFiles.Add(trackPdb);
460 479
461 this.Pdb.Save(trackPdb.Path); 480 wixout = WixOutput.Create(trackPdb.Path);
462 } 481 }
463#endif
464 482
465#if TODO // does this need to come back, or do they only need to be in TrackedFiles? 483 intermediate.Save(wixout);
466 this.ContentFilePaths = payloadTuples.Values.Where(p => p.ContentFile).Select(p => p.FullFileName).ToList(); 484
467#endif 485 wixout.ImportDataStream(BurnConstants.BurnManifestWixOutputStreamName, manifestPath);
468 this.FileTransfers = fileTransfers; 486 wixout.ImportDataStream(BurnConstants.BootstrapperApplicationDataWixOutputStreamName, baDataPath);
469 this.TrackedFiles = trackedFiles; 487 wixout.ImportDataStream(BurnConstants.BundleExtensionDataWixOutputStreamName, bextDataPath);
488
489 wixout.Reopen();
470 490
471 // TODO: Eventually this gets removed 491 return wixout;
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);
476 } 492 }
477 493
478 /// <summary> 494 /// <summary>
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
30 var result = context.ServiceProvider.GetService<IBindResult>(); 30 var result = context.ServiceProvider.GetService<IBindResult>();
31 result.FileTransfers = command.FileTransfers; 31 result.FileTransfers = command.FileTransfers;
32 result.TrackedFiles = command.TrackedFiles; 32 result.TrackedFiles = command.TrackedFiles;
33 result.Wixout = command.Wixout;
33 34
34 foreach (var extension in backendExtensions) 35 foreach (var extension in backendExtensions)
35 { 36 {
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
40 40
41 public WixBundlePayloadTuple BootstrapperApplicationManifestPayloadRow { get; private set; } 41 public WixBundlePayloadTuple BootstrapperApplicationManifestPayloadRow { get; private set; }
42 42
43 public string OutputPath { get; private set; }
44
43 public void Execute() 45 public void Execute()
44 { 46 {
45 var baManifestPath = this.CreateBootstrapperApplicationManifest(); 47 this.OutputPath = this.CreateBootstrapperApplicationManifest();
46 48
47 this.BootstrapperApplicationManifestPayloadRow = this.CreateBootstrapperApplicationManifestPayloadRow(baManifestPath); 49 this.BootstrapperApplicationManifestPayloadRow = this.CreateBootstrapperApplicationManifestPayloadRow(this.OutputPath);
48 } 50 }
49 51
50 private string CreateBootstrapperApplicationManifest() 52 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
37 37
38 public WixBundlePayloadTuple BundleExtensionManifestPayloadRow { get; private set; } 38 public WixBundlePayloadTuple BundleExtensionManifestPayloadRow { get; private set; }
39 39
40 public string OutputPath { get; private set; }
41
40 public void Execute() 42 public void Execute()
41 { 43 {
42 var bextManifestPath = this.CreateBundleExtensionManifest(); 44 this.OutputPath = this.CreateBundleExtensionManifest();
43 45
44 this.BundleExtensionManifestPayloadRow = this.CreateBundleExtensionManifestPayloadRow(bextManifestPath); 46 this.BundleExtensionManifestPayloadRow = this.CreateBundleExtensionManifestPayloadRow(this.OutputPath);
45 } 47 }
46 48
47 private string CreateBundleExtensionManifest() 49 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
5 using System; 5 using System;
6 using System.IO; 6 using System.IO;
7 using System.Linq; 7 using System.Linq;
8 using System.Text;
8 using Example.Extension; 9 using Example.Extension;
9 using WixBuildTools.TestSupport; 10 using WixBuildTools.TestSupport;
10 using WixToolset.Core.TestPackage; 11 using WixToolset.Core.TestPackage;
11 using WixToolset.Data; 12 using WixToolset.Data;
13 using WixToolset.Data.Burn;
12 using WixToolset.Data.Tuples; 14 using WixToolset.Data.Tuples;
13 using Xunit; 15 using Xunit;
14 16
@@ -40,21 +42,7 @@ namespace WixToolsetTest.CoreIntegration
40 result.AssertSuccess(); 42 result.AssertSuccess();
41 43
42 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); 44 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe")));
43#if TODO
44 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); 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);
58 } 46 }
59 } 47 }
60 48
@@ -68,6 +56,10 @@ namespace WixToolsetTest.CoreIntegration
68 { 56 {
69 var baseFolder = fs.GetFolder(); 57 var baseFolder = fs.GetFolder();
70 var intermediateFolder = Path.Combine(baseFolder, "obj"); 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");
71 63
72 var result = WixRunner.Execute(new[] 64 var result = WixRunner.Execute(new[]
73 { 65 {
@@ -77,27 +69,44 @@ namespace WixToolsetTest.CoreIntegration
77 "-bindpath", Path.Combine(folder, "data"), 69 "-bindpath", Path.Combine(folder, "data"),
78 "-intermediateFolder", intermediateFolder, 70 "-intermediateFolder", intermediateFolder,
79 "-burnStub", burnStubPath, 71 "-burnStub", burnStubPath,
80 "-o", Path.Combine(baseFolder, @"bin\test.exe") 72 "-o", exePath,
81 }); 73 });
82 74
83 result.AssertSuccess(); 75 result.AssertSuccess();
84 76
85 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); 77 Assert.True(File.Exists(exePath));
86#if TODO 78 Assert.True(File.Exists(pdbPath));
87 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); 79
88#endif 80 using (var wixOutput = WixOutput.Read(pdbPath))
81 {
89 82
90 var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); 83 var intermediate = Intermediate.Load(wixOutput);
91 var section = intermediate.Sections.Single(); 84 var section = intermediate.Sections.Single();
92 85
93 var bundleTuple = section.Tuples.OfType<WixBundleTuple>().Single(); 86 var bundleTuple = section.Tuples.OfType<WixBundleTuple>().Single();
94 Assert.Equal("1.0.0.0", bundleTuple.Version); 87 Assert.Equal("1.0.0.0", bundleTuple.Version);
95 88
96 var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue; 89 var previousVersion = bundleTuple.Fields[(int)WixBundleTupleFields.Version].PreviousValue;
97 Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString()); 90 Assert.Equal("!(bind.packageVersion.test.msi)", previousVersion.AsString());
98 91
99 var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single(); 92 var msiTuple = section.Tuples.OfType<WixBundlePackageTuple>().Single();
100 Assert.Equal("test.msi", msiTuple.Id.Id); 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 }
101 } 110 }
102 } 111 }
103 112
@@ -128,21 +137,7 @@ namespace WixToolsetTest.CoreIntegration
128 result.AssertSuccess(); 137 result.AssertSuccess();
129 138
130 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); 139 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe")));
131#if TODO
132 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); 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);
146 } 141 }
147 } 142 }
148 } 143 }
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
50 result.AssertSuccess(); 50 result.AssertSuccess();
51 51
52 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe"))); 52 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.exe")));
53#if TODO
54 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); 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);
68 } 54 }
69 } 55 }
70 56