diff options
author | Bob Arnson <bob@firegiant.com> | 2024-05-15 22:11:57 -0400 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2024-06-10 20:44:12 -0400 |
commit | 1a38763b97ce53fa99e1d16f739b93135698df41 (patch) | |
tree | 178605b56a73c52635c3b9c89178ea5e4567c9b0 /src | |
parent | eed1b5bbfb49d2425417bc342ecabe9edc206cdf (diff) | |
download | wix-1a38763b97ce53fa99e1d16f739b93135698df41.tar.gz wix-1a38763b97ce53fa99e1d16f739b93135698df41.tar.bz2 wix-1a38763b97ce53fa99e1d16f739b93135698df41.zip |
Add a IUIBA edge-case test and clean up a bit.
Diffstat (limited to '')
4 files changed, 120 insertions, 7 deletions
diff --git a/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/InternalUIBAFixture.cs b/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/InternalUIBAFixture.cs index 7e64c13f..58d5d551 100644 --- a/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/InternalUIBAFixture.cs +++ b/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/InternalUIBAFixture.cs | |||
@@ -2,11 +2,11 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.BootstrapperApplications | 3 | namespace WixToolsetTest.BootstrapperApplications |
4 | { | 4 | { |
5 | using System; | ||
6 | using System.IO; | 5 | using System.IO; |
7 | using System.Linq; | 6 | using System.Linq; |
8 | using WixInternal.TestSupport; | 7 | using System.Xml; |
9 | using WixInternal.Core.TestPackage; | 8 | using WixInternal.Core.TestPackage; |
9 | using WixInternal.TestSupport; | ||
10 | using Xunit; | 10 | using Xunit; |
11 | 11 | ||
12 | public class InternalUIBAFixture | 12 | public class InternalUIBAFixture |
@@ -195,6 +195,72 @@ namespace WixToolsetTest.BootstrapperApplications | |||
195 | } | 195 | } |
196 | 196 | ||
197 | [Fact] | 197 | [Fact] |
198 | public void CanBuildUsingWixIuiBaAndForcedCachePrimaryPackage() | ||
199 | { | ||
200 | using (var fs = new DisposableFileSystem()) | ||
201 | { | ||
202 | var baseFolder = fs.GetFolder(); | ||
203 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
204 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
205 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
206 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
207 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
208 | |||
209 | var compileResult = WixRunner.Execute(warningsAsErrors: false, new[] | ||
210 | { | ||
211 | "build", | ||
212 | Path.Combine(bundleSourceFolder, "CanForceCachePrimaryPackage.wxs"), | ||
213 | "-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll"), | ||
214 | "-intermediateFolder", intermediateFolder, | ||
215 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
216 | "-o", bundleFile, | ||
217 | }); | ||
218 | |||
219 | compileResult.AssertSuccess(); | ||
220 | |||
221 | Assert.True(File.Exists(bundleFile)); | ||
222 | |||
223 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
224 | extractResult.AssertSuccess(); | ||
225 | |||
226 | var wixPackageProperties = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixPackageProperties"); | ||
227 | AssertCacheType(wixPackageProperties[0]); | ||
228 | AssertCacheType(wixPackageProperties[1]); | ||
229 | |||
230 | var balPackageInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixBalPackageInfo"); | ||
231 | WixAssert.CompareLineByLine(new string[] | ||
232 | { | ||
233 | "<WixBalPackageInfo PackageId='test.msi' PrimaryPackageType='default' />", | ||
234 | }, balPackageInfos); | ||
235 | |||
236 | var mbaPrereqInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixPrereqInformation"); | ||
237 | WixAssert.CompareLineByLine(new[] | ||
238 | { | ||
239 | "<WixPrereqInformation PackageId='wixnative.exe' />", | ||
240 | }, mbaPrereqInfos); | ||
241 | |||
242 | Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.thm"))); | ||
243 | Assert.True(File.Exists(Path.Combine(baFolderPath, "wixpreq.wxl"))); | ||
244 | } | ||
245 | |||
246 | static void AssertCacheType(XmlNode node) | ||
247 | { | ||
248 | var element = node as XmlElement; | ||
249 | var package = element?.GetAttribute("Package"); | ||
250 | var cache = element?.GetAttribute("Cache"); | ||
251 | |||
252 | if (package == "test.msi") | ||
253 | { | ||
254 | Assert.Equal("force", cache); | ||
255 | } | ||
256 | else if (package == "wixnative.exe") | ||
257 | { | ||
258 | Assert.Equal("keep", cache); | ||
259 | } | ||
260 | } | ||
261 | } | ||
262 | |||
263 | [Fact] | ||
198 | public void CannotBuildUsingWixIuiBaWithAllPrereqPackages() | 264 | public void CannotBuildUsingWixIuiBaWithAllPrereqPackages() |
199 | { | 265 | { |
200 | using (var fs = new DisposableFileSystem()) | 266 | using (var fs = new DisposableFileSystem()) |
diff --git a/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/TestData/WixIuiBa/CanForceCachePrimaryPackage.wxs b/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/TestData/WixIuiBa/CanForceCachePrimaryPackage.wxs new file mode 100644 index 00000000..0969a815 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/TestData/WixIuiBa/CanForceCachePrimaryPackage.wxs | |||
@@ -0,0 +1,14 @@ | |||
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="WixIuiBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="{1CD73801-0B08-4B39-B371-00DA49EF715F}"> | ||
5 | <BootstrapperApplication> | ||
6 | <Payload SourceFile="preqs.wxl" /> | ||
7 | <bal:WixInternalUIBootstrapperApplication LocalizationFile="preqs.wxl" /> | ||
8 | </BootstrapperApplication> | ||
9 | <Chain> | ||
10 | <ExePackage Permanent="yes" DetectCondition="none" SourceFile="runtimes\win-x86\native\wixnative.exe" /> | ||
11 | <MsiPackage SourceFile="test.msi" Cache="force" /> | ||
12 | </Chain> | ||
13 | </Bundle> | ||
14 | </Wix> | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/TestData/WixStdBa/Data/preqs.wxl b/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/TestData/WixStdBa/Data/preqs.wxl new file mode 100644 index 00000000..71e8864a --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.BootstrapperApplications/TestData/WixStdBa/Data/preqs.wxl | |||
@@ -0,0 +1,38 @@ | |||
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 | <WixLocalization Culture="en-us" Language="1033" xmlns="http://wixtoolset.org/schemas/v4/wxl"> | ||
5 | <String Id="Caption" Value="[WixBundleName] Prerequisites Setup" /> | ||
6 | <String Id="Title" Value="Prerequisites required for [WixBundleName] setup" /> | ||
7 | <String Id="NonPrereqTitle" Value="[WixBundleName] setup" /> | ||
8 | <String Id="ConfirmCancelMessage" Value="Are you sure you want to cancel?" /> | ||
9 | <String Id="HelpHeader" Value="Setup Help" /> | ||
10 | <String Id="HelpText" Value="/passive | /quiet - displays minimal UI with no prompts or displays no UI and
 no prompts. By default UI and all prompts are displayed.

/norestart - suppress any attempts to restart. By default UI will prompt before restart.
/log log.txt - logs to a specific file. By default a log file is created in %TEMP%." /> | ||
11 | <String Id="HelpCloseButton" Value="&Close" /> | ||
12 | <String Id="InstallLicenseTerms" Value="Click the "Install" button to accept the prerequisite <a href="#">license terms</a>." /> | ||
13 | <String Id="InstallAcceptAndInstallButton" Value="&Install" /> | ||
14 | <String Id="InstallDeclineButton" Value="&Decline" /> | ||
15 | <String Id="ProgressHeader" Value="Setup Progress" /> | ||
16 | <String Id="ProgressLabel" Value="Processing:" /> | ||
17 | <String Id="ProgressCancelButton" Value="&Cancel" /> | ||
18 | <String Id="SuccessHeader" Value="Prerequisite Setup Successful" /> | ||
19 | <String Id="SuccessLayoutHeader" Value="Layout Successfully Completed" /> | ||
20 | <String Id="SuccessRestartText" Value="You must restart your computer before [WixBundleName] setup can continue." /> | ||
21 | <String Id="SuccessRestartButton" Value="&Restart" /> | ||
22 | <String Id="SuccessCloseButton" Value="&Close" /> | ||
23 | <String Id="FailureHeader" Value="Setup Failed" /> | ||
24 | <String Id="FailureLayoutHeader" Value="Layout Failed" /> | ||
25 | <String Id="FailureLogLinkText" Value="One or more issues caused the setup to fail. Please fix the issues and then retry setup. For more information see the <a href="#">log file</a>." /> | ||
26 | <String Id="FailureRestartText" Value="You must restart your computer to complete the rollback of the software." /> | ||
27 | <String Id="FailureRestartButton" Value="&Restart" /> | ||
28 | <String Id="FailureCloseButton" Value="&Close" /> | ||
29 | <String Id="PREREQBAINFINITELOOPErrorMessage" Value="[WixBundleName] failed to start even though all of the prerequisites are installed." /> | ||
30 | <String Id="FilesInUseTitle" Value="Files In Use" /> | ||
31 | <String Id="FilesInUseLabel" Value="The following applications are using files that need to be updated:" /> | ||
32 | <String Id="FilesInUseNetfxCloseRadioButton" Value="Close the &applications." /> | ||
33 | <String Id="FilesInUseCloseRadioButton" Value="Close the &applications and attempt to restart them." /> | ||
34 | <String Id="FilesInUseDontCloseRadioButton" Value="&Do not close applications. A reboot will be required." /> | ||
35 | <String Id="FilesInUseRetryButton" Value="&Retry" /> | ||
36 | <String Id="FilesInUseIgnoreButton" Value="&Ignore" /> | ||
37 | <String Id="FilesInUseExitButton" Value="E&xit" /> | ||
38 | </WixLocalization> | ||
diff --git a/src/ext/Bal/wixext/BalErrors.cs b/src/ext/Bal/wixext/BalErrors.cs index 4c719091..d32efe1e 100644 --- a/src/ext/Bal/wixext/BalErrors.cs +++ b/src/ext/Bal/wixext/BalErrors.cs | |||
@@ -43,11 +43,6 @@ namespace WixToolset.BootstrapperApplications | |||
43 | return Message(sourceLineNumbers, Ids.IuibaPrimaryPackageEnableFeatureSelection, "When using WixInternalUIBootstrapperApplication, primary packages must not have feature selection enabled because it interferes with the user selecting feature through the MSI UI."); | 43 | return Message(sourceLineNumbers, Ids.IuibaPrimaryPackageEnableFeatureSelection, "When using WixInternalUIBootstrapperApplication, primary packages must not have feature selection enabled because it interferes with the user selecting feature through the MSI UI."); |
44 | } | 44 | } |
45 | 45 | ||
46 | public static Message MissingDNCBAFactoryAssembly(SourceLineNumber sourceLineNumbers) | ||
47 | { | ||
48 | return Message(sourceLineNumbers, Ids.MissingDNCBAFactoryAssembly, "When using DotNetCoreBootstrapperApplicationHost, the Payload element for the BA's entry point DLL must have bal:BAFactoryAssembly=\"yes\"."); | ||
49 | } | ||
50 | |||
51 | public static Message MissingPrereq(SourceLineNumber sourceLineNumbers) | 46 | public static Message MissingPrereq(SourceLineNumber sourceLineNumbers) |
52 | { | 47 | { |
53 | return Message(sourceLineNumbers, Ids.MissingPrereq, "There must be at least one package with bal:PrereqPackage=\"yes\" when using the bal:WixPrerequisiteBootstrapperApplication."); | 48 | return Message(sourceLineNumbers, Ids.MissingPrereq, "There must be at least one package with bal:PrereqPackage=\"yes\" when using the bal:WixPrerequisiteBootstrapperApplication."); |