diff options
author | Bob Arnson <bob@firegiant.com> | 2019-03-20 21:18:37 -0400 |
---|---|---|
committer | Bob Arnson <bob@firegiant.com> | 2019-03-20 21:23:17 -0400 |
commit | 42727c42248d1cb12ef8d9bc6f8ce7dda3f404c9 (patch) | |
tree | 7ec67b87e9ae3961cb750a0aafe86b98112249a8 | |
parent | 191027c6fb6bf50d2d4825a7b3b9cd7bcfaea0cd (diff) | |
download | wix-42727c42248d1cb12ef8d9bc6f8ce7dda3f404c9.tar.gz wix-42727c42248d1cb12ef8d9bc6f8ce7dda3f404c9.tar.bz2 wix-42727c42248d1cb12ef8d9bc6f8ce7dda3f404c9.zip |
Bug: Wixipl references to extension libraries
Add test demonstrating that a persisted .wixipl file has broken
references to bits in an extension's library. Same project built
via wix.exe in one pass works as expected.
6 files changed, 150 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/Package.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/Package.en-us.wxl | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | |||
3 | <!-- | ||
4 | This file contains the declaration of all the localizable strings. | ||
5 | --> | ||
6 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US"> | ||
7 | |||
8 | <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String> | ||
9 | <String Id="FeatureTitle">MsiPackage</String> | ||
10 | |||
11 | </WixLocalization> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/Package.wxs new file mode 100644 index 00000000..15807698 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/Package.wxs | |||
@@ -0,0 +1,23 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Product Id="*" Name="MsiPackage" Codepage="1252" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | ||
4 | <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" /> | ||
5 | |||
6 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> | ||
7 | <MediaTemplate /> | ||
8 | |||
9 | <CustomAction Id="CAFromExtension" BinaryKey="BinFromWir" DllEntry="DoesntExist" /> | ||
10 | |||
11 | <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)"> | ||
12 | <ComponentGroupRef Id="ProductComponents" /> | ||
13 | </Feature> | ||
14 | </Product> | ||
15 | |||
16 | <Fragment> | ||
17 | <Directory Id="TARGETDIR" Name="SourceDir"> | ||
18 | <Directory Id="ProgramFilesFolder"> | ||
19 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" /> | ||
20 | </Directory> | ||
21 | </Directory> | ||
22 | </Fragment> | ||
23 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/PackageComponents.wxs new file mode 100644 index 00000000..e26c4509 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/PackageComponents.wxs | |||
@@ -0,0 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | ||
5 | <Component> | ||
6 | <File Source="test.txt" /> | ||
7 | </Component> | ||
8 | </ComponentGroup> | ||
9 | </Fragment> | ||
10 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/data/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/data/test.txt new file mode 100644 index 00000000..cd0db0e1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Wixipl/data/test.txt | |||
@@ -0,0 +1 @@ | |||
This is test.txt. \ No newline at end of file | |||
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 2b202350..874ee70b 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj | |||
@@ -81,6 +81,10 @@ | |||
81 | <Content Include="TestData\OverridableActions\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | 81 | <Content Include="TestData\OverridableActions\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> |
82 | <Content Include="TestData\OverridableActions\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | 82 | <Content Include="TestData\OverridableActions\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> |
83 | <Content Include="TestData\OverridableActions\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | 83 | <Content Include="TestData\OverridableActions\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> |
84 | <Content Include="TestData\Wixipl\data\test.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
85 | <Content Include="TestData\Wixipl\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | ||
86 | <Content Include="TestData\Wixipl\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
87 | <Content Include="TestData\Wixipl\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
84 | </ItemGroup> | 88 | </ItemGroup> |
85 | 89 | ||
86 | <ItemGroup> | 90 | <ItemGroup> |
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs index df6542e2..60706948 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/WixiplFixture.cs | |||
@@ -2,12 +2,14 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.IO; | 6 | using System.IO; |
6 | using System.Linq; | 7 | using System.Linq; |
7 | using WixBuildTools.TestSupport; | 8 | using WixBuildTools.TestSupport; |
8 | using WixToolset.Core.TestPackage; | 9 | using WixToolset.Core.TestPackage; |
9 | using WixToolset.Data; | 10 | using WixToolset.Data; |
10 | using WixToolset.Data.Tuples; | 11 | using WixToolset.Data.Tuples; |
12 | using Example.Extension; | ||
11 | using Xunit; | 13 | using Xunit; |
12 | 14 | ||
13 | public class WixiplFixture | 15 | public class WixiplFixture |
@@ -88,5 +90,104 @@ namespace WixToolsetTest.CoreIntegration | |||
88 | Assert.Equal((int)ErrorMessages.Ids.WixiplSourceFileIsExclusive, result.ExitCode); | 90 | Assert.Equal((int)ErrorMessages.Ids.WixiplSourceFileIsExclusive, result.ExitCode); |
89 | } | 91 | } |
90 | } | 92 | } |
93 | |||
94 | [Fact] | ||
95 | public void CanBuildMsiUsingExtensionLibrary() | ||
96 | { | ||
97 | var folder = TestData.Get(@"TestData\Wixipl"); | ||
98 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); | ||
99 | |||
100 | using (var fs = new DisposableFileSystem()) | ||
101 | { | ||
102 | var baseFolder = fs.GetFolder(); | ||
103 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
104 | |||
105 | var result = WixRunner.Execute(new[] | ||
106 | { | ||
107 | "build", | ||
108 | "-ext", extensionPath, | ||
109 | Path.Combine(folder, "Package.wxs"), | ||
110 | Path.Combine(folder, "PackageComponents.wxs"), | ||
111 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
112 | "-bindpath", Path.Combine(folder, "data"), | ||
113 | "-intermediateFolder", intermediateFolder, | ||
114 | "-o", Path.Combine(baseFolder, @"bin\test.msi"), | ||
115 | }); | ||
116 | |||
117 | result.AssertSuccess(); | ||
118 | |||
119 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"obj\test.wir")); | ||
120 | var section = intermediate.Sections.Single(); | ||
121 | |||
122 | { | ||
123 | var wixFile = section.Tuples.OfType<WixFileTuple>().Single(); | ||
124 | Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); | ||
125 | Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); | ||
126 | } | ||
127 | |||
128 | { | ||
129 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); | ||
130 | var path = binary[BinaryTupleFields.Data].AsPath().Path; | ||
131 | Assert.Contains("Example.Extension", path); | ||
132 | Assert.EndsWith(@"\0", path); | ||
133 | Assert.Equal(@"BinFromWir", binary[BinaryTupleFields.Name].AsString()); | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | |||
138 | [Fact] | ||
139 | public void CanBuildWixiplUsingExtensionLibrary() | ||
140 | { | ||
141 | var folder = TestData.Get(@"TestData\Wixipl"); | ||
142 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); | ||
143 | |||
144 | using (var fs = new DisposableFileSystem()) | ||
145 | { | ||
146 | var baseFolder = fs.GetFolder(); | ||
147 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
148 | |||
149 | var result = WixRunner.Execute(new[] | ||
150 | { | ||
151 | "build", | ||
152 | "-ext", extensionPath, | ||
153 | Path.Combine(folder, "Package.wxs"), | ||
154 | Path.Combine(folder, "PackageComponents.wxs"), | ||
155 | "-intermediateFolder", intermediateFolder, | ||
156 | "-o", Path.Combine(intermediateFolder, @"test.wixipl"), | ||
157 | }); | ||
158 | |||
159 | result.AssertSuccess(); | ||
160 | |||
161 | result = WixRunner.Execute(new[] | ||
162 | { | ||
163 | "build", | ||
164 | Path.Combine(intermediateFolder, @"test.wixipl"), | ||
165 | "-ext", extensionPath, | ||
166 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
167 | "-bindpath", Path.Combine(folder, "data"), | ||
168 | "-intermediateFolder", intermediateFolder, | ||
169 | "-o", Path.Combine(baseFolder, @"bin\test.msi"), | ||
170 | }); | ||
171 | |||
172 | result.AssertSuccess(); | ||
173 | |||
174 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"obj\test.wir")); | ||
175 | var section = intermediate.Sections.Single(); | ||
176 | |||
177 | { | ||
178 | var wixFile = section.Tuples.OfType<WixFileTuple>().Single(); | ||
179 | Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); | ||
180 | Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); | ||
181 | } | ||
182 | |||
183 | { | ||
184 | var binary = section.Tuples.OfType<BinaryTuple>().Single(); | ||
185 | var path = binary[BinaryTupleFields.Data].AsPath().Path; | ||
186 | Assert.Contains("Example.Extension", path); | ||
187 | Assert.EndsWith(@"\0", path); | ||
188 | Assert.Equal(@"BinFromWir", binary[BinaryTupleFields.Name].AsString()); | ||
189 | } | ||
190 | } | ||
191 | } | ||
91 | } | 192 | } |
92 | } | 193 | } |