Ensure external bundle payloads and containers are copied to output
Rob Mensching committed
Jan 2, 2022 at 13:13 UTC
045eecc36260bfd9d184aedd4a6dc2ec0c5e9b1d
6 files changed
+63
-13
src/test/burn/TestData/LayoutTests/BundleA/BundleA.wixproj
-8
@@ -12,12 +12,4 @@
12
<PackageReference Include="WixToolset.Bal.wixext" />
13
<PackageReference Include="WixToolset.NetFx.wixext" />
14
</ItemGroup>
15
- <!-- Workaround wix.targets brokenness -->
16
- <Target Name="CopyUncompressedFiles" AfterTargets="AfterBuild">
17
- <ItemGroup>
18
- <UncompressedFiles Include="$(IntermediateOutputPath)\BundleA.wxs" />
19
- <UncompressedFiles Include="$(IntermediateOutputPath)\packages.cab" />
20
- </ItemGroup>
21
- <Copy SourceFiles="@(UncompressedFiles)" DestinationFolder="$(OutputPath)" />
22
- </Target>
15
</Project>
\ No newline at end of file
src/wix/WixToolset.Core.Burn/Bundles/CreateNonUXContainers.cs
+4
-1
@@ -104,8 +104,11 @@ namespace WixToolset.Core.Burn.Bundles
104
// Add detached containers to the list of file transfers.
105
if (ContainerType.Detached == container.Type)
106
{
107
- var transfer = this.BackendHelper.CreateFileTransfer(container.WorkingPath, Path.Combine(this.LayoutFolder, container.Name), true, container.SourceLineNumbers);
107
+ var outputPath = Path.Combine(this.LayoutFolder, container.Name);
108
+ var transfer = this.BackendHelper.CreateFileTransfer(container.WorkingPath, outputPath, true, container.SourceLineNumbers);
109
fileTransfers.Add(transfer);
110
+
111
+ trackedFiles.Add(this.BackendHelper.TrackFile(outputPath, TrackedFileType.BuiltOutput, container.SourceLineNumbers));
112
}
113
else // update the attached container index.
114
{
src/wix/WixToolset.Core.Burn/Bundles/ProcessPayloadsCommand.cs
+5
-1
@@ -77,8 +77,12 @@ namespace WixToolset.Core.Burn.Bundles
77
// External payloads need to be transfered.
78
if (PackagingType.External == payload.Packaging)
79
{
80
- var transfer = this.BackendHelper.CreateFileTransfer(sourceFile.Path, Path.Combine(this.LayoutDirectory, payload.Name), false, payload.SourceLineNumbers);
80
+ var outputPath = Path.Combine(this.LayoutDirectory, payload.Name);
81
+
82
+ var transfer = this.BackendHelper.CreateFileTransfer(sourceFile.Path, outputPath, false, payload.SourceLineNumbers);
83
fileTransfers.Add(transfer);
84
+
85
+ trackedFiles.Add(this.BackendHelper.TrackFile(outputPath, TrackedFileType.CopiedOutput, payload.SourceLineNumbers));
86
}
87
88
if (payload.ContentFile)
src/wix/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
+40
@@ -291,6 +291,46 @@ namespace WixToolsetTest.CoreIntegration
291
}
292
}
293
294
+ [Fact]
295
+ public void CanBuildUncompressedBundle()
296
+ {
297
+ var folder = TestData.Get(@"TestData") + Path.DirectorySeparatorChar;
298
+
299
+ using (var fs = new DisposableFileSystem())
300
+ {
301
+ var baseFolder = fs.GetFolder() + Path.DirectorySeparatorChar;
302
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
303
+ var exePath = Path.Combine(baseFolder, @"bin\test.exe");
304
+ var trackingFile = Path.Combine(intermediateFolder, "trackingFile.txt");
305
+
306
+ var result = WixRunner.Execute(new[]
307
+ {
308
+ "build",
309
+ Path.Combine(folder, "BundleUncompressed", "UncompressedBundle.wxs"),
310
+ "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
311
+ "-bindpath", Path.Combine(folder, ".Data"),
312
+ "-intermediateFolder", intermediateFolder,
313
+ "-o", exePath,
314
+ "-trackingFile", trackingFile
315
+ });
316
+
317
+ result.AssertSuccess();
318
+
319
+ Assert.True(File.Exists(exePath));
320
+ Assert.True(File.Exists(Path.Combine(Path.GetDirectoryName(exePath), "test.txt")));
321
+
322
+ var trackedLines = File.ReadAllLines(trackingFile).Select(s => s.Replace(baseFolder, null, StringComparison.OrdinalIgnoreCase).Replace(folder, null, StringComparison.OrdinalIgnoreCase)).ToArray();
323
+ WixAssert.CompareLineByLine(new[]
324
+ {
325
+ "BuiltOutput\tbin\\test.exe",
326
+ "BuiltOutput\tbin\\test.wixpdb",
327
+ "CopiedOutput\tbin\\test.txt",
328
+ "Input\tSimpleBundle\\data\\fakeba.dll",
329
+ "Input\tSimpleBundle\\data\\MsiPackage\\test.txt"
330
+ }, trackedLines);
331
+ }
332
+ }
333
+
334
[Fact]
335
public void CantBuildWithDuplicateCacheIds()
336
{
src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleUncompressed/UncompressedBundle.wxs
new
+11
@@ -0,0 +1,11 @@
1
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2
+ <Bundle Name="BurnBundle" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="B94478B1-E1F3-4700-9CE8-6AA090854AEC" Compressed="no">
3
+ <BootstrapperApplication>
4
+ <BootstrapperApplicationDll SourceFile="fakeba.dll" />
5
+ </BootstrapperApplication>
6
+
7
+ <Chain>
8
+ <ExePackage Permanent="yes" DetectCondition="none" SourceFile="MsiPackage\test.txt" />
9
+ </Chain>
10
+ </Bundle>
11
+</Wix>
src/wix/test/WixToolsetTest.Sdk/MsbuildFixture.cs
+3
-3
@@ -44,7 +44,7 @@ namespace WixToolsetTest.Sdk
44
}
45
}
46
47
- [Theory(Skip = "https://github.com/wixtoolset/issues/issues/6407")]
47
+ [Theory]
48
[InlineData(BuildSystem.DotNetCoreSdk)]
49
[InlineData(BuildSystem.MSBuild)]
50
[InlineData(BuildSystem.MSBuild64)]
@@ -71,9 +71,9 @@ namespace WixToolsetTest.Sdk
71
.ToArray();
72
WixAssert.CompareLineByLine(new[]
73
{
74
- @"bin\x86\Release\SimpleBundle.exe",
75
- @"bin\x86\Release\SimpleBundle.wixpdb",
74
@"bin\x86\Release\test.txt",
75
+ @"bin\x86\Release\UncompressedBundle.exe",
76
+ @"bin\x86\Release\UncompressedBundle.wixpdb",
77
}, paths);
78
}
79
}