From d686f0d92fc14940441dbf53c28547a975572f92 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 23 Apr 2020 12:01:31 +1000 Subject: Add ManagedBootstrapperApplicationPrereqInformation element to move prereq info back to NetFx. --- src/wixext/BalCompiler.cs | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'src/wixext/BalCompiler.cs') diff --git a/src/wixext/BalCompiler.cs b/src/wixext/BalCompiler.cs index c291d41f..da32234c 100644 --- a/src/wixext/BalCompiler.cs +++ b/src/wixext/BalCompiler.cs @@ -46,6 +46,9 @@ namespace WixToolset.Bal case "Condition": this.ParseConditionElement(intermediate, section, element); break; + case "ManagedBootstrapperApplicationPrereqInformation": + this.ParseMbaPrereqInfoElement(intermediate, section, element); + break; default: this.ParseHelper.UnexpectedElement(parentElement, element); break; @@ -292,6 +295,68 @@ namespace WixToolset.Bal } } + /// + /// Parses a Condition element for Bundles. + /// + /// The element to parse. + private void ParseMbaPrereqInfoElement(Intermediate intermediate, IntermediateSection section, XElement node) + { + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); + string packageId = null; + string licenseFile = null; + string licenseUrl = null; + + foreach (var attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "LicenseFile": + licenseFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "LicenseUrl": + licenseUrl = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "PackageId": + packageId = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + default: + this.ParseHelper.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); + } + } + + this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); + + if (null == packageId) + { + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "PackageId")); + } + + if (null == licenseFile && null == licenseUrl || + null != licenseFile && null != licenseUrl) + { + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "LicenseFile", "LicenseUrl", true)); + } + + if (!this.Messaging.EncounteredError) + { + section.AddTuple(new WixMbaPrereqInformationTuple(sourceLineNumbers) + { + PackageId = packageId, + LicenseFile = licenseFile, + LicenseUrl = licenseUrl, + }); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixBundlePackage, packageId); + } + } + /// /// Parses a WixStandardBootstrapperApplication element for Bundles. /// -- cgit v1.2.3-55-g6feb