diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-04-29 19:32:42 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-04-29 19:53:29 +1000 |
commit | a79ce0b907676e50332139b4c4a8acb5d22a4b46 (patch) | |
tree | eff9680cd53166f0f73934e02dfe5112384838f1 /src/wixext | |
parent | b7faab06259d3afdc3205024a0004ace72157cbe (diff) | |
download | wix-a79ce0b907676e50332139b4c4a8acb5d22a4b46.tar.gz wix-a79ce0b907676e50332139b4c4a8acb5d22a4b46.tar.bz2 wix-a79ce0b907676e50332139b4c4a8acb5d22a4b46.zip |
Add support for FDD in DotNetCoreBootstrapperApplicationHost.
Diffstat (limited to 'src/wixext')
-rw-r--r-- | src/wixext/BalBurnBackendExtension.cs | 26 | ||||
-rw-r--r-- | src/wixext/BalCompiler.cs | 86 | ||||
-rw-r--r-- | src/wixext/BalErrors.cs | 12 | ||||
-rw-r--r-- | src/wixext/Tuples/BalTupleDefinitions.cs | 5 | ||||
-rw-r--r-- | src/wixext/Tuples/WixDncOptionsTuple.cs | 47 | ||||
-rw-r--r-- | src/wixext/bal.xsd | 36 |
6 files changed, 203 insertions, 9 deletions
diff --git a/src/wixext/BalBurnBackendExtension.cs b/src/wixext/BalBurnBackendExtension.cs index 71cd2d92..c81955be 100644 --- a/src/wixext/BalBurnBackendExtension.cs +++ b/src/wixext/BalBurnBackendExtension.cs | |||
@@ -28,15 +28,17 @@ namespace WixToolset.Bal | |||
28 | 28 | ||
29 | var isStdBA = baId.StartsWith("WixStandardBootstrapperApplication"); | 29 | var isStdBA = baId.StartsWith("WixStandardBootstrapperApplication"); |
30 | var isMBA = baId.StartsWith("ManagedBootstrapperApplicationHost"); | 30 | var isMBA = baId.StartsWith("ManagedBootstrapperApplicationHost"); |
31 | var isDNC = baId.StartsWith("DotNetCoreBootstrapperApplicationHost"); | ||
32 | var isSCD = isDNC && this.VerifySCD(section); | ||
31 | 33 | ||
32 | if (isStdBA || isMBA) | 34 | if (isStdBA || isMBA || isDNC) |
33 | { | 35 | { |
34 | this.VerifyBAFunctions(section); | 36 | this.VerifyBAFunctions(section); |
35 | } | 37 | } |
36 | 38 | ||
37 | if (isMBA) | 39 | if (isMBA || (isDNC && !isSCD)) |
38 | { | 40 | { |
39 | this.VerifyPrereqPackages(section); | 41 | this.VerifyPrereqPackages(section, isDNC); |
40 | } | 42 | } |
41 | } | 43 | } |
42 | 44 | ||
@@ -78,12 +80,13 @@ namespace WixToolset.Bal | |||
78 | } | 80 | } |
79 | } | 81 | } |
80 | 82 | ||
81 | private void VerifyPrereqPackages(IntermediateSection section) | 83 | private void VerifyPrereqPackages(IntermediateSection section, bool isDNC) |
82 | { | 84 | { |
83 | var prereqInfoTuples = section.Tuples.OfType<WixMbaPrereqInformationTuple>().ToList(); | 85 | var prereqInfoTuples = section.Tuples.OfType<WixMbaPrereqInformationTuple>().ToList(); |
84 | if (prereqInfoTuples.Count == 0) | 86 | if (prereqInfoTuples.Count == 0) |
85 | { | 87 | { |
86 | this.Messaging.Write(BalErrors.MissingPrereq()); | 88 | var message = isDNC ? BalErrors.MissingDNCPrereq() : BalErrors.MissingMBAPrereq(); |
89 | this.Messaging.Write(message); | ||
87 | return; | 90 | return; |
88 | } | 91 | } |
89 | 92 | ||
@@ -115,5 +118,18 @@ namespace WixToolset.Bal | |||
115 | } | 118 | } |
116 | } | 119 | } |
117 | } | 120 | } |
121 | |||
122 | private bool VerifySCD(IntermediateSection section) | ||
123 | { | ||
124 | var isSCD = false; | ||
125 | |||
126 | var dncOptions = section.Tuples.OfType<WixDncOptionsTuple>().SingleOrDefault(); | ||
127 | if (dncOptions != null) | ||
128 | { | ||
129 | isSCD = dncOptions.SelfContainedDeployment != 0; | ||
130 | } | ||
131 | |||
132 | return isSCD; | ||
133 | } | ||
118 | } | 134 | } |
119 | } | 135 | } |
diff --git a/src/wixext/BalCompiler.cs b/src/wixext/BalCompiler.cs index 33400f3b..dfe29bde 100644 --- a/src/wixext/BalCompiler.cs +++ b/src/wixext/BalCompiler.cs | |||
@@ -63,6 +63,9 @@ namespace WixToolset.Bal | |||
63 | case "WixManagedBootstrapperApplicationHost": | 63 | case "WixManagedBootstrapperApplicationHost": |
64 | this.ParseWixManagedBootstrapperApplicationHostElement(intermediate, section, element); | 64 | this.ParseWixManagedBootstrapperApplicationHostElement(intermediate, section, element); |
65 | break; | 65 | break; |
66 | case "WixDotNetCoreBootstrapperApplication": | ||
67 | this.ParseWixDotNetCoreBootstrapperApplicationElement(intermediate, section, element); | ||
68 | break; | ||
66 | default: | 69 | default: |
67 | this.ParseHelper.UnexpectedElement(parentElement, element); | 70 | this.ParseHelper.UnexpectedElement(parentElement, element); |
68 | break; | 71 | break; |
@@ -200,7 +203,9 @@ namespace WixToolset.Bal | |||
200 | case "BAFactoryAssembly": | 203 | case "BAFactoryAssembly": |
201 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) | 204 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) |
202 | { | 205 | { |
203 | section.AddTuple(new WixBalBAFactoryAssemblyTuple(sourceLineNumbers) | 206 | // There can only be one. |
207 | var id = new Identifier(AccessModifier.Public, "TheBAFactoryAssembly"); | ||
208 | section.AddTuple(new WixBalBAFactoryAssemblyTuple(sourceLineNumbers, id) | ||
204 | { | 209 | { |
205 | PayloadId = payloadId, | 210 | PayloadId = payloadId, |
206 | }); | 211 | }); |
@@ -655,5 +660,84 @@ namespace WixToolset.Bal | |||
655 | } | 660 | } |
656 | } | 661 | } |
657 | } | 662 | } |
663 | |||
664 | /// <summary> | ||
665 | /// Parses a WixDotNetCoreBootstrapperApplication element for Bundles. | ||
666 | /// </summary> | ||
667 | /// <param name="node">The element to parse.</param> | ||
668 | private void ParseWixDotNetCoreBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node) | ||
669 | { | ||
670 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | ||
671 | string logoFile = null; | ||
672 | string themeFile = null; | ||
673 | string localizationFile = null; | ||
674 | var selfContainedDeployment = YesNoType.NotSet; | ||
675 | |||
676 | foreach (var attrib in node.Attributes()) | ||
677 | { | ||
678 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | ||
679 | { | ||
680 | switch (attrib.Name.LocalName) | ||
681 | { | ||
682 | case "LogoFile": | ||
683 | logoFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
684 | break; | ||
685 | case "ThemeFile": | ||
686 | themeFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
687 | break; | ||
688 | case "LocalizationFile": | ||
689 | localizationFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
690 | break; | ||
691 | case "SelfContainedDeployment": | ||
692 | selfContainedDeployment = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); | ||
693 | break; | ||
694 | default: | ||
695 | this.ParseHelper.UnexpectedAttribute(node, attrib); | ||
696 | break; | ||
697 | } | ||
698 | } | ||
699 | else | ||
700 | { | ||
701 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); | ||
702 | } | ||
703 | } | ||
704 | |||
705 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); | ||
706 | |||
707 | if (!this.Messaging.EncounteredError) | ||
708 | { | ||
709 | if (!String.IsNullOrEmpty(logoFile)) | ||
710 | { | ||
711 | section.AddTuple(new WixVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, "DncPreqbaLogo")) | ||
712 | { | ||
713 | Value = logoFile, | ||
714 | }); | ||
715 | } | ||
716 | |||
717 | if (!String.IsNullOrEmpty(themeFile)) | ||
718 | { | ||
719 | section.AddTuple(new WixVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, "DncPreqbaThemeXml")) | ||
720 | { | ||
721 | Value = themeFile, | ||
722 | }); | ||
723 | } | ||
724 | |||
725 | if (!String.IsNullOrEmpty(localizationFile)) | ||
726 | { | ||
727 | section.AddTuple(new WixVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, "DncPreqbaThemeWxl")) | ||
728 | { | ||
729 | Value = localizationFile, | ||
730 | }); | ||
731 | } | ||
732 | |||
733 | if (YesNoType.Yes == selfContainedDeployment) | ||
734 | { | ||
735 | section.AddTuple(new WixDncOptionsTuple(sourceLineNumbers) | ||
736 | { | ||
737 | SelfContainedDeployment = 1, | ||
738 | }); | ||
739 | } | ||
740 | } | ||
741 | } | ||
658 | } | 742 | } |
659 | } | 743 | } |
diff --git a/src/wixext/BalErrors.cs b/src/wixext/BalErrors.cs index 5591ae1d..bc0186c1 100644 --- a/src/wixext/BalErrors.cs +++ b/src/wixext/BalErrors.cs | |||
@@ -18,9 +18,14 @@ namespace WixToolset.Bal | |||
18 | return Message(sourceLineNumbers, Ids.BAFunctionsPayloadRequiredInUXContainer, "The BAFunctions DLL Payload element must be located inside the BootstrapperApplication container."); | 18 | return Message(sourceLineNumbers, Ids.BAFunctionsPayloadRequiredInUXContainer, "The BAFunctions DLL Payload element must be located inside the BootstrapperApplication container."); |
19 | } | 19 | } |
20 | 20 | ||
21 | public static Message MissingPrereq() | 21 | public static Message MissingDNCPrereq() |
22 | { | 22 | { |
23 | return Message(null, Ids.MissingPrereq, "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."); | 23 | return Message(null, Ids.MissingDNCPrereq, "There must be at least one PrereqPackage when using the DotNetCoreBootstrapperApplicationHost with SelfContainedDeployment set to \"no\"."); |
24 | } | ||
25 | |||
26 | public static Message MissingMBAPrereq() | ||
27 | { | ||
28 | return Message(null, Ids.MissingMBAPrereq, "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."); | ||
24 | } | 29 | } |
25 | 30 | ||
26 | public static Message MultipleBAFunctions(SourceLineNumber sourceLineNumbers) | 31 | public static Message MultipleBAFunctions(SourceLineNumber sourceLineNumbers) |
@@ -46,10 +51,11 @@ namespace WixToolset.Bal | |||
46 | public enum Ids | 51 | public enum Ids |
47 | { | 52 | { |
48 | AttributeRequiresPrereqPackage = 6801, | 53 | AttributeRequiresPrereqPackage = 6801, |
49 | MissingPrereq = 6802, | 54 | MissingMBAPrereq = 6802, |
50 | MultiplePrereqLicenses = 6803, | 55 | MultiplePrereqLicenses = 6803, |
51 | MultipleBAFunctions = 6804, | 56 | MultipleBAFunctions = 6804, |
52 | BAFunctionsPayloadRequiredInUXContainer = 6805, | 57 | BAFunctionsPayloadRequiredInUXContainer = 6805, |
58 | MissingDNCPrereq = 6806, | ||
53 | } | 59 | } |
54 | } | 60 | } |
55 | } | 61 | } |
diff --git a/src/wixext/Tuples/BalTupleDefinitions.cs b/src/wixext/Tuples/BalTupleDefinitions.cs index 48199f95..9a294703 100644 --- a/src/wixext/Tuples/BalTupleDefinitions.cs +++ b/src/wixext/Tuples/BalTupleDefinitions.cs | |||
@@ -11,6 +11,7 @@ namespace WixToolset.Bal | |||
11 | WixBalBAFactoryAssembly, | 11 | WixBalBAFactoryAssembly, |
12 | WixBalBAFunctions, | 12 | WixBalBAFunctions, |
13 | WixBalCondition, | 13 | WixBalCondition, |
14 | WixDncOptions, | ||
14 | WixMbaPrereqInformation, | 15 | WixMbaPrereqInformation, |
15 | WixStdbaOptions, | 16 | WixStdbaOptions, |
16 | WixStdbaOverridableVariable, | 17 | WixStdbaOverridableVariable, |
@@ -43,6 +44,9 @@ namespace WixToolset.Bal | |||
43 | case BalTupleDefinitionType.WixBalCondition: | 44 | case BalTupleDefinitionType.WixBalCondition: |
44 | return BalTupleDefinitions.WixBalCondition; | 45 | return BalTupleDefinitions.WixBalCondition; |
45 | 46 | ||
47 | case BalTupleDefinitionType.WixDncOptions: | ||
48 | return BalTupleDefinitions.WixDncOptions; | ||
49 | |||
46 | case BalTupleDefinitionType.WixMbaPrereqInformation: | 50 | case BalTupleDefinitionType.WixMbaPrereqInformation: |
47 | return BalTupleDefinitions.WixMbaPrereqInformation; | 51 | return BalTupleDefinitions.WixMbaPrereqInformation; |
48 | 52 | ||
@@ -62,6 +66,7 @@ namespace WixToolset.Bal | |||
62 | WixBalBAFactoryAssembly.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); | 66 | WixBalBAFactoryAssembly.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); |
63 | WixBalBAFunctions.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); | 67 | WixBalBAFunctions.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); |
64 | WixBalCondition.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); | 68 | WixBalCondition.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); |
69 | WixDncOptions.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); | ||
65 | WixMbaPrereqInformation.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); | 70 | WixMbaPrereqInformation.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); |
66 | WixStdbaOptions.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); | 71 | WixStdbaOptions.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); |
67 | WixStdbaOverridableVariable.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); | 72 | WixStdbaOverridableVariable.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag); |
diff --git a/src/wixext/Tuples/WixDncOptionsTuple.cs b/src/wixext/Tuples/WixDncOptionsTuple.cs new file mode 100644 index 00000000..8a36879b --- /dev/null +++ b/src/wixext/Tuples/WixDncOptionsTuple.cs | |||
@@ -0,0 +1,47 @@ | |||
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 | namespace WixToolset.Bal | ||
4 | { | ||
5 | using WixToolset.Data; | ||
6 | using WixToolset.Bal.Tuples; | ||
7 | |||
8 | public static partial class BalTupleDefinitions | ||
9 | { | ||
10 | public static readonly IntermediateTupleDefinition WixDncOptions = new IntermediateTupleDefinition( | ||
11 | BalTupleDefinitionType.WixDncOptions.ToString(), | ||
12 | new[] | ||
13 | { | ||
14 | new IntermediateFieldDefinition(nameof(WixDncOptionsTupleFields.SelfContainedDeployment), IntermediateFieldType.Number), | ||
15 | }, | ||
16 | typeof(WixDncOptionsTuple)); | ||
17 | } | ||
18 | } | ||
19 | |||
20 | namespace WixToolset.Bal.Tuples | ||
21 | { | ||
22 | using WixToolset.Data; | ||
23 | |||
24 | public enum WixDncOptionsTupleFields | ||
25 | { | ||
26 | SelfContainedDeployment, | ||
27 | } | ||
28 | |||
29 | public class WixDncOptionsTuple : IntermediateTuple | ||
30 | { | ||
31 | public WixDncOptionsTuple() : base(BalTupleDefinitions.WixDncOptions, null, null) | ||
32 | { | ||
33 | } | ||
34 | |||
35 | public WixDncOptionsTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalTupleDefinitions.WixDncOptions, sourceLineNumber, id) | ||
36 | { | ||
37 | } | ||
38 | |||
39 | public IntermediateField this[WixDncOptionsTupleFields index] => this.Fields[(int)index]; | ||
40 | |||
41 | public int SelfContainedDeployment | ||
42 | { | ||
43 | get => this.Fields[(int)WixDncOptionsTupleFields.SelfContainedDeployment].AsNumber(); | ||
44 | set => this.Set((int)WixDncOptionsTupleFields.SelfContainedDeployment, value); | ||
45 | } | ||
46 | } | ||
47 | } \ No newline at end of file | ||
diff --git a/src/wixext/bal.xsd b/src/wixext/bal.xsd index 52f9142f..ee1f8cec 100644 --- a/src/wixext/bal.xsd +++ b/src/wixext/bal.xsd | |||
@@ -215,6 +215,42 @@ | |||
215 | </xs:complexType> | 215 | </xs:complexType> |
216 | </xs:element> | 216 | </xs:element> |
217 | 217 | ||
218 | <xs:element name="WixDotNetCoreBootstrapperApplication"> | ||
219 | <xs:annotation> | ||
220 | <xs:documentation> | ||
221 | Configures the DotNetCoreBootstrapperApplicationHost for a Bundle. | ||
222 | </xs:documentation> | ||
223 | <xs:appinfo> | ||
224 | <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="BootstrapperApplicationRef" /> | ||
225 | </xs:appinfo> | ||
226 | </xs:annotation> | ||
227 | <xs:complexType> | ||
228 | <xs:attribute name="LogoFile" type="xs:string"> | ||
229 | <xs:annotation> | ||
230 | <xs:documentation>Source file of the logo graphic.</xs:documentation> | ||
231 | </xs:annotation> | ||
232 | </xs:attribute> | ||
233 | <xs:attribute name="ThemeFile" type="xs:string"> | ||
234 | <xs:annotation> | ||
235 | <xs:documentation>Source file of the theme XML.</xs:documentation> | ||
236 | </xs:annotation> | ||
237 | </xs:attribute> | ||
238 | <xs:attribute name="LocalizationFile" type="xs:string"> | ||
239 | <xs:annotation> | ||
240 | <xs:documentation>Source file of the theme localization .wxl file.</xs:documentation> | ||
241 | </xs:annotation> | ||
242 | </xs:attribute> | ||
243 | <xs:attribute name="SelfContainedDeployment" type="YesNoType"> | ||
244 | <xs:annotation> | ||
245 | <xs:documentation> | ||
246 | Whether the .NET Core BA was published as self-contained (SCD). | ||
247 | If using PublishTrimmed in the .NET Core project, there must be an item group with <TrimmerRootAssembly Include="System.Runtime.Loader" /> | ||
248 | </xs:documentation> | ||
249 | </xs:annotation> | ||
250 | </xs:attribute> | ||
251 | </xs:complexType> | ||
252 | </xs:element> | ||
253 | |||
218 | <xs:attribute name="BAFactoryAssembly" type="YesNoType"> | 254 | <xs:attribute name="BAFactoryAssembly" type="YesNoType"> |
219 | <xs:annotation> | 255 | <xs:annotation> |
220 | <xs:documentation> | 256 | <xs:documentation> |