@joebigelow / wix-1 / commits / 8a957275

Ignore Compressed attribute for payloads when authored into a container

#6406

Sean Hall committed Apr 24, 2021 at 17:00 UTC 8a957275b6a1185f3b74fb31fff258be7f628347
4 files changed +19 -2
src/WixToolset.Core/Link/FlattenAndProcessBundleTablesCommand.cs
+6
@@ -169,6 +169,12 @@ namespace WixToolset.Core.Link
169
170 if (String.IsNullOrEmpty(payloadSymbol.ContainerRef))
171 {
172 + if (payloadSymbol.Compressed == false)
173 + {
174 + this.Messaging.Write(LinkerWarnings.UncompressedPayloadInContainer(payloadSymbol.SourceLineNumbers, groupSymbol.ChildId, containerId));
175 + }
176 +
177 + payloadSymbol.Compressed = true;
178 payloadSymbol.ContainerRef = containerId;
179 }
180 else
src/WixToolset.Core/LinkerWarnings.cs
+6
@@ -16,6 +16,11 @@ namespace WixToolset.Core
16 return Message(sourceLineNumbers, Ids.PayloadInMultipleContainers, "The Payload '{0}' can't be added to Container '{1}' because it was already added to Container '{2}'.", payloadId, containerId1, containerId2);
17 }
18
19 + public static Message UncompressedPayloadInContainer(SourceLineNumber sourceLineNumbers, string payloadId, string containerId)
20 + {
21 + return Message(sourceLineNumbers, Ids.UncompressedPayloadInContainer, "The Payload '{0}' is being added to Container '{1}', overriding its Compressed value of 'no'.", payloadId, containerId);
22 + }
23 +
24 private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args)
25 {
26 return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args);
@@ -25,6 +30,7 @@ namespace WixToolset.Core
30 {
31 LayoutPayloadInContainer = 6900,
32 PayloadInMultipleContainers = 6901,
33 + UncompressedPayloadInContainer = 6902,
34 } // last available is 6999. 7000 is LinkerErrors.
35 }
36 }
src/test/WixToolsetTest.CoreIntegration/PayloadFixture.cs
+6 -1
@@ -157,7 +157,7 @@ namespace WixToolsetTest.CoreIntegration
157 var baFolderPath = Path.Combine(baseFolder, "ba");
158 var extractFolderPath = Path.Combine(baseFolder, "extract");
159
160 - var result = WixRunner.Execute(new[]
160 + var result = WixRunner.Execute(false, new[]
161 {
162 "build",
163 Path.Combine(folder, "Payload", "DownloadUrlPlaceholdersBundle.wxs"),
@@ -170,6 +170,11 @@ namespace WixToolsetTest.CoreIntegration
170
171 result.AssertSuccess();
172
173 + WixAssert.CompareLineByLine(new string[]
174 + {
175 + "The Payload 'burn.exe' is being added to Container 'PackagesContainer', overriding its Compressed value of 'no'.",
176 + }, result.Messages.Select(m => m.ToString()).ToArray());
177 +
178 Assert.True(File.Exists(bundlePath));
179
180 var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
src/test/WixToolsetTest.CoreIntegration/TestData/Payload/DownloadUrlPlaceholdersBundle.wxs
+1 -1
@@ -14,7 +14,7 @@
14 </Bundle>
15 <Fragment>
16 <PackageGroup Id="ContainerPackages">
17 - <ExePackage SourceFile="burn.exe" DetectCondition="none" />
17 + <ExePackage SourceFile="burn.exe" DetectCondition="none" Compressed="no" />
18 </PackageGroup>
19 </Fragment>
20 <Fragment>