diff options
Diffstat (limited to 'src')
4 files changed, 91 insertions, 23 deletions
diff --git a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs index b88251af..deab4d78 100644 --- a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs +++ b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs | |||
| @@ -390,7 +390,7 @@ namespace WixToolset.Core.Burn | |||
| 390 | // Generate the core-defined BA manifest tables... | 390 | // Generate the core-defined BA manifest tables... |
| 391 | string baManifestPath; | 391 | string baManifestPath; |
| 392 | { | 392 | { |
| 393 | var command = new CreateBootstrapperApplicationManifestCommand(section, bundleSymbol, orderedFacades, uxPayloadIndex, packagesPayloads, this.IntermediateFolder, this.InternalBurnBackendHelper); | 393 | var command = new CreateBootstrapperApplicationManifestCommand(section, bundleSymbol, orderedFacades, uxPayloadIndex, payloadSymbols, packagesPayloads, this.IntermediateFolder, this.InternalBurnBackendHelper); |
| 394 | command.Execute(); | 394 | command.Execute(); |
| 395 | 395 | ||
| 396 | var baManifestPayload = command.BootstrapperApplicationManifestPayloadRow; | 396 | var baManifestPayload = command.BootstrapperApplicationManifestPayloadRow; |
diff --git a/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs b/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs index 115ea671..a0ee606d 100644 --- a/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs +++ b/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs | |||
| @@ -15,12 +15,13 @@ namespace WixToolset.Core.Burn.Bundles | |||
| 15 | 15 | ||
| 16 | internal class CreateBootstrapperApplicationManifestCommand | 16 | internal class CreateBootstrapperApplicationManifestCommand |
| 17 | { | 17 | { |
| 18 | public CreateBootstrapperApplicationManifestCommand(IntermediateSection section, WixBundleSymbol bundleSymbol, IEnumerable<PackageFacade> chainPackages, int lastUXPayloadIndex, Dictionary<string, Dictionary<string, WixBundlePayloadSymbol>> packagesPayloads, string intermediateFolder, IInternalBurnBackendHelper internalBurnBackendHelper) | 18 | public CreateBootstrapperApplicationManifestCommand(IntermediateSection section, WixBundleSymbol bundleSymbol, IEnumerable<PackageFacade> chainPackages, int lastUXPayloadIndex, Dictionary<string, WixBundlePayloadSymbol> payloadSymbols, Dictionary<string, Dictionary<string, WixBundlePayloadSymbol>> packagesPayloads, string intermediateFolder, IInternalBurnBackendHelper internalBurnBackendHelper) |
| 19 | { | 19 | { |
| 20 | this.Section = section; | 20 | this.Section = section; |
| 21 | this.BundleSymbol = bundleSymbol; | 21 | this.BundleSymbol = bundleSymbol; |
| 22 | this.ChainPackages = chainPackages; | 22 | this.ChainPackages = chainPackages; |
| 23 | this.LastUXPayloadIndex = lastUXPayloadIndex; | 23 | this.LastUXPayloadIndex = lastUXPayloadIndex; |
| 24 | this.Payloads = payloadSymbols; | ||
| 24 | this.PackagesPayloads = packagesPayloads; | 25 | this.PackagesPayloads = packagesPayloads; |
| 25 | this.IntermediateFolder = intermediateFolder; | 26 | this.IntermediateFolder = intermediateFolder; |
| 26 | this.InternalBurnBackendHelper = internalBurnBackendHelper; | 27 | this.InternalBurnBackendHelper = internalBurnBackendHelper; |
| @@ -36,6 +37,8 @@ namespace WixToolset.Core.Burn.Bundles | |||
| 36 | 37 | ||
| 37 | private int LastUXPayloadIndex { get; } | 38 | private int LastUXPayloadIndex { get; } |
| 38 | 39 | ||
| 40 | private Dictionary<string, WixBundlePayloadSymbol> Payloads { get; } | ||
| 41 | |||
| 39 | private Dictionary<string, Dictionary<string, WixBundlePayloadSymbol>> PackagesPayloads { get; } | 42 | private Dictionary<string, Dictionary<string, WixBundlePayloadSymbol>> PackagesPayloads { get; } |
| 40 | 43 | ||
| 41 | private string IntermediateFolder { get; } | 44 | private string IntermediateFolder { get; } |
| @@ -216,7 +219,6 @@ namespace WixToolset.Core.Burn.Bundles | |||
| 216 | 219 | ||
| 217 | private void WritePayloadInfo(XmlTextWriter writer) | 220 | private void WritePayloadInfo(XmlTextWriter writer) |
| 218 | { | 221 | { |
| 219 | // TODO: check v3 - should this be only include package payloads or include all non-UX container payloads? | ||
| 220 | foreach (var kvp in this.PackagesPayloads.OrderBy(kvp => kvp.Key, StringComparer.Ordinal)) | 222 | foreach (var kvp in this.PackagesPayloads.OrderBy(kvp => kvp.Key, StringComparer.Ordinal)) |
| 221 | { | 223 | { |
| 222 | var packageId = kvp.Key; | 224 | var packageId = kvp.Key; |
| @@ -224,30 +226,41 @@ namespace WixToolset.Core.Burn.Bundles | |||
| 224 | 226 | ||
| 225 | foreach (var payloadSymbol in payloadsById.Values.OrderBy(p => p.Id.Id, StringComparer.Ordinal)) | 227 | foreach (var payloadSymbol in payloadsById.Values.OrderBy(p => p.Id.Id, StringComparer.Ordinal)) |
| 226 | { | 228 | { |
| 227 | writer.WriteStartElement("WixPayloadProperties"); | 229 | this.WritePayloadInfo(writer, payloadSymbol, packageId); |
| 230 | } | ||
| 231 | } | ||
| 228 | 232 | ||
| 229 | writer.WriteAttributeString("Package", packageId); | 233 | foreach (var payloadSymbol in this.Payloads.Values.Where(p => p.LayoutOnly).OrderBy(p => p.Id.Id, StringComparer.Ordinal)) |
| 234 | { | ||
| 235 | this.WritePayloadInfo(writer, payloadSymbol, null); | ||
| 236 | } | ||
| 237 | } | ||
| 230 | 238 | ||
| 231 | writer.WriteAttributeString("Payload", payloadSymbol.Id.Id); | 239 | private void WritePayloadInfo(XmlTextWriter writer, WixBundlePayloadSymbol payloadSymbol, string packageId) |
| 240 | { | ||
| 241 | writer.WriteStartElement("WixPayloadProperties"); | ||
| 232 | 242 | ||
| 233 | if (!String.IsNullOrEmpty(payloadSymbol.ContainerRef)) | 243 | if (!String.IsNullOrEmpty(packageId)) |
| 234 | { | 244 | { |
| 235 | writer.WriteAttributeString("Container", payloadSymbol.ContainerRef); | 245 | writer.WriteAttributeString("Package", packageId); |
| 236 | } | 246 | } |
| 237 | 247 | ||
| 238 | writer.WriteAttributeString("Name", payloadSymbol.Name); | 248 | writer.WriteAttributeString("Payload", payloadSymbol.Id.Id); |
| 239 | writer.WriteAttributeString("Size", payloadSymbol.FileSize.Value.ToString(CultureInfo.InvariantCulture)); | ||
| 240 | 249 | ||
| 241 | if (!String.IsNullOrEmpty(payloadSymbol.DownloadUrl)) | 250 | if (!String.IsNullOrEmpty(payloadSymbol.ContainerRef)) |
| 242 | { | 251 | { |
| 243 | writer.WriteAttributeString("DownloadUrl", payloadSymbol.DownloadUrl); | 252 | writer.WriteAttributeString("Container", payloadSymbol.ContainerRef); |
| 244 | } | 253 | } |
| 245 | 254 | ||
| 246 | writer.WriteAttributeString("LayoutOnly", payloadSymbol.LayoutOnly ? "yes" : "no"); | 255 | writer.WriteAttributeString("Name", payloadSymbol.Name); |
| 256 | writer.WriteAttributeString("Size", payloadSymbol.FileSize.Value.ToString(CultureInfo.InvariantCulture)); | ||
| 247 | 257 | ||
| 248 | writer.WriteEndElement(); | 258 | if (!String.IsNullOrEmpty(payloadSymbol.DownloadUrl)) |
| 249 | } | 259 | { |
| 260 | writer.WriteAttributeString("DownloadUrl", payloadSymbol.DownloadUrl); | ||
| 250 | } | 261 | } |
| 262 | |||
| 263 | writer.WriteEndElement(); | ||
| 251 | } | 264 | } |
| 252 | 265 | ||
| 253 | private WixBundlePayloadSymbol CreateBootstrapperApplicationManifestPayloadRow(string baManifestPath) | 266 | private WixBundlePayloadSymbol CreateBootstrapperApplicationManifestPayloadRow(string baManifestPath) |
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs index 29c741dc..6d769bd6 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs | |||
| @@ -131,10 +131,10 @@ namespace WixToolsetTest.CoreIntegration | |||
| 131 | { "WixPayloadProperties", new List<string> { "Size" } }, | 131 | { "WixPayloadProperties", new List<string> { "Size" } }, |
| 132 | }; | 132 | }; |
| 133 | Assert.Equal(4, payloadElements.Count); | 133 | Assert.Equal(4, payloadElements.Count); |
| 134 | Assert.Equal("<WixPayloadProperties Package='credwiz.exe' Payload='SourceFilePayload' Container='WixAttachedContainer' Name='SharedPayloadsBetweenPackages.wxs' Size='*' LayoutOnly='no' />", payloadElements[0].GetTestXml(ignoreAttributesByElementName)); | 134 | Assert.Equal("<WixPayloadProperties Package='credwiz.exe' Payload='SourceFilePayload' Container='WixAttachedContainer' Name='SharedPayloadsBetweenPackages.wxs' Size='*' />", payloadElements[0].GetTestXml(ignoreAttributesByElementName)); |
| 135 | Assert.Equal("<WixPayloadProperties Package='credwiz.exe' Payload='credwiz.exe' Container='WixAttachedContainer' Name='credwiz.exe' Size='*' LayoutOnly='no' />", payloadElements[1].GetTestXml(ignoreAttributesByElementName)); | 135 | Assert.Equal("<WixPayloadProperties Package='credwiz.exe' Payload='credwiz.exe' Container='WixAttachedContainer' Name='credwiz.exe' Size='*' />", payloadElements[1].GetTestXml(ignoreAttributesByElementName)); |
| 136 | Assert.Equal("<WixPayloadProperties Package='cscript.exe' Payload='SourceFilePayload' Container='WixAttachedContainer' Name='SharedPayloadsBetweenPackages.wxs' Size='*' LayoutOnly='no' />", payloadElements[2].GetTestXml(ignoreAttributesByElementName)); | 136 | Assert.Equal("<WixPayloadProperties Package='cscript.exe' Payload='SourceFilePayload' Container='WixAttachedContainer' Name='SharedPayloadsBetweenPackages.wxs' Size='*' />", payloadElements[2].GetTestXml(ignoreAttributesByElementName)); |
| 137 | Assert.Equal("<WixPayloadProperties Package='cscript.exe' Payload='cscript.exe' Container='WixAttachedContainer' Name='cscript.exe' Size='*' LayoutOnly='no' />", payloadElements[3].GetTestXml(ignoreAttributesByElementName)); | 137 | Assert.Equal("<WixPayloadProperties Package='cscript.exe' Payload='cscript.exe' Container='WixAttachedContainer' Name='cscript.exe' Size='*' />", payloadElements[3].GetTestXml(ignoreAttributesByElementName)); |
| 138 | } | 138 | } |
| 139 | } | 139 | } |
| 140 | 140 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs index ffeda069..ff48ee05 100644 --- a/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs | |||
| @@ -254,6 +254,61 @@ namespace WixToolsetTest.CoreIntegration | |||
| 254 | } | 254 | } |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | [Fact] | ||
| 258 | public void PopulatesBAManifestWithLayoutOnlyPayloads() | ||
| 259 | { | ||
| 260 | var folder = TestData.Get(@"TestData"); | ||
| 261 | |||
| 262 | using (var fs = new DisposableFileSystem()) | ||
| 263 | { | ||
| 264 | var baseFolder = fs.GetFolder(); | ||
| 265 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 266 | var binFolder = Path.Combine(baseFolder, "bin"); | ||
| 267 | var bundlePath = Path.Combine(binFolder, "test.exe"); | ||
| 268 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 269 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 270 | |||
| 271 | this.BuildMsis(folder, intermediateFolder, binFolder); | ||
| 272 | |||
| 273 | var result = WixRunner.Execute(false, new[] | ||
| 274 | { | ||
| 275 | "build", | ||
| 276 | Path.Combine(folder, "Container", "LayoutPayloadInContainer.wxs"), | ||
| 277 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | ||
| 278 | "-bindpath", binFolder, | ||
| 279 | "-intermediateFolder", intermediateFolder, | ||
| 280 | "-o", bundlePath | ||
| 281 | }); | ||
| 282 | |||
| 283 | WixAssert.CompareLineByLine(new string[] | ||
| 284 | { | ||
| 285 | "The layout-only Payload 'SharedPayload' is being added to Container 'FirstX64'. It will not be extracted during layout.", | ||
| 286 | }, result.Messages.Select(m => m.ToString()).ToArray()); | ||
| 287 | result.AssertSuccess(); | ||
| 288 | |||
| 289 | Assert.True(File.Exists(bundlePath)); | ||
| 290 | |||
| 291 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); | ||
| 292 | extractResult.AssertSuccess(); | ||
| 293 | |||
| 294 | var ignoreAttributesByElementName = new Dictionary<string, List<string>> | ||
| 295 | { | ||
| 296 | { "WixPayloadProperties", new List<string> { "Size" } }, | ||
| 297 | }; | ||
| 298 | var payloads = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixPayloadProperties") | ||
| 299 | .Cast<XmlElement>() | ||
| 300 | .Select(e => e.GetTestXml(ignoreAttributesByElementName)) | ||
| 301 | .ToArray(); | ||
| 302 | WixAssert.CompareLineByLine(new string[] | ||
| 303 | { | ||
| 304 | "<WixPayloadProperties Package='FirstX64.msi' Payload='FirstX64.msi' Container='FirstX64' Name='FirstX64.msi' Size='*' />", | ||
| 305 | "<WixPayloadProperties Package='FirstX64.msi' Payload='SharedPayload' Container='FirstX64' Name='LayoutPayloadInContainer.wxs' Size='*' />", | ||
| 306 | "<WixPayloadProperties Package='FirstX64.msi' Payload='fC0n41rZK8oW3JK8LzHu6AT3CjdQ' Container='FirstX64' Name='PFiles\\MsiPackage\\test.txt' Size='*' />", | ||
| 307 | "<WixPayloadProperties Payload='SharedPayload' Container='FirstX64' Name='LayoutPayloadInContainer.wxs' Size='*' />", | ||
| 308 | }, payloads); | ||
| 309 | } | ||
| 310 | } | ||
| 311 | |||
| 257 | private void BuildMsis(string folder, string intermediateFolder, string binFolder) | 312 | private void BuildMsis(string folder, string intermediateFolder, string binFolder) |
| 258 | { | 313 | { |
| 259 | var result = WixRunner.Execute(new[] | 314 | var result = WixRunner.Execute(new[] |
