aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-04-23 12:11:30 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-04-23 12:43:38 +1000
commit05edba00dc08b74a6d9b32b4e56f4da6ef90c638 (patch)
tree734cf99cfc7e8f105365981169d7882a4400070d /src
parentd686f0d92fc14940441dbf53c28547a975572f92 (diff)
downloadwix-05edba00dc08b74a6d9b32b4e56f4da6ef90c638.tar.gz
wix-05edba00dc08b74a6d9b32b4e56f4da6ef90c638.tar.bz2
wix-05edba00dc08b74a6d9b32b4e56f4da6ef90c638.zip
Update BalBurnBackendExtension to use BundleFinalize.
Diffstat (limited to 'src')
-rw-r--r--src/test/WixToolsetTest.Bal/BalExtensionFixture.cs28
-rw-r--r--src/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs10
-rw-r--r--src/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs5
-rw-r--r--src/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj6
-rw-r--r--src/wixext/BalBurnBackendExtension.cs13
5 files changed, 48 insertions, 14 deletions
diff --git a/src/test/WixToolsetTest.Bal/BalExtensionFixture.cs b/src/test/WixToolsetTest.Bal/BalExtensionFixture.cs
index d93ed74a..97ac68a7 100644
--- a/src/test/WixToolsetTest.Bal/BalExtensionFixture.cs
+++ b/src/test/WixToolsetTest.Bal/BalExtensionFixture.cs
@@ -34,5 +34,33 @@ namespace WixToolsetTest.Bal
34 Assert.True(File.Exists(bundleFile)); 34 Assert.True(File.Exists(bundleFile));
35 } 35 }
36 } 36 }
37
38 [Fact]
39 public void CantBuildUsingMBAWithNoPrereqs()
40 {
41 using (var fs = new DisposableFileSystem())
42 {
43 var baseFolder = fs.GetFolder();
44 var bundleFile = Path.Combine(baseFolder, "bin", "test.exe");
45 var bundleSourceFolder = TestData.Get(@"TestData\MBA");
46 var intermediateFolder = Path.Combine(baseFolder, "obj");
47
48 var compileResult = WixRunner.Execute(new[]
49 {
50 "build",
51 Path.Combine(bundleSourceFolder, "Bundle.wxs"),
52 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
53 "-ext", TestData.Get(@"WixToolset.NetFx.wixext.dll"),
54 "-intermediateFolder", intermediateFolder,
55 "-burnStub", TestData.Get(@"runtimes\win-x86\native\burn.x86.exe"),
56 "-o", bundleFile,
57 });
58 Assert.Equal(6802, compileResult.ExitCode);
59 Assert.Equal("There must be at least one PrereqPackage when using the ManagedBootstrapperApplicationHost.\nThis is typically done by using the WixNetFxExtension and referencing one of the NetFxAsPrereq package groups.", compileResult.Messages[0].ToString());
60
61 Assert.False(File.Exists(bundleFile));
62 Assert.False(File.Exists(Path.Combine(intermediateFolder, "test.exe")));
63 }
64 }
37 } 65 }
38} 66}
diff --git a/src/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs b/src/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs
new file mode 100644
index 00000000..b3538c68
--- /dev/null
+++ b/src/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
3 xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
4 <Bundle Name="WixStdBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="75D5D534-E177-4689-AAE9-CAC1C39002C2">
5 <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" />
6 <Chain>
7 <PackageGroupRef Id="NetFx462Redist" />
8 </Chain>
9 </Bundle>
10</Wix>
diff --git a/src/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs b/src/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs
index 3a37e8ec..45bb25d1 100644
--- a/src/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs
+++ b/src/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs
@@ -6,10 +6,7 @@
6 <bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" /> 6 <bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" />
7 </BootstrapperApplicationRef> 7 </BootstrapperApplicationRef>
8 <Chain> 8 <Chain>
9 <!-- TODO: Replace ExePackage below with this --> 9 <ExePackage SourceFile="runtimes\win-x86\native\wixnative.x86.exe" />
10 <!-- <PackageGroupRef Id="NetFx462RedistAsPrereq" /> -->
11 <!-- TODO: Remove explicit PerMachine -->
12 <ExePackage SourceFile="runtimes\win-x86\native\wixnative.x86.exe" PerMachine="no" />
13 </Chain> 10 </Chain>
14 </Bundle> 11 </Bundle>
15</Wix> 12</Wix>
diff --git a/src/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj b/src/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj
index 84a38e56..19c86839 100644
--- a/src/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj
+++ b/src/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj
@@ -12,9 +12,14 @@
12 </PropertyGroup> 12 </PropertyGroup>
13 13
14 <ItemGroup> 14 <ItemGroup>
15 <Content Include="TestData\MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" />
15 <Content Include="TestData\WixStdBa\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> 16 <Content Include="TestData\WixStdBa\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" />
16 </ItemGroup> 17 </ItemGroup>
17 18
19 <Target Name="CopyExtensions" AfterTargets="Build">
20 <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(WixExtension)" />
21 </Target>
22
18 <ItemGroup> 23 <ItemGroup>
19 <ProjectReference Include="..\..\wixext\WixToolset.Bal.wixext.csproj" /> 24 <ProjectReference Include="..\..\wixext\WixToolset.Bal.wixext.csproj" />
20 </ItemGroup> 25 </ItemGroup>
@@ -25,6 +30,7 @@
25 <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" /> 30 <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" />
26 <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" /> 31 <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" />
27 <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" /> 32 <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" />
33 <PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.*" />
28 </ItemGroup> 34 </ItemGroup>
29 35
30 <ItemGroup> 36 <ItemGroup>
diff --git a/src/wixext/BalBurnBackendExtension.cs b/src/wixext/BalBurnBackendExtension.cs
index e1082889..71cd2d92 100644
--- a/src/wixext/BalBurnBackendExtension.cs
+++ b/src/wixext/BalBurnBackendExtension.cs
@@ -9,21 +9,14 @@ namespace WixToolset.Bal
9 using WixToolset.Data.Burn; 9 using WixToolset.Data.Burn;
10 using WixToolset.Data.Tuples; 10 using WixToolset.Data.Tuples;
11 using WixToolset.Extensibility; 11 using WixToolset.Extensibility;
12 using WixToolset.Extensibility.Data;
13 12
14 public class BalBurnBackendExtension : BaseBurnBackendExtension 13 public class BalBurnBackendExtension : BaseBurnBackendExtension
15 { 14 {
16 public override void PostBackendBind(IBindResult result) 15 public override void BundleFinalize()
17 { 16 {
18 base.PostBackendBind(result); 17 base.BundleFinalize();
19 18
20 if (result.Wixout == null) 19 var intermediate = this.Context.IntermediateRepresentation;
21 {
22 this.Messaging.Write(new Message(null, MessageLevel.Warning, 1, "BurnBackend didn't provide Wixout so skipping BalExtension PostBind verification."));
23 return;
24 }
25
26 var intermediate = Intermediate.Load(result.Wixout);
27 var section = intermediate.Sections.Single(); 20 var section = intermediate.Sections.Single();
28 21
29 var baTuple = section.Tuples.OfType<WixBootstrapperApplicationTuple>().SingleOrDefault(); 22 var baTuple = section.Tuples.OfType<WixBootstrapperApplicationTuple>().SingleOrDefault();