aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-04-01 19:28:51 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-04-01 22:06:11 -0500
commit8faa28db427119b3541733290d87783dd699d425 (patch)
tree689b238be084d3ce02685e6ee1765bd50b33f87f
parent39b9a6112c2ff97f31f195749e2142538e47a2eb (diff)
downloadwix-8faa28db427119b3541733290d87783dd699d425.tar.gz
wix-8faa28db427119b3541733290d87783dd699d425.tar.bz2
wix-8faa28db427119b3541733290d87783dd699d425.zip
Support v3 bundles in BundlePackage and "burn extract" command.
-rw-r--r--src/test/burn/TestData/BundlePackageTests/V3BundlePackageBundle/V3BundlePackageBundle.wixproj22
-rw-r--r--src/test/burn/TestData/BundlePackageTests/V3BundlePackageBundle/V3BundlePackageBundle.wxs10
-rw-r--r--src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs12
-rw-r--r--src/wix/WixToolset.Core.Burn/Bundles/BurnCommon.cs21
-rw-r--r--src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs2
-rw-r--r--src/wix/WixToolset.Core.Burn/Bundles/ProcessBundlePackageCommand.cs116
-rw-r--r--src/wix/WixToolset.Core.Burn/BurnBackendErrors.cs6
-rw-r--r--src/wix/WixToolset.Core.Burn/BurnBackendWarnings.cs12
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/BundlePackageFixture.cs87
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/TestData/.Data/v3bundle.exebin0 -> 648397 bytes
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundlePackage/V3BundlePackage.wxs10
11 files changed, 257 insertions, 41 deletions
diff --git a/src/test/burn/TestData/BundlePackageTests/V3BundlePackageBundle/V3BundlePackageBundle.wixproj b/src/test/burn/TestData/BundlePackageTests/V3BundlePackageBundle/V3BundlePackageBundle.wixproj
new file mode 100644
index 00000000..d57ac072
--- /dev/null
+++ b/src/test/burn/TestData/BundlePackageTests/V3BundlePackageBundle/V3BundlePackageBundle.wixproj
@@ -0,0 +1,22 @@
1<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2<Project Sdk="WixToolset.Sdk">
3 <PropertyGroup>
4 <OutputType>Bundle</OutputType>
5 <BA>TestBA_x64</BA>
6 <UpgradeCode>{B6CAE45D-A7E5-4302-9FCF-4D05632F9FD7}</UpgradeCode>
7 <InstallerPlatform>x64</InstallerPlatform>
8 </PropertyGroup>
9 <ItemGroup>
10 <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" />
11 </ItemGroup>
12 <ItemGroup>
13 <BindInputPaths Include="..\..\..\..\..\wix\test\WixToolsetTest.CoreIntegration\TestData\.Data" />
14 </ItemGroup>
15 <ItemGroup>
16 <ProjectReference Include="..\..\TestBA\TestBAWixlib_x64\testbawixlib_x64.wixproj" />
17 </ItemGroup>
18 <ItemGroup>
19 <PackageReference Include="WixToolset.Bal.wixext" />
20 <PackageReference Include="WixToolset.NetFx.wixext" />
21 </ItemGroup>
22</Project> \ No newline at end of file
diff --git a/src/test/burn/TestData/BundlePackageTests/V3BundlePackageBundle/V3BundlePackageBundle.wxs b/src/test/burn/TestData/BundlePackageTests/V3BundlePackageBundle/V3BundlePackageBundle.wxs
new file mode 100644
index 00000000..131a1b4d
--- /dev/null
+++ b/src/test/burn/TestData/BundlePackageTests/V3BundlePackageBundle/V3BundlePackageBundle.wxs
@@ -0,0 +1,10 @@
1<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2
3
4<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
5 <Fragment>
6 <PackageGroup Id="BundlePackages">
7 <BundlePackage SourceFile="v3bundle.exe" />
8 </PackageGroup>
9 </Fragment>
10</Wix>
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs
index 1e6cda9c..4686875a 100644
--- a/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs
+++ b/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs
@@ -3,6 +3,7 @@
3namespace WixToolsetTest.BurnE2E 3namespace WixToolsetTest.BurnE2E
4{ 4{
5 using System.IO; 5 using System.IO;
6 using WixTestTools;
6 using Xunit; 7 using Xunit;
7 using Xunit.Abstractions; 8 using Xunit.Abstractions;
8 9
@@ -64,6 +65,17 @@ namespace WixToolsetTest.BurnE2E
64 } 65 }
65 66
66 [Fact] 67 [Fact]
68 public void CanInstallV3BundlePackage()
69 {
70 var v3BundlePackageBundle = this.CreateBundleInstaller("V3BundlePackageBundle");
71
72 var logPath = v3BundlePackageBundle.Install();
73 v3BundlePackageBundle.VerifyRegisteredAndInPackageCache();
74
75 Assert.True(LogVerifier.MessageInLogFile(logPath, "Applied execute package: v3bundle.exe, result: 0x0, restart: None"));
76 }
77
78 [Fact]
67 public void CanSkipObsoleteBundlePackage() 79 public void CanSkipObsoleteBundlePackage()
68 { 80 {
69 var bundleAv1 = this.CreateBundleInstaller(@"..\UpgradeRelatedBundleTests\BundleAv1"); 81 var bundleAv1 = this.CreateBundleInstaller(@"..\UpgradeRelatedBundleTests\BundleAv1");
diff --git a/src/wix/WixToolset.Core.Burn/Bundles/BurnCommon.cs b/src/wix/WixToolset.Core.Burn/Bundles/BurnCommon.cs
index 7b34f4ae..25c22361 100644
--- a/src/wix/WixToolset.Core.Burn/Bundles/BurnCommon.cs
+++ b/src/wix/WixToolset.Core.Burn/Bundles/BurnCommon.cs
@@ -58,11 +58,32 @@ namespace WixToolset.Core.Burn.Bundles
58 protected const uint IMAGE_NT_SIGNATURE = 0x00004550; 58 protected const uint IMAGE_NT_SIGNATURE = 0x00004550;
59 protected const ulong IMAGE_SECTION_WIXBURN_NAME = 0x6E7275627869772E; // ".wixburn", as a qword. 59 protected const ulong IMAGE_SECTION_WIXBURN_NAME = 0x6E7275627869772E; // ".wixburn", as a qword.
60 60
61 public const ushort IMAGE_FILE_MACHINE_AM33 = 0x1D3;
61 public const ushort IMAGE_FILE_MACHINE_AMD64 = 0x8664; 62 public const ushort IMAGE_FILE_MACHINE_AMD64 = 0x8664;
62 public const ushort IMAGE_FILE_MACHINE_ARM = 0x1C0; 63 public const ushort IMAGE_FILE_MACHINE_ARM = 0x1C0;
63 public const ushort IMAGE_FILE_MACHINE_ARM64 = 0xAA64; 64 public const ushort IMAGE_FILE_MACHINE_ARM64 = 0xAA64;
64 public const ushort IMAGE_FILE_MACHINE_ARMNT = 0x1C4; 65 public const ushort IMAGE_FILE_MACHINE_ARMNT = 0x1C4;
66 public const ushort IMAGE_FILE_MACHINE_EBC = 0xEBC;
65 public const ushort IMAGE_FILE_MACHINE_I386 = 0x14C; 67 public const ushort IMAGE_FILE_MACHINE_I386 = 0x14C;
68 public const ushort IMAGE_FILE_MACHINE_IA64 = 0x200;
69 public const ushort IMAGE_FILE_MACHINE_LOONGARCH32 = 0x6232;
70 public const ushort IMAGE_FILE_MACHINE_LOONGARCH64 = 0x6264;
71 public const ushort IMAGE_FILE_MACHINE_M32R = 0x9041;
72 public const ushort IMAGE_FILE_MACHINE_MIPS16 = 0x266;
73 public const ushort IMAGE_FILE_MACHINE_MIPSFPU = 0x366;
74 public const ushort IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466;
75 public const ushort IMAGE_FILE_MACHINE_POWERPC = 0x1F0;
76 public const ushort IMAGE_FILE_MACHINE_POWERPCFP = 0x1F1;
77 public const ushort IMAGE_FILE_MACHINE_R4000 = 0x166;
78 public const ushort IMAGE_FILE_MACHINE_RISCV32 = 0x5032;
79 public const ushort IMAGE_FILE_MACHINE_RISCV64 = 0x5064;
80 public const ushort IMAGE_FILE_MACHINE_RISCV128 = 0x5128;
81 public const ushort IMAGE_FILE_MACHINE_SH3 = 0x1A2;
82 public const ushort IMAGE_FILE_MACHINE_SH3DSP = 0x1A3;
83 public const ushort IMAGE_FILE_MACHINE_SH4 = 0x1A6;
84 public const ushort IMAGE_FILE_MACHINE_SH5 = 0x1A8;
85 public const ushort IMAGE_FILE_MACHINE_THUMB = 0x1C2;
86 public const ushort IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169;
66 87
67 // The ".wixburn" section contains: 88 // The ".wixburn" section contains:
68 // 0- 3: magic number 89 // 0- 3: magic number
diff --git a/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs b/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs
index ac6a2b8f..e3d0f0af 100644
--- a/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs
+++ b/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs
@@ -102,7 +102,7 @@ namespace WixToolset.Core.Burn.Bundles
102 var document = new XmlDocument(); 102 var document = new XmlDocument();
103 document.Load(manifestPath); 103 document.Load(manifestPath);
104 var namespaceManager = new XmlNamespaceManager(document.NameTable); 104 var namespaceManager = new XmlNamespaceManager(document.NameTable);
105 namespaceManager.AddNamespace("burn", BurnCommon.BurnNamespace); 105 namespaceManager.AddNamespace("burn", document.DocumentElement.NamespaceURI);
106 var uxPayloads = document.SelectNodes("/burn:BurnManifest/burn:UX/burn:Payload", namespaceManager); 106 var uxPayloads = document.SelectNodes("/burn:BurnManifest/burn:UX/burn:Payload", namespaceManager);
107 var payloads = document.SelectNodes("/burn:BurnManifest/burn:Payload", namespaceManager); 107 var payloads = document.SelectNodes("/burn:BurnManifest/burn:Payload", namespaceManager);
108 108
diff --git a/src/wix/WixToolset.Core.Burn/Bundles/ProcessBundlePackageCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/ProcessBundlePackageCommand.cs
index e8c68faa..ff4a74a7 100644
--- a/src/wix/WixToolset.Core.Burn/Bundles/ProcessBundlePackageCommand.cs
+++ b/src/wix/WixToolset.Core.Burn/Bundles/ProcessBundlePackageCommand.cs
@@ -71,16 +71,37 @@ namespace WixToolset.Core.Burn.Bundles
71 71
72 switch (burnReader.MachineType) 72 switch (burnReader.MachineType)
73 { 73 {
74 case BurnCommon.IMAGE_FILE_MACHINE_AM33:
74 case BurnCommon.IMAGE_FILE_MACHINE_ARM: 75 case BurnCommon.IMAGE_FILE_MACHINE_ARM:
75 case BurnCommon.IMAGE_FILE_MACHINE_ARMNT: 76 case BurnCommon.IMAGE_FILE_MACHINE_ARMNT:
76 case BurnCommon.IMAGE_FILE_MACHINE_I386: 77 case BurnCommon.IMAGE_FILE_MACHINE_I386:
78 case BurnCommon.IMAGE_FILE_MACHINE_LOONGARCH32:
79 case BurnCommon.IMAGE_FILE_MACHINE_M32R:
77 break; 80 break;
78 case BurnCommon.IMAGE_FILE_MACHINE_AMD64: 81 case BurnCommon.IMAGE_FILE_MACHINE_AMD64:
79 case BurnCommon.IMAGE_FILE_MACHINE_ARM64: 82 case BurnCommon.IMAGE_FILE_MACHINE_ARM64:
83 case BurnCommon.IMAGE_FILE_MACHINE_IA64:
84 case BurnCommon.IMAGE_FILE_MACHINE_LOONGARCH64:
80 bundlePackage.Win64 = true; 85 bundlePackage.Win64 = true;
81 break; 86 break;
87 case BurnCommon.IMAGE_FILE_MACHINE_EBC:
88 case BurnCommon.IMAGE_FILE_MACHINE_MIPS16:
89 case BurnCommon.IMAGE_FILE_MACHINE_MIPSFPU:
90 case BurnCommon.IMAGE_FILE_MACHINE_MIPSFPU16:
91 case BurnCommon.IMAGE_FILE_MACHINE_POWERPC:
92 case BurnCommon.IMAGE_FILE_MACHINE_POWERPCFP:
93 case BurnCommon.IMAGE_FILE_MACHINE_R4000:
94 case BurnCommon.IMAGE_FILE_MACHINE_RISCV32:
95 case BurnCommon.IMAGE_FILE_MACHINE_RISCV64:
96 case BurnCommon.IMAGE_FILE_MACHINE_RISCV128:
97 case BurnCommon.IMAGE_FILE_MACHINE_SH3:
98 case BurnCommon.IMAGE_FILE_MACHINE_SH3DSP:
99 case BurnCommon.IMAGE_FILE_MACHINE_SH4:
100 case BurnCommon.IMAGE_FILE_MACHINE_SH5:
101 case BurnCommon.IMAGE_FILE_MACHINE_THUMB:
102 case BurnCommon.IMAGE_FILE_MACHINE_WCEMIPSV2:
82 default: 103 default:
83 Debug.Assert(false, "Unknown machine type"); 104 this.Messaging.Write(BurnBackendWarnings.UnknownCoffMachineType(packagePayload.SourceLineNumbers, sourcePath, burnReader.MachineType));
84 break; 105 break;
85 } 106 }
86 107
@@ -90,46 +111,60 @@ namespace WixToolset.Core.Burn.Bundles
90 // This should be a safe assumption since we will need to add the protocol version to the section to support this harvesting. 111 // This should be a safe assumption since we will need to add the protocol version to the section to support this harvesting.
91 bundlePackage.SupportsBurnProtocol = burnReader.Version == 2; 112 bundlePackage.SupportsBurnProtocol = burnReader.Version == 2;
92 113
93 var document = new XmlDocument(); 114 try
94 document.Load(Path.Combine(baFolderPath, "manifest.xml"));
95 var namespaceManager = new XmlNamespaceManager(document.NameTable);
96 namespaceManager.AddNamespace("burn", BurnCommon.BurnNamespace); // TODO: support v3 bundles
97 var registrationElement = document.SelectSingleNode("/burn:BurnManifest/burn:Registration", namespaceManager) as XmlElement;
98 var arpElement = document.SelectSingleNode("/burn:BurnManifest/burn:Registration/burn:Arp", namespaceManager) as XmlElement;
99
100 var perMachine = registrationElement.GetAttribute("PerMachine") == "yes";
101 this.Facade.PackageSymbol.PerMachine = perMachine ? YesNoDefaultType.Yes : YesNoDefaultType.No;
102
103 var version = registrationElement.GetAttribute("Version");
104 packagePayload.Version = version;
105 bundlePackage.Version = version;
106 this.Facade.PackageSymbol.Version = version;
107
108 if (String.IsNullOrEmpty(this.Facade.PackageSymbol.CacheId))
109 { 115 {
110 this.Facade.PackageSymbol.CacheId = String.Format("{0}v{1}", bundlePackage.BundleId, version); 116 var document = new XmlDocument();
117 document.Load(Path.Combine(baFolderPath, "manifest.xml"));
118 var namespaceManager = new XmlNamespaceManager(document.NameTable);
119
120 if (document.DocumentElement.LocalName != "BurnManifest")
121 {
122 this.Messaging.Write(BurnBackendErrors.InvalidBundleManifest(packagePayload.SourceLineNumbers, sourcePath, $"Expected root element to be 'Manifest' but was '{document.DocumentElement.LocalName}'."));
123 return;
124 }
125
126 namespaceManager.AddNamespace("burn", document.DocumentElement.NamespaceURI);
127 var registrationElement = document.SelectSingleNode("/burn:BurnManifest/burn:Registration", namespaceManager) as XmlElement;
128 var arpElement = document.SelectSingleNode("/burn:BurnManifest/burn:Registration/burn:Arp", namespaceManager) as XmlElement;
129
130 var perMachine = registrationElement.GetAttribute("PerMachine") == "yes";
131 this.Facade.PackageSymbol.PerMachine = perMachine ? YesNoDefaultType.Yes : YesNoDefaultType.No;
132
133 var version = registrationElement.GetAttribute("Version");
134 packagePayload.Version = version;
135 bundlePackage.Version = version;
136 this.Facade.PackageSymbol.Version = version;
137
138 if (String.IsNullOrEmpty(this.Facade.PackageSymbol.CacheId))
139 {
140 this.Facade.PackageSymbol.CacheId = String.Format("{0}v{1}", bundlePackage.BundleId, version);
141 }
142
143 var providerKey = registrationElement.GetAttribute("ProviderKey");
144 var depId = new Identifier(AccessModifier.Section, this.BackendHelper.GenerateIdentifier("dep", bundlePackage.Id.Id, providerKey));
145 this.Section.AddSymbol(new WixDependencyProviderSymbol(packagePayload.SourceLineNumbers, depId)
146 {
147 ParentRef = bundlePackage.Id.Id,
148 ProviderKey = providerKey,
149 Version = version,
150 Attributes = WixDependencyProviderAttributes.ProvidesAttributesImported,
151 });
152
153 if (String.IsNullOrEmpty(this.Facade.PackageSymbol.DisplayName))
154 {
155 this.Facade.PackageSymbol.DisplayName = arpElement.GetAttribute("DisplayName");
156 }
157
158 this.ProcessPackages(document, namespaceManager);
159
160 this.ProcessRelatedBundles(document, namespaceManager, packagePayload, sourcePath);
161
162 // TODO: Add payloads?
111 } 163 }
112 164 catch (Exception e)
113 var providerKey = registrationElement.GetAttribute("ProviderKey");
114 var depId = new Identifier(AccessModifier.Section, this.BackendHelper.GenerateIdentifier("dep", bundlePackage.Id.Id, providerKey));
115 this.Section.AddSymbol(new WixDependencyProviderSymbol(packagePayload.SourceLineNumbers, depId)
116 {
117 ParentRef = bundlePackage.Id.Id,
118 ProviderKey = providerKey,
119 Version = version,
120 Attributes = WixDependencyProviderAttributes.ProvidesAttributesImported,
121 });
122
123 if (String.IsNullOrEmpty(this.Facade.PackageSymbol.DisplayName))
124 { 165 {
125 this.Facade.PackageSymbol.DisplayName = arpElement.GetAttribute("DisplayName"); 166 this.Messaging.Write(BurnBackendErrors.InvalidBundleManifest(packagePayload.SourceLineNumbers, sourcePath, e.ToString()));
126 } 167 }
127
128 this.ProcessPackages(document, namespaceManager);
129
130 this.ProcessRelatedBundles(document, namespaceManager);
131
132 // TODO: Add payloads?
133 } 168 }
134 } 169 }
135 170
@@ -153,15 +188,16 @@ namespace WixToolset.Core.Burn.Bundles
153 this.Facade.PackageSymbol.InstallSize = packageInstallSize; 188 this.Facade.PackageSymbol.InstallSize = packageInstallSize;
154 } 189 }
155 190
156 private void ProcessRelatedBundles(XmlDocument document, XmlNamespaceManager namespaceManager) 191 private void ProcessRelatedBundles(XmlDocument document, XmlNamespaceManager namespaceManager, WixBundlePayloadSymbol packagePayload, string sourcePath)
157 { 192 {
158 foreach (XmlElement relatedBundleElement in document.SelectNodes("/burn:BurnManifest/burn:RelatedBundle", namespaceManager)) 193 foreach (XmlElement relatedBundleElement in document.SelectNodes("/burn:BurnManifest/burn:RelatedBundle", namespaceManager))
159 { 194 {
160 var id = relatedBundleElement.GetAttribute("Id"); 195 var id = relatedBundleElement.GetAttribute("Id");
196 var actionValue = relatedBundleElement.GetAttribute("Action");
161 197
162 if (!Enum.TryParse(relatedBundleElement.GetAttribute("Action"), out RelatedBundleActionType action)) 198 if (!Enum.TryParse(actionValue, out RelatedBundleActionType action))
163 { 199 {
164 // TODO: warning 200 this.Messaging.Write(BurnBackendWarnings.UnknownBundleRelationAction(packagePayload.SourceLineNumbers, sourcePath, actionValue));
165 continue; 201 continue;
166 } 202 }
167 203
diff --git a/src/wix/WixToolset.Core.Burn/BurnBackendErrors.cs b/src/wix/WixToolset.Core.Burn/BurnBackendErrors.cs
index a710333e..bf07fad2 100644
--- a/src/wix/WixToolset.Core.Burn/BurnBackendErrors.cs
+++ b/src/wix/WixToolset.Core.Burn/BurnBackendErrors.cs
@@ -85,6 +85,11 @@ namespace WixToolset.Core.Burn
85 return Message(null, Ids.UnsupportedRemotePackagePayload, "The first remote payload must be a supported package type of .exe or .msu. Use the -packageType switch to override the inferred extension: {0} from file: {1}", extension, path); 85 return Message(null, Ids.UnsupportedRemotePackagePayload, "The first remote payload must be a supported package type of .exe or .msu. Use the -packageType switch to override the inferred extension: {0} from file: {1}", extension, path);
86 } 86 }
87 87
88 public static Message InvalidBundleManifest(SourceLineNumber sourceLineNumbers, string bundleExecutable, string reason)
89 {
90 return Message(sourceLineNumbers, Ids.InvalidBundleManifest, "Unable to harvest bundle executable '{0}'. The manifest was invalid. {1}", bundleExecutable, reason);
91 }
92
88 private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) 93 private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args)
89 { 94 {
90 return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); 95 return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args);
@@ -104,6 +109,7 @@ namespace WixToolset.Core.Burn
104 IncompatibleWixBurnSection = 8009, 109 IncompatibleWixBurnSection = 8009,
105 UnsupportedRemotePackagePayload = 8010, 110 UnsupportedRemotePackagePayload = 8010,
106 FailedToAddIconOrSplashScreenToBundle = 8011, 111 FailedToAddIconOrSplashScreenToBundle = 8011,
112 InvalidBundleManifest = 8012,
107 } // last available is 8499. 8500 is BurnBackendWarnings. 113 } // last available is 8499. 8500 is BurnBackendWarnings.
108 } 114 }
109} 115}
diff --git a/src/wix/WixToolset.Core.Burn/BurnBackendWarnings.cs b/src/wix/WixToolset.Core.Burn/BurnBackendWarnings.cs
index 033b755a..6d45ff84 100644
--- a/src/wix/WixToolset.Core.Burn/BurnBackendWarnings.cs
+++ b/src/wix/WixToolset.Core.Burn/BurnBackendWarnings.cs
@@ -26,6 +26,16 @@ namespace WixToolset.Core.Burn
26 return Message(sourceLineNumbers, Ids.FailedToExtractAttachedContainers, "Failed to extract attached container. This most often happens when extracting a stripped bundle from the package cache, which is not supported."); 26 return Message(sourceLineNumbers, Ids.FailedToExtractAttachedContainers, "Failed to extract attached container. This most often happens when extracting a stripped bundle from the package cache, which is not supported.");
27 } 27 }
28 28
29 public static Message UnknownCoffMachineType(SourceLineNumber sourceLineNumbers, string bundleExecutable, ushort machineType)
30 {
31 return Message(sourceLineNumbers, Ids.UnknownCoffMachineType, "The bundle '{0}' has an unknown COFF machine type: {1}. It is assumed to be 32-bit.", bundleExecutable, machineType);
32 }
33
34 public static Message UnknownBundleRelationAction(SourceLineNumber sourceLineNumbers, string bundleExecutable, string action)
35 {
36 return Message(sourceLineNumbers, Ids.UnknownBundleRelationAction, "The manifest for the bundle '{0}' contains an unknown related bundle action '{1}'. It will be ignored.", bundleExecutable, action);
37 }
38
29 private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) 39 private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args)
30 { 40 {
31 return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args); 41 return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args);
@@ -37,6 +47,8 @@ namespace WixToolset.Core.Burn
37 AttachedContainerPayloadCollision2 = 8501, 47 AttachedContainerPayloadCollision2 = 8501,
38 EmptyContainer = 8502, 48 EmptyContainer = 8502,
39 FailedToExtractAttachedContainers = 8503, 49 FailedToExtractAttachedContainers = 8503,
50 UnknownCoffMachineType = 8504,
51 UnknownBundleRelationAction = 8505,
40 } // last available is 8999. 9000 is VerboseMessages. 52 } // last available is 8999. 9000 is VerboseMessages.
41 } 53 }
42} 54}
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/BundlePackageFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/BundlePackageFixture.cs
index 6ccddbb7..5f30760e 100644
--- a/src/wix/test/WixToolsetTest.CoreIntegration/BundlePackageFixture.cs
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/BundlePackageFixture.cs
@@ -127,5 +127,92 @@ namespace WixToolsetTest.CoreIntegration
127 }, packageElements); 127 }, packageElements);
128 } 128 }
129 } 129 }
130
131 [Fact]
132 public void CanBuildBundleWithV3BundlePackage()
133 {
134 var folder = TestData.Get(@"TestData");
135
136 using (var fs = new DisposableFileSystem())
137 {
138 var baseFolder = fs.GetFolder();
139 var parentIntermediateFolder = Path.Combine(baseFolder, "obj", "Parent");
140 var binFolder = Path.Combine(baseFolder, "bin");
141 var parentBundlePath = Path.Combine(binFolder, "parent.exe");
142 var parentPdbPath = Path.Combine(binFolder, "parent.wixpdb");
143 var baFolderPath = Path.Combine(baseFolder, "ba");
144 var extractFolderPath = Path.Combine(baseFolder, "extract");
145 string chainBundleId = "{215A70DB-AB35-48C7-BE51-D66EAAC87177}";
146
147 var result = WixRunner.Execute(new[]
148 {
149 "build",
150 Path.Combine(folder, "BundlePackage", "V3BundlePackage.wxs"),
151 "-bindpath", Path.Combine(folder, ".Data"),
152 "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
153 "-intermediateFolder", parentIntermediateFolder,
154 "-o", parentBundlePath,
155 });
156
157 result.AssertSuccess();
158
159 Assert.True(File.Exists(parentBundlePath));
160
161 string parentBundleId;
162 using (var wixOutput = WixOutput.Read(parentPdbPath))
163 {
164
165 var intermediate = Intermediate.Load(wixOutput);
166 var section = intermediate.Sections.Single();
167
168 var bundleSymbol = section.Symbols.OfType<WixBundleSymbol>().Single();
169 parentBundleId = bundleSymbol.BundleId;
170 }
171
172 var extractResult = BundleExtractor.ExtractBAContainer(null, parentBundlePath, baFolderPath, extractFolderPath);
173 extractResult.AssertSuccess();
174
175 var ignoreAttributesByElementName = new Dictionary<string, List<string>>
176 {
177 { "BundlePackage", new List<string> { "Size" } },
178 };
179 var bundlePackages = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Chain/burn:BundlePackage")
180 .Cast<XmlElement>()
181 .Select(e => e.GetTestXml(ignoreAttributesByElementName))
182 .ToArray();
183 WixAssert.CompareLineByLine(new string[]
184 {
185 $"<BundlePackage Id='v3bundle.exe' Cache='keep' CacheId='{chainBundleId}v1.0.0.0' InstallSize='1135' Size='*' PerMachine='yes' Permanent='no' Vital='yes' RollbackBoundaryForward='WixDefaultBoundary' RollbackBoundaryBackward='WixDefaultBoundary' LogPathVariable='WixBundleLog_v3bundle.exe' RollbackLogPathVariable='WixBundleRollbackLog_v3bundle.exe' BundleId='{chainBundleId}' Version='1.0.0.0' InstallArguments='' UninstallArguments='' RepairArguments='' SupportsBurnProtocol='yes' Win64='no'>" +
186 "<Provides Key='{215a70db-ab35-48c7-be51-d66eaac87177}' Version='1.0.0.0' DisplayName='CustomV3Theme' Imported='yes' />" +
187 "<RelatedBundle Id='{2BF4C01F-C132-4E70-97AB-2BC68C7CCD10}' Action='Upgrade' />" +
188 "<PayloadRef Id='v3bundle.exe' />" +
189 "</BundlePackage>",
190 }, bundlePackages);
191
192 var registrations = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Registration")
193 .Cast<XmlElement>()
194 .Select(e => e.GetTestXml())
195 .ToArray();
196 WixAssert.CompareLineByLine(new string[]
197 {
198 $"<Registration Id='{parentBundleId}' ExecutableName='parent.exe' PerMachine='yes' Tag='' Version='1.1.1.1' ProviderKey='{parentBundleId}'>" +
199 "<Arp Register='yes' DisplayName='V3BundlePackageBundle' DisplayVersion='1.1.1.1' Publisher='Example Corporation' />" +
200 "</Registration>"
201 }, registrations);
202
203 ignoreAttributesByElementName = new Dictionary<string, List<string>>
204 {
205 { "WixPackageProperties", new List<string> { "DownloadSize", "PackageSize" } },
206 };
207 var packageElements = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixPackageProperties")
208 .Cast<XmlElement>()
209 .Select(e => e.GetTestXml(ignoreAttributesByElementName))
210 .ToArray();
211 WixAssert.CompareLineByLine(new string[]
212 {
213 "<WixPackageProperties Package='v3bundle.exe' Vital='yes' DisplayName='CustomV3Theme' Description='CustomV3Theme' DownloadSize='*' PackageSize='*' InstalledSize='1135' PackageType='Bundle' Permanent='no' LogPathVariable='WixBundleLog_v3bundle.exe' RollbackLogPathVariable='WixBundleRollbackLog_v3bundle.exe' Compressed='yes' Version='1.0.0.0' Cache='keep' />",
214 }, packageElements);
215 }
216 }
130 } 217 }
131} 218}
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/.Data/v3bundle.exe b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/.Data/v3bundle.exe
new file mode 100644
index 00000000..13f3e3d9
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/.Data/v3bundle.exe
Binary files differ
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundlePackage/V3BundlePackage.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundlePackage/V3BundlePackage.wxs
new file mode 100644
index 00000000..192bb6d7
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundlePackage/V3BundlePackage.wxs
@@ -0,0 +1,10 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Bundle Name="V3BundlePackageBundle" Version="1.1.1.1" Manufacturer="Example Corporation" UpgradeCode="{01369E89-159B-4622-8B91-70F51DEBCFE5}">
3 <BootstrapperApplication>
4 <BootstrapperApplicationDll SourceFile="fakeba.dll" />
5 </BootstrapperApplication>
6 <Chain>
7 <BundlePackage SourceFile="v3bundle.exe" />
8 </Chain>
9 </Bundle>
10</Wix>