aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Bal/wixext/BalCompiler.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2024-01-11 18:26:20 -0800
committerRob Mensching <rob@firegiant.com>2024-03-06 18:03:38 -0800
commit0d3d54992104288e9ee0c834d0b96e8502fd2d42 (patch)
tree9efa49c4983cd2ba1becab64bd1f2faccac88acf /src/ext/Bal/wixext/BalCompiler.cs
parent2824298d9dd817a47527c920363556b54ead5d5d (diff)
downloadwix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.gz
wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.bz2
wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.zip
Move the BootstrapperApplication out of proc
Diffstat (limited to 'src/ext/Bal/wixext/BalCompiler.cs')
-rw-r--r--src/ext/Bal/wixext/BalCompiler.cs289
1 files changed, 227 insertions, 62 deletions
diff --git a/src/ext/Bal/wixext/BalCompiler.cs b/src/ext/Bal/wixext/BalCompiler.cs
index 72883bdf..829da0e6 100644
--- a/src/ext/Bal/wixext/BalCompiler.cs
+++ b/src/ext/Bal/wixext/BalCompiler.cs
@@ -7,6 +7,7 @@ namespace WixToolset.Bal
7 using System.Xml.Linq; 7 using System.Xml.Linq;
8 using WixToolset.Bal.Symbols; 8 using WixToolset.Bal.Symbols;
9 using WixToolset.Data; 9 using WixToolset.Data;
10 using WixToolset.Data.Burn;
10 using WixToolset.Data.Symbols; 11 using WixToolset.Data.Symbols;
11 using WixToolset.Extensibility; 12 using WixToolset.Extensibility;
12 using WixToolset.Extensibility.Data; 13 using WixToolset.Extensibility.Data;
@@ -17,16 +18,9 @@ namespace WixToolset.Bal
17 public sealed class BalCompiler : BaseCompilerExtension 18 public sealed class BalCompiler : BaseCompilerExtension
18 { 19 {
19 private readonly Dictionary<string, WixBalPackageInfoSymbol> packageInfoSymbolsByPackageId = new Dictionary<string, WixBalPackageInfoSymbol>(); 20 private readonly Dictionary<string, WixBalPackageInfoSymbol> packageInfoSymbolsByPackageId = new Dictionary<string, WixBalPackageInfoSymbol>();
20 private readonly Dictionary<string, WixMbaPrereqInformationSymbol> prereqInfoSymbolsByPackageId = new Dictionary<string, WixMbaPrereqInformationSymbol>(); 21 private readonly Dictionary<string, WixPrereqInformationSymbol> prereqInfoSymbolsByPackageId = new Dictionary<string, WixPrereqInformationSymbol>();
21 22
22 private enum WixDotNetCoreBootstrapperApplicationHostTheme 23 private enum WixPrerequisiteBootstrapperApplicationTheme
23 {
24 Unknown,
25 None,
26 Standard,
27 }
28
29 private enum WixManagedBootstrapperApplicationHostTheme
30 { 24 {
31 Unknown, 25 Unknown,
32 None, 26 None,
@@ -63,17 +57,35 @@ namespace WixToolset.Bal
63 /// <param name="context">Extra information about the context in which this element is being parsed.</param> 57 /// <param name="context">Extra information about the context in which this element is being parsed.</param>
64 public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context) 58 public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context)
65 { 59 {
60 this.ParsePossibleKeyPathElement(intermediate, section, parentElement, element, context);
61 }
62
63 /// <summary>
64 /// Processes an element for the Compiler.
65 /// </summary>
66 /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
67 /// <param name="parentElement">Parent element of element to process.</param>
68 /// <param name="element">Element to process.</param>
69 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
70 public override IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context)
71 {
72 IComponentKeyPath exePayloadRef = null;
73
66 switch (parentElement.Name.LocalName) 74 switch (parentElement.Name.LocalName)
67 { 75 {
68 case "Bundle": 76 case "Bundle":
69 case "Fragment": 77 case "Fragment":
70 switch (element.Name.LocalName) 78 switch (element.Name.LocalName)
71 { 79 {
80 case "BootstrapperApplicationPrerequisiteInformation":
81 this.ParseBootstrapperApplicationPrerequisiteInformationElement(intermediate, section, element);
82 break;
72 case "Condition": 83 case "Condition":
73 this.ParseConditionElement(intermediate, section, element); 84 this.ParseConditionElement(intermediate, section, element);
74 break; 85 break;
75 case "ManagedBootstrapperApplicationPrereqInformation": 86 case "ManagedBootstrapperApplicationPrereqInformation":
76 this.ParseMbaPrereqInfoElement(intermediate, section, element); 87 this.Messaging.Write(WarningMessages.DeprecatedElement(this.ParseHelper.GetSourceLineNumbers(element), element.Name.LocalName, "BootstrapperApplicationPrerequisiteInformation"));
88 this.ParseBootstrapperApplicationPrerequisiteInformationElement(intermediate, section, element);
77 break; 89 break;
78 default: 90 default:
79 this.ParseHelper.UnexpectedElement(parentElement, element); 91 this.ParseHelper.UnexpectedElement(parentElement, element);
@@ -84,16 +96,19 @@ namespace WixToolset.Bal
84 switch (element.Name.LocalName) 96 switch (element.Name.LocalName)
85 { 97 {
86 case "WixInternalUIBootstrapperApplication": 98 case "WixInternalUIBootstrapperApplication":
87 this.ParseWixInternalUIBootstrapperApplicationElement(intermediate, section, element); 99 exePayloadRef = this.ParseWixInternalUIBootstrapperApplicationElement(intermediate, section, element);
100 break;
101 case "WixPrerequisiteBootstrapperApplication":
102 this.ParseWixPrerequisiteBootstrapperApplicationElement(intermediate, section, element, context);
88 break; 103 break;
89 case "WixStandardBootstrapperApplication": 104 case "WixStandardBootstrapperApplication":
90 this.ParseWixStandardBootstrapperApplicationElement(intermediate, section, element); 105 exePayloadRef = this.ParseWixStandardBootstrapperApplicationElement(intermediate, section, element);
91 break; 106 break;
92 case "WixManagedBootstrapperApplicationHost": 107 case "WixManagedBootstrapperApplicationHost":
93 this.ParseWixManagedBootstrapperApplicationHostElement(intermediate, section, element); 108 this.Messaging.Write(WarningMessages.DeprecatedElement(this.ParseHelper.GetSourceLineNumbers(element), element.Name.LocalName));
94 break; 109 break;
95 case "WixDotNetCoreBootstrapperApplicationHost": 110 case "WixDotNetCoreBootstrapperApplicationHost":
96 this.ParseWixDotNetCoreBootstrapperApplicationHostElement(intermediate, section, element); 111 this.Messaging.Write(WarningMessages.DeprecatedElement(this.ParseHelper.GetSourceLineNumbers(element), element.Name.LocalName));
97 break; 112 break;
98 default: 113 default:
99 this.ParseHelper.UnexpectedElement(parentElement, element); 114 this.ParseHelper.UnexpectedElement(parentElement, element);
@@ -104,6 +119,8 @@ namespace WixToolset.Bal
104 this.ParseHelper.UnexpectedElement(parentElement, element); 119 this.ParseHelper.UnexpectedElement(parentElement, element);
105 break; 120 break;
106 } 121 }
122
123 return exePayloadRef;
107 } 124 }
108 125
109 /// <summary> 126 /// <summary>
@@ -282,15 +299,7 @@ namespace WixToolset.Bal
282 switch (attribute.Name.LocalName) 299 switch (attribute.Name.LocalName)
283 { 300 {
284 case "BAFactoryAssembly": 301 case "BAFactoryAssembly":
285 if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) 302 this.Messaging.Write(BalWarnings.DeprecatedBAFactoryAssemblyAttribute(this.ParseHelper.GetSourceLineNumbers(parentElement), parentElement.Name.LocalName, attribute.Name.LocalName));
286 {
287 // There can only be one.
288 var id = new Identifier(AccessModifier.Global, "TheBAFactoryAssembly");
289 section.AddSymbol(new WixBalBAFactoryAssemblySymbol(sourceLineNumbers, id)
290 {
291 PayloadId = payloadId,
292 });
293 }
294 break; 303 break;
295 case "BAFunctions": 304 case "BAFunctions":
296 if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) 305 if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute))
@@ -352,15 +361,15 @@ namespace WixToolset.Bal
352 return packageInfo; 361 return packageInfo;
353 } 362 }
354 363
355 private WixMbaPrereqInformationSymbol GetMbaPrereqInformationSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, XAttribute prereqAttribute, string packageId) 364 private WixPrereqInformationSymbol GetMbaPrereqInformationSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, XAttribute prereqAttribute, string packageId)
356 { 365 {
357 WixMbaPrereqInformationSymbol prereqInfo = null; 366 WixPrereqInformationSymbol prereqInfo = null;
358 367
359 if (prereqAttribute != null && YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, prereqAttribute)) 368 if (prereqAttribute != null && YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, prereqAttribute))
360 { 369 {
361 if (!this.prereqInfoSymbolsByPackageId.TryGetValue(packageId, out prereqInfo)) 370 if (!this.prereqInfoSymbolsByPackageId.TryGetValue(packageId, out prereqInfo))
362 { 371 {
363 prereqInfo = section.AddSymbol(new WixMbaPrereqInformationSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, packageId)) 372 prereqInfo = section.AddSymbol(new WixPrereqInformationSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, packageId))
364 { 373 {
365 PackageId = packageId, 374 PackageId = packageId,
366 }); 375 });
@@ -432,7 +441,7 @@ namespace WixToolset.Bal
432 /// Parses a Condition element for Bundles. 441 /// Parses a Condition element for Bundles.
433 /// </summary> 442 /// </summary>
434 /// <param name="node">The element to parse.</param> 443 /// <param name="node">The element to parse.</param>
435 private void ParseMbaPrereqInfoElement(Intermediate intermediate, IntermediateSection section, XElement node) 444 private void ParseBootstrapperApplicationPrerequisiteInformationElement(Intermediate intermediate, IntermediateSection section, XElement node)
436 { 445 {
437 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); 446 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
438 string packageId = null; 447 string packageId = null;
@@ -480,7 +489,7 @@ namespace WixToolset.Bal
480 489
481 if (!this.Messaging.EncounteredError) 490 if (!this.Messaging.EncounteredError)
482 { 491 {
483 section.AddSymbol(new WixMbaPrereqInformationSymbol(sourceLineNumbers) 492 section.AddSymbol(new WixPrereqInformationSymbol(sourceLineNumbers)
484 { 493 {
485 PackageId = packageId, 494 PackageId = packageId,
486 LicenseFile = licenseFile, 495 LicenseFile = licenseFile,
@@ -490,14 +499,16 @@ namespace WixToolset.Bal
490 } 499 }
491 } 500 }
492 501
493 private void ParseWixInternalUIBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node) 502 private IComponentKeyPath ParseWixInternalUIBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node)
494 { 503 {
495 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); 504 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
496 WixInternalUIBootstrapperApplicationTheme? theme = null; 505 var theme = WixInternalUIBootstrapperApplicationTheme.Standard;
497 string themeFile = null; 506 string themeFile = null;
498 string logoFile = null; 507 string logoFile = null;
499 string localizationFile = null; 508 string localizationFile = null;
500 509
510 IComponentKeyPath exePayloadRef = null;
511
501 foreach (var attrib in node.Attributes()) 512 foreach (var attrib in node.Attributes())
502 { 513 {
503 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 514 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
@@ -542,11 +553,6 @@ namespace WixToolset.Bal
542 553
543 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); 554 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node);
544 555
545 if (!theme.HasValue)
546 {
547 theme = WixInternalUIBootstrapperApplicationTheme.Standard;
548 }
549
550 if (!this.Messaging.EncounteredError) 556 if (!this.Messaging.EncounteredError)
551 { 557 {
552 if (!String.IsNullOrEmpty(logoFile)) 558 if (!String.IsNullOrEmpty(logoFile))
@@ -573,23 +579,41 @@ namespace WixToolset.Bal
573 }); 579 });
574 } 580 }
575 581
576 var baId = "WixInternalUIBootstrapperApplication";
577 switch (theme) 582 switch (theme)
578 { 583 {
579 case WixInternalUIBootstrapperApplicationTheme.Standard: 584 case WixInternalUIBootstrapperApplicationTheme.Standard:
580 baId = "WixInternalUIBootstrapperApplication.Standard"; 585 this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixIuibaStandardPayloads", platformSpecific: false);
581 break; 586 break;
582 } 587 }
583 588
584 this.CreateBARef(section, sourceLineNumbers, node, baId, WixBalBootstrapperApplicationType.InternalUi); 589 section.AddSymbol(new WixBalBootstrapperApplicationSymbol(sourceLineNumbers)
590 {
591 Type = WixBalBootstrapperApplicationType.InternalUi,
592 });
593
594 section.AddSymbol(new WixPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPrereqOptions"))
595 {
596 Primary = 1,
597 HandleHelp = 1,
598 HandleLayout = 1,
599 });
600
601 var exePayloadId = this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixInternalUIBootstrapperApplication", platformSpecific: true);
602
603 exePayloadRef = this.CreateComponentKeyPath();
604 exePayloadRef.Id = new Identifier(AccessModifier.Section, exePayloadId);
605 exePayloadRef.Explicit = true; // Internal UI BA is always secondary because the PrereqBA is always primary to handle the help and layout options.
606 exePayloadRef.Type = PossibleKeyPathType.File;
585 } 607 }
608
609 return exePayloadRef;
586 } 610 }
587 611
588 /// <summary> 612 /// <summary>
589 /// Parses a WixStandardBootstrapperApplication element for Bundles. 613 /// Parses a WixStandardBootstrapperApplication element for Bundles.
590 /// </summary> 614 /// </summary>
591 /// <param name="node">The element to parse.</param> 615 /// <param name="node">The element to parse.</param>
592 private void ParseWixStandardBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node) 616 private IComponentKeyPath ParseWixStandardBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node)
593 { 617 {
594 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); 618 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
595 string launchTarget = null; 619 string launchTarget = null;
@@ -610,6 +634,8 @@ namespace WixToolset.Bal
610 var showVersion = YesNoType.NotSet; 634 var showVersion = YesNoType.NotSet;
611 var supportCacheOnly = YesNoType.NotSet; 635 var supportCacheOnly = YesNoType.NotSet;
612 636
637 IComponentKeyPath exePayloadRef = null;
638
613 foreach (var attrib in node.Attributes()) 639 foreach (var attrib in node.Attributes())
614 { 640 {
615 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 641 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
@@ -840,35 +866,159 @@ namespace WixToolset.Bal
840 } 866 }
841 } 867 }
842 868
843 var baId = "WixStandardBootstrapperApplication";
844 switch (theme) 869 switch (theme)
845 { 870 {
846 case WixStandardBootstrapperApplicationTheme.HyperlinkLargeLicense: 871 case WixStandardBootstrapperApplicationTheme.HyperlinkLargeLicense:
847 baId = "WixStandardBootstrapperApplication.HyperlinkLargeLicense"; 872 this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStdbaHyperlinkLargeLicensePayloads", platformSpecific: false);
848 break; 873 break;
849 case WixStandardBootstrapperApplicationTheme.HyperlinkLicense: 874 case WixStandardBootstrapperApplicationTheme.HyperlinkLicense:
850 baId = "WixStandardBootstrapperApplication.HyperlinkLicense"; 875 this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStdbaHyperlinkLicensePayloads", platformSpecific: false);
851 break; 876 break;
852 case WixStandardBootstrapperApplicationTheme.HyperlinkSidebarLicense: 877 case WixStandardBootstrapperApplicationTheme.HyperlinkSidebarLicense:
853 baId = "WixStandardBootstrapperApplication.HyperlinkSidebarLicense"; 878 this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStdbaHyperlinkSidebarLicensePayloads", platformSpecific: false);
854 break; 879 break;
855 case WixStandardBootstrapperApplicationTheme.RtfLargeLicense: 880 case WixStandardBootstrapperApplicationTheme.RtfLargeLicense:
856 baId = "WixStandardBootstrapperApplication.RtfLargeLicense"; 881 this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStdbaRtfLargeLicensePayloads", platformSpecific: false);
857 break; 882 break;
858 case WixStandardBootstrapperApplicationTheme.RtfLicense: 883 case WixStandardBootstrapperApplicationTheme.RtfLicense:
859 baId = "WixStandardBootstrapperApplication.RtfLicense"; 884 this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStdbaRtfLicensePayloads", platformSpecific: false);
885 break;
886 }
887
888 section.AddSymbol(new WixBalBootstrapperApplicationSymbol(sourceLineNumbers)
889 {
890 Type = WixBalBootstrapperApplicationType.Standard,
891 });
892
893 var exePayloadId = this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixStandardBootstrapperApplication", platformSpecific: true);
894
895 exePayloadRef = this.CreateComponentKeyPath();
896 exePayloadRef.Id = new Identifier(AccessModifier.Section, exePayloadId);
897 exePayloadRef.Type = PossibleKeyPathType.File;
898 }
899
900 return exePayloadRef;
901 }
902
903 /// <summary>
904 /// Parses a WixManagedBootstrapperApplicationHost element for Bundles.
905 /// </summary>
906 /// <param name="node">The element to parse.</param>
907 private void ParseWixPrerequisiteBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node, IDictionary<string, string> context)
908 {
909 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
910 string logoFile = null;
911 string themeFile = null;
912 string localizationFile = null;
913 var theme = WixPrerequisiteBootstrapperApplicationTheme.Standard;
914
915 foreach (var attrib in node.Attributes())
916 {
917 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
918 {
919 switch (attrib.Name.LocalName)
920 {
921 case "LogoFile":
922 logoFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
923 break;
924 case "ThemeFile":
925 themeFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
926 break;
927 case "LocalizationFile":
928 localizationFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
929 break;
930 case "Theme":
931 var themeValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
932 switch (themeValue)
933 {
934 case "none":
935 theme = WixPrerequisiteBootstrapperApplicationTheme.None;
936 break;
937 case "standard":
938 theme = WixPrerequisiteBootstrapperApplicationTheme.Standard;
939 break;
940 default:
941 this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Theme", themeValue, "none", "standard"));
942 theme = WixPrerequisiteBootstrapperApplicationTheme.Unknown;
943 break;
944 }
945 break;
946 default:
947 this.ParseHelper.UnexpectedAttribute(node, attrib);
948 break;
949 }
950 }
951 else
952 {
953 this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib);
954 }
955 }
956
957 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node);
958
959 if (!this.Messaging.EncounteredError)
960 {
961 if (!String.IsNullOrEmpty(logoFile))
962 {
963 section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPreqbaLogo"))
964 {
965 Value = logoFile,
966 });
967 }
968
969 if (!String.IsNullOrEmpty(themeFile))
970 {
971 section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPreqbaThemeXml"))
972 {
973 Value = themeFile,
974 });
975 }
976
977 if (!String.IsNullOrEmpty(localizationFile))
978 {
979 section.AddSymbol(new WixVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPreqbaThemeWxl"))
980 {
981 Value = localizationFile,
982 });
983 }
984
985 switch (theme)
986 {
987 case WixPrerequisiteBootstrapperApplicationTheme.Standard:
988 this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixPreqbaStandardPayloads", platformSpecific: false);
860 break; 989 break;
861 } 990 }
862 991
863 this.CreateBARef(section, sourceLineNumbers, node, baId, WixBalBootstrapperApplicationType.Standard); 992 section.AddSymbol(new WixBalBootstrapperApplicationSymbol(sourceLineNumbers)
993 {
994 Type = WixBalBootstrapperApplicationType.Prerequisite,
995 });
996
997 var primary = context.TryGetValue("Secondary", out var parentSecondaryValue) && "True".Equals(parentSecondaryValue, StringComparison.OrdinalIgnoreCase) ? true : false;
998
999 var baId = this.CreateIdentifierFromPlatform(sourceLineNumbers, node, primary ? "WixPrereqBootstrapperApplication.Primary" : "WixPrereqBootstrapperApplication.Secondary");
1000
1001 if (!String.IsNullOrEmpty(baId))
1002 {
1003 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixBootstrapperApplication, baId);
1004 }
1005
1006 if (primary)
1007 {
1008 section.AddSymbol(new WixPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPrereqOptions"))
1009 {
1010 Primary = 1
1011 });
1012 }
864 } 1013 }
865 } 1014 }
866 1015
1016#if DELETE
867 /// <summary> 1017 /// <summary>
868 /// Parses a WixManagedBootstrapperApplicationHost element for Bundles. 1018 /// Parses a WixManagedBootstrapperApplicationHost element for Bundles.
869 /// </summary> 1019 /// </summary>
870 /// <param name="node">The element to parse.</param> 1020 /// <param name="node">The element to parse.</param>
871 private void ParseWixManagedBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node) 1021 private IComponentKeyPath ParseWixManagedBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node)
872 { 1022 {
873 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); 1023 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
874 bool alwaysInstallPrereqs = false; 1024 bool alwaysInstallPrereqs = false;
@@ -877,6 +1027,8 @@ namespace WixToolset.Bal
877 string localizationFile = null; 1027 string localizationFile = null;
878 WixManagedBootstrapperApplicationHostTheme? theme = null; 1028 WixManagedBootstrapperApplicationHostTheme? theme = null;
879 1029
1030 IComponentKeyPath exePayloadRef = null;
1031
880 foreach (var attrib in node.Attributes()) 1032 foreach (var attrib in node.Attributes())
881 { 1033 {
882 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 1034 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
@@ -963,23 +1115,25 @@ namespace WixToolset.Bal
963 break; 1115 break;
964 } 1116 }
965 1117
966 this.CreateBARef(section, sourceLineNumbers, node, baId, WixBalBootstrapperApplicationType.ManagedHost); 1118 exePayloadRef = this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixManagedBootstrapperApplicationHost", baId, WixBalBootstrapperApplicationType.ManagedHost);
967 1119
968 if (alwaysInstallPrereqs) 1120 if (alwaysInstallPrereqs)
969 { 1121 {
970 section.AddSymbol(new WixMbaPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixMbaPrereqOptions")) 1122 section.AddSymbol(new WixPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPrereqOptions"))
971 { 1123 {
972 AlwaysInstallPrereqs = 1, 1124 AlwaysInstallPrereqs = 1,
973 }); 1125 });
974 } 1126 }
975 } 1127 }
1128
1129 return exePayloadRef;
976 } 1130 }
977 1131
978 /// <summary> 1132 /// <summary>
979 /// Parses a WixDotNetCoreBootstrapperApplication element for Bundles. 1133 /// Parses a WixDotNetCoreBootstrapperApplication element for Bundles.
980 /// </summary> 1134 /// </summary>
981 /// <param name="node">The element to parse.</param> 1135 /// <param name="node">The element to parse.</param>
982 private void ParseWixDotNetCoreBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node) 1136 private IComponentKeyPath ParseWixDotNetCoreBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node)
983 { 1137 {
984 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); 1138 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
985 bool alwaysInstallPrereqs = false; 1139 bool alwaysInstallPrereqs = false;
@@ -989,6 +1143,8 @@ namespace WixToolset.Bal
989 var selfContainedDeployment = YesNoType.NotSet; 1143 var selfContainedDeployment = YesNoType.NotSet;
990 WixDotNetCoreBootstrapperApplicationHostTheme? theme = null; 1144 WixDotNetCoreBootstrapperApplicationHostTheme? theme = null;
991 1145
1146 IComponentKeyPath exePayloadRef = null;
1147
992 foreach (var attrib in node.Attributes()) 1148 foreach (var attrib in node.Attributes())
993 { 1149 {
994 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 1150 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
@@ -1086,19 +1242,36 @@ namespace WixToolset.Bal
1086 break; 1242 break;
1087 } 1243 }
1088 1244
1089 this.CreateBARef(section, sourceLineNumbers, node, baId, WixBalBootstrapperApplicationType.DotNetCoreHost); 1245 exePayloadRef = this.CreatePayloadGroupRef(section, sourceLineNumbers, node, "WixDotNetCoreBootstrapperApplicationHost", baId, WixBalBootstrapperApplicationType.DotNetCoreHost);
1090 1246
1091 if (alwaysInstallPrereqs) 1247 if (alwaysInstallPrereqs)
1092 { 1248 {
1093 section.AddSymbol(new WixMbaPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixMbaPrereqOptions")) 1249 section.AddSymbol(new WixPrereqOptionsSymbol(sourceLineNumbers, new Identifier(AccessModifier.Global, "WixPrereqOptions"))
1094 { 1250 {
1095 AlwaysInstallPrereqs = 1, 1251 AlwaysInstallPrereqs = 1,
1096 }); 1252 });
1097 } 1253 }
1098 } 1254 }
1255
1256 return exePayloadRef;
1257 }
1258#endif
1259
1260 private string CreatePayloadGroupRef(IntermediateSection section, SourceLineNumber sourceLineNumbers, XElement node, string basePayloadGroupId, bool platformSpecific)
1261 {
1262 var id = platformSpecific ? this.CreateIdentifierFromPlatform(sourceLineNumbers, node, basePayloadGroupId) : basePayloadGroupId;
1263
1264 if (!String.IsNullOrEmpty(id))
1265 {
1266 this.ParseHelper.CreateWixGroupSymbol(section, sourceLineNumbers, ComplexReferenceParentType.Container, BurnConstants.BurnUXContainerName, ComplexReferenceChildType.PayloadGroup, id);
1267
1268 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixBundlePayloadGroup, id);
1269 }
1270
1271 return id;
1099 } 1272 }
1100 1273
1101 private void CreateBARef(IntermediateSection section, SourceLineNumber sourceLineNumbers, XElement node, string name, WixBalBootstrapperApplicationType baType) 1274 private string CreateIdentifierFromPlatform(SourceLineNumber sourceLineNumbers, XElement node, string name)
1102 { 1275 {
1103 var id = this.ParseHelper.CreateIdentifierValueFromPlatform(name, this.Context.Platform, BurnPlatforms.X86 | BurnPlatforms.X64 | BurnPlatforms.ARM64); 1276 var id = this.ParseHelper.CreateIdentifierValueFromPlatform(name, this.Context.Platform, BurnPlatforms.X86 | BurnPlatforms.X64 | BurnPlatforms.ARM64);
1104 if (id == null) 1277 if (id == null)
@@ -1106,15 +1279,7 @@ namespace WixToolset.Bal
1106 this.Messaging.Write(ErrorMessages.UnsupportedPlatformForElement(sourceLineNumbers, this.Context.Platform.ToString(), node.Name.LocalName)); 1279 this.Messaging.Write(ErrorMessages.UnsupportedPlatformForElement(sourceLineNumbers, this.Context.Platform.ToString(), node.Name.LocalName));
1107 } 1280 }
1108 1281
1109 if (!this.Messaging.EncounteredError) 1282 return id;
1110 {
1111 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixBootstrapperApplication, id);
1112
1113 section.AddSymbol(new WixBalBootstrapperApplicationSymbol(sourceLineNumbers)
1114 {
1115 Type = baType,
1116 });
1117 }
1118 } 1283 }
1119 } 1284 }
1120} 1285}