From 70e370b4494a87cbbe234130882cad4a1021f82a Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Tue, 8 Dec 2020 23:03:30 -0600 Subject: Require the custom BA elements to reference built-in BAs. --- .../WixToolsetTest.Bal/TestData/MBA/Bundle.wxs | 6 +- .../TestData/Overridable/Bundle.wxs | 8 +- .../TestData/WixStdBa/Bundle.wxs | 8 +- .../WixStdBa/DisplayInternalUIConditionBundle.wxs | 8 +- .../FrameworkDependentBundle.wxs | 21 ++- .../EarliestCoreBundleSCD/SelfContainedBundle.wxs | 10 +- .../TrimmedSelfContainedBundle.wxs | 10 +- src/test/examples/FullFramework2Bundle/Bundle.wxs | 9 +- src/test/examples/FullFramework4Bundle/Bundle.wxs | 9 +- .../FrameworkDependentBundle.wxs | 21 ++- .../LatestCoreBundleSCD/SelfContainedBundle.wxs | 10 +- .../TrimmedSelfContainedBundle.wxs | 10 +- .../WPFCoreBundleFDD/FrameworkDependentBundle.wxs | 21 ++- src/wixext/BalBurnBackendExtension.cs | 4 +- src/wixext/BalCompiler.cs | 180 ++++++++++++++++++++- src/wixlib/BalExtension_platform.wxi | 25 +++ src/wixlib/BalExtension_x86.wxs | 7 + src/wixlib/Dnc.wxs | 51 +----- src/wixlib/Mba.wxs | 98 ++++------- src/wixlib/caDecor.wxi | 39 +++++ src/wixlib/caSuffix.wxi | 27 ---- src/wixlib/wixstdba_platform.wxi | 47 ------ src/wixlib/wixstdba_x86.wxs | 7 - 23 files changed, 354 insertions(+), 282 deletions(-) create mode 100644 src/wixlib/BalExtension_platform.wxi create mode 100644 src/wixlib/BalExtension_x86.wxs create mode 100644 src/wixlib/caDecor.wxi delete mode 100644 src/wixlib/caSuffix.wxi delete mode 100644 src/wixlib/wixstdba_platform.wxi delete mode 100644 src/wixlib/wixstdba_x86.wxs (limited to 'src') diff --git a/src/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs b/src/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs index e6f1d566..1b72c725 100644 --- a/src/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs +++ b/src/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs @@ -1,8 +1,10 @@ - + - + + + diff --git a/src/test/WixToolsetTest.Bal/TestData/Overridable/Bundle.wxs b/src/test/WixToolsetTest.Bal/TestData/Overridable/Bundle.wxs index 3ac3df60..5072b813 100644 --- a/src/test/WixToolsetTest.Bal/TestData/Overridable/Bundle.wxs +++ b/src/test/WixToolsetTest.Bal/TestData/Overridable/Bundle.wxs @@ -1,10 +1,10 @@ - + - - - + + + diff --git a/src/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs b/src/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs index 82b0434d..3ba305b5 100644 --- a/src/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs +++ b/src/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs @@ -1,10 +1,10 @@ - + - - - + + + diff --git a/src/test/WixToolsetTest.Bal/TestData/WixStdBa/DisplayInternalUIConditionBundle.wxs b/src/test/WixToolsetTest.Bal/TestData/WixStdBa/DisplayInternalUIConditionBundle.wxs index 438fc23e..f08cfe6a 100644 --- a/src/test/WixToolsetTest.Bal/TestData/WixStdBa/DisplayInternalUIConditionBundle.wxs +++ b/src/test/WixToolsetTest.Bal/TestData/WixStdBa/DisplayInternalUIConditionBundle.wxs @@ -1,10 +1,10 @@ - + - - - + + + diff --git a/src/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs b/src/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs index 5cec494d..2bea6d38 100644 --- a/src/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs +++ b/src/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs @@ -1,15 +1,14 @@ - - + - - - - - - - - + + + + + + + + + diff --git a/src/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs b/src/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs index d951ffc6..4e4eb105 100644 --- a/src/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs +++ b/src/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs @@ -1,11 +1,9 @@ - - + - - + + - + diff --git a/src/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs b/src/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs index 816524ed..0bcd7755 100644 --- a/src/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs +++ b/src/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs @@ -1,11 +1,9 @@ - - + - - + + - + diff --git a/src/test/examples/FullFramework2Bundle/Bundle.wxs b/src/test/examples/FullFramework2Bundle/Bundle.wxs index c95631db..d0acd0e4 100644 --- a/src/test/examples/FullFramework2Bundle/Bundle.wxs +++ b/src/test/examples/FullFramework2Bundle/Bundle.wxs @@ -1,13 +1,12 @@ - - + - + - + + diff --git a/src/test/examples/FullFramework4Bundle/Bundle.wxs b/src/test/examples/FullFramework4Bundle/Bundle.wxs index be0be131..8cb5b431 100644 --- a/src/test/examples/FullFramework4Bundle/Bundle.wxs +++ b/src/test/examples/FullFramework4Bundle/Bundle.wxs @@ -1,13 +1,12 @@ - - + - + - + + diff --git a/src/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs b/src/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs index 22fb3d8b..72c576b4 100644 --- a/src/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs +++ b/src/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs @@ -1,15 +1,14 @@ - - + - - - - - - - - + + + + + + + + + diff --git a/src/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs b/src/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs index 4b0fe38a..5aa10f01 100644 --- a/src/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs +++ b/src/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs @@ -1,11 +1,9 @@ - - + - - + + - + diff --git a/src/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs b/src/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs index eee87933..a9cf1ac7 100644 --- a/src/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs +++ b/src/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs @@ -1,11 +1,9 @@ - - + - - + + - + diff --git a/src/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs b/src/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs index ecc5e8c1..266a8ecc 100644 --- a/src/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs +++ b/src/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs @@ -1,15 +1,14 @@ - - + - - - - - - - - + + + + + + + + + diff --git a/src/wixext/BalBurnBackendExtension.cs b/src/wixext/BalBurnBackendExtension.cs index 3f2cda05..7e481ee9 100644 --- a/src/wixext/BalBurnBackendExtension.cs +++ b/src/wixext/BalBurnBackendExtension.cs @@ -42,8 +42,8 @@ namespace WixToolset.Bal } var isStdBA = baId.StartsWith("WixStandardBootstrapperApplication"); - var isMBA = baId.StartsWith("ManagedBootstrapperApplicationHost"); - var isDNC = baId.StartsWith("DotNetCoreBootstrapperApplicationHost"); + var isMBA = baId.StartsWith("WixManagedBootstrapperApplicationHost"); + var isDNC = baId.StartsWith("WixDotNetCoreBootstrapperApplicationHost"); var isSCD = isDNC && this.VerifySCD(section); if (isStdBA || isMBA || isDNC) diff --git a/src/wixext/BalCompiler.cs b/src/wixext/BalCompiler.cs index 484dd9e4..1629a670 100644 --- a/src/wixext/BalCompiler.cs +++ b/src/wixext/BalCompiler.cs @@ -9,6 +9,7 @@ namespace WixToolset.Bal using WixToolset.Data; using WixToolset.Data.Symbols; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; /// /// The compiler for the WiX Toolset Bal Extension. @@ -17,6 +18,31 @@ namespace WixToolset.Bal { private readonly Dictionary prereqInfoSymbolsByPackageId; + private enum WixDotNetCoreBootstrapperApplicationHostTheme + { + Unknown, + None, + Standard, + } + + private enum WixManagedBootstrapperApplicationHostTheme + { + Unknown, + None, + Standard, + } + + private enum WixStandardBootstrapperApplicationTheme + { + Unknown, + HyperlinkLargeLicense, + HyperlinkLicense, + HyperlinkSidebarLicense, + None, + RtfLargeLicense, + RtfLicense, + } + /// /// Instantiate a new BalCompiler. /// @@ -54,7 +80,7 @@ namespace WixToolset.Bal break; } break; - case "BootstrapperApplicationRef": + case "BootstrapperApplication": switch (element.Name.LocalName) { case "WixStandardBootstrapperApplication": @@ -63,8 +89,8 @@ namespace WixToolset.Bal case "WixManagedBootstrapperApplicationHost": this.ParseWixManagedBootstrapperApplicationHostElement(intermediate, section, element); break; - case "WixDotNetCoreBootstrapperApplication": - this.ParseWixDotNetCoreBootstrapperApplicationElement(intermediate, section, element); + case "WixDotNetCoreBootstrapperApplicationHost": + this.ParseWixDotNetCoreBootstrapperApplicationHostElement(intermediate, section, element); break; default: this.ParseHelper.UnexpectedElement(parentElement, element); @@ -407,6 +433,7 @@ namespace WixToolset.Bal string licenseUrl = null; string logoFile = null; string logoSideFile = null; + WixStandardBootstrapperApplicationTheme? theme = null; string themeFile = null; string localizationFile = null; var suppressOptionsUI = YesNoType.NotSet; @@ -469,6 +496,34 @@ namespace WixToolset.Bal case "SupportCacheOnly": supportCacheOnly = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; + case "Theme": + var themeValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + switch (themeValue) + { + case "hyperlinkLargeLicense": + theme = WixStandardBootstrapperApplicationTheme.HyperlinkLargeLicense; + break; + case "hyperlinkLicense": + theme = WixStandardBootstrapperApplicationTheme.HyperlinkLicense; + break; + case "hyperlinkSidebarLicense": + theme = WixStandardBootstrapperApplicationTheme.HyperlinkSidebarLicense; + break; + case "none": + theme = WixStandardBootstrapperApplicationTheme.None; + break; + case "rtfLargeLicense": + theme = WixStandardBootstrapperApplicationTheme.RtfLargeLicense; + break; + case "rtfLicense": + theme = WixStandardBootstrapperApplicationTheme.RtfLicense; + break; + default: + this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Theme", themeValue, "hyperlinkLargeLicense", "hyperlinkLicense", "hyperlinkSidebarLicense", "none", "rtfLargeLicense", "rtfLicense")); + theme = WixStandardBootstrapperApplicationTheme.Unknown; // set a value to prevent expected attribute error below. + break; + } + break; default: this.ParseHelper.UnexpectedAttribute(node, attrib); break; @@ -482,13 +537,20 @@ namespace WixToolset.Bal this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); - if (String.IsNullOrEmpty(licenseFile) && null == licenseUrl) + if (!theme.HasValue) + { + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Theme")); + } + + if (theme != WixStandardBootstrapperApplicationTheme.None && String.IsNullOrEmpty(licenseFile) && null == licenseUrl) { this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "LicenseFile", "LicenseUrl", true)); } if (!this.Messaging.EncounteredError) { + this.CreateBARef(section, sourceLineNumbers, node, "WixStandardBootstrapperApplication"); + if (!String.IsNullOrEmpty(launchTarget)) { section.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Public, "LaunchTarget")) @@ -611,6 +673,31 @@ namespace WixToolset.Bal symbol.SupportCacheOnly = 1; } } + + string themePayloadGroup = null; + switch (theme) + { + case WixStandardBootstrapperApplicationTheme.HyperlinkLargeLicense: + themePayloadGroup = "WixStdbaHyperlinkLargeLicensePayloads"; + break; + case WixStandardBootstrapperApplicationTheme.HyperlinkLicense: + themePayloadGroup = "WixStdbaHyperlinkLicensePayloads"; + break; + case WixStandardBootstrapperApplicationTheme.HyperlinkSidebarLicense: + themePayloadGroup = "WixStdbaHyperlinkSidebarLicensePayloads"; + break; + case WixStandardBootstrapperApplicationTheme.RtfLargeLicense: + themePayloadGroup = "WixStdbaRtfLargeLicensePayloads"; + break; + case WixStandardBootstrapperApplicationTheme.RtfLicense: + themePayloadGroup = "WixStdbaRtfLicensePayloads"; + break; + } + + if (themePayloadGroup != null) + { + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixBundlePayloadGroup, themePayloadGroup); + } } } @@ -624,6 +711,7 @@ namespace WixToolset.Bal string logoFile = null; string themeFile = null; string localizationFile = null; + WixManagedBootstrapperApplicationHostTheme? theme = null; foreach (var attrib in node.Attributes()) { @@ -640,6 +728,22 @@ namespace WixToolset.Bal case "LocalizationFile": localizationFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); break; + case "Theme": + var themeValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + switch (themeValue) + { + case "none": + theme = WixManagedBootstrapperApplicationHostTheme.None; + break; + case "standard": + theme = WixManagedBootstrapperApplicationHostTheme.Standard; + break; + default: + this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Theme", themeValue, "none", "standard")); + theme = WixManagedBootstrapperApplicationHostTheme.Unknown; + break; + } + break; default: this.ParseHelper.UnexpectedAttribute(node, attrib); break; @@ -655,6 +759,8 @@ namespace WixToolset.Bal if (!this.Messaging.EncounteredError) { + this.CreateBARef(section, sourceLineNumbers, node, "WixManagedBootstrapperApplicationHost"); + if (!String.IsNullOrEmpty(logoFile)) { section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Public, "PreqbaLogo")) @@ -678,6 +784,19 @@ namespace WixToolset.Bal Value = localizationFile, }); } + + string themePayloadGroup = null; + switch (theme) + { + case WixManagedBootstrapperApplicationHostTheme.Standard: + themePayloadGroup = "MbaPreqStandardPayloads"; + break; + } + + if (themePayloadGroup != null) + { + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixBundlePayloadGroup, themePayloadGroup); + } } } @@ -685,13 +804,14 @@ namespace WixToolset.Bal /// Parses a WixDotNetCoreBootstrapperApplication element for Bundles. /// /// The element to parse. - private void ParseWixDotNetCoreBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node) + private void ParseWixDotNetCoreBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node) { var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); string logoFile = null; string themeFile = null; string localizationFile = null; var selfContainedDeployment = YesNoType.NotSet; + WixDotNetCoreBootstrapperApplicationHostTheme? theme = null; foreach (var attrib in node.Attributes()) { @@ -711,6 +831,22 @@ namespace WixToolset.Bal case "SelfContainedDeployment": selfContainedDeployment = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); break; + case "Theme": + var themeValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + switch (themeValue) + { + case "none": + theme = WixDotNetCoreBootstrapperApplicationHostTheme.None; + break; + case "standard": + theme = WixDotNetCoreBootstrapperApplicationHostTheme.Standard; + break; + default: + this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Theme", themeValue, "none", "standard")); + theme = WixDotNetCoreBootstrapperApplicationHostTheme.Unknown; + break; + } + break; default: this.ParseHelper.UnexpectedAttribute(node, attrib); break; @@ -722,10 +858,17 @@ namespace WixToolset.Bal } } + if (!theme.HasValue) + { + theme = WixDotNetCoreBootstrapperApplicationHostTheme.Standard; + } + this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); if (!this.Messaging.EncounteredError) { + this.CreateBARef(section, sourceLineNumbers, node, "WixDotNetCoreBootstrapperApplicationHost"); + if (!String.IsNullOrEmpty(logoFile)) { section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Public, "DncPreqbaLogo")) @@ -757,6 +900,33 @@ namespace WixToolset.Bal SelfContainedDeployment = 1, }); } + + string themePayloadGroup = null; + switch (theme) + { + case WixDotNetCoreBootstrapperApplicationHostTheme.Standard: + themePayloadGroup = "DncPreqStandardPayloads"; + break; + } + + if (themePayloadGroup != null) + { + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixBundlePayloadGroup, themePayloadGroup); + } + } + } + + private void CreateBARef(IntermediateSection section, SourceLineNumber sourceLineNumbers, XElement node, string name) + { + var id = this.ParseHelper.CreateIdentifierValueFromPlatform(name, this.Context.Platform, BurnPlatforms.X86); + if (id == null) + { + this.Messaging.Write(ErrorMessages.UnsupportedPlatformForElement(sourceLineNumbers, this.Context.Platform.ToString(), node.Name.LocalName)); + } + + if (!this.Messaging.EncounteredError) + { + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixBootstrapperApplication, id); } } } diff --git a/src/wixlib/BalExtension_platform.wxi b/src/wixlib/BalExtension_platform.wxi new file mode 100644 index 00000000..fa7d1182 --- /dev/null +++ b/src/wixlib/BalExtension_platform.wxi @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wixlib/BalExtension_x86.wxs b/src/wixlib/BalExtension_x86.wxs new file mode 100644 index 00000000..3cdd4015 --- /dev/null +++ b/src/wixlib/BalExtension_x86.wxs @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/wixlib/Dnc.wxs b/src/wixlib/Dnc.wxs index 9b5dc0ee..d777c473 100644 --- a/src/wixlib/Dnc.wxs +++ b/src/wixlib/Dnc.wxs @@ -6,54 +6,15 @@ Dnc.wxs - .NET Core BA resources. --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - + + + + diff --git a/src/wixlib/Mba.wxs b/src/wixlib/Mba.wxs index 4667904a..2d407c88 100644 --- a/src/wixlib/Mba.wxs +++ b/src/wixlib/Mba.wxs @@ -3,79 +3,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wixlib/caDecor.wxi b/src/wixlib/caDecor.wxi new file mode 100644 index 00000000..b1711518 --- /dev/null +++ b/src/wixlib/caDecor.wxi @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wixlib/caSuffix.wxi b/src/wixlib/caSuffix.wxi deleted file mode 100644 index 18436269..00000000 --- a/src/wixlib/caSuffix.wxi +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/wixlib/wixstdba_platform.wxi b/src/wixlib/wixstdba_platform.wxi deleted file mode 100644 index fae52b80..00000000 --- a/src/wixlib/wixstdba_platform.wxi +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/wixlib/wixstdba_x86.wxs b/src/wixlib/wixstdba_x86.wxs deleted file mode 100644 index e3ad07e8..00000000 --- a/src/wixlib/wixstdba_x86.wxs +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - -- cgit v1.2.3-55-g6feb