diff options
Diffstat (limited to 'src/ext/Bal/wixext/BalBurnBackendExtension.cs')
-rw-r--r-- | src/ext/Bal/wixext/BalBurnBackendExtension.cs | 74 |
1 files changed, 15 insertions, 59 deletions
diff --git a/src/ext/Bal/wixext/BalBurnBackendExtension.cs b/src/ext/Bal/wixext/BalBurnBackendExtension.cs index 0293b236..84e4323e 100644 --- a/src/ext/Bal/wixext/BalBurnBackendExtension.cs +++ b/src/ext/Bal/wixext/BalBurnBackendExtension.cs | |||
@@ -18,16 +18,17 @@ namespace WixToolset.Bal | |||
18 | { | 18 | { |
19 | private static readonly IntermediateSymbolDefinition[] BurnSymbolDefinitions = | 19 | private static readonly IntermediateSymbolDefinition[] BurnSymbolDefinitions = |
20 | { | 20 | { |
21 | #pragma warning disable 0612 // obsolete | ||
21 | BalSymbolDefinitions.WixBalBAFactoryAssembly, | 22 | BalSymbolDefinitions.WixBalBAFactoryAssembly, |
23 | #pragma warning restore 0612 | ||
22 | BalSymbolDefinitions.WixBalBAFunctions, | 24 | BalSymbolDefinitions.WixBalBAFunctions, |
23 | BalSymbolDefinitions.WixBalCondition, | 25 | BalSymbolDefinitions.WixBalCondition, |
24 | BalSymbolDefinitions.WixBalPackageInfo, | 26 | BalSymbolDefinitions.WixBalPackageInfo, |
25 | BalSymbolDefinitions.WixDncOptions, | 27 | BalSymbolDefinitions.WixPrereqInformation, |
26 | BalSymbolDefinitions.WixMbaPrereqInformation, | ||
27 | BalSymbolDefinitions.WixStdbaCommandLine, | 28 | BalSymbolDefinitions.WixStdbaCommandLine, |
28 | BalSymbolDefinitions.WixStdbaOptions, | 29 | BalSymbolDefinitions.WixStdbaOptions, |
29 | BalSymbolDefinitions.WixStdbaOverridableVariable, | 30 | BalSymbolDefinitions.WixStdbaOverridableVariable, |
30 | BalSymbolDefinitions.WixMbaPrereqOptions, | 31 | BalSymbolDefinitions.WixPrereqOptions, |
31 | }; | 32 | }; |
32 | 33 | ||
33 | protected override IReadOnlyCollection<IntermediateSymbolDefinition> SymbolDefinitions => BurnSymbolDefinitions; | 34 | protected override IReadOnlyCollection<IntermediateSymbolDefinition> SymbolDefinitions => BurnSymbolDefinitions; |
@@ -112,59 +113,28 @@ namespace WixToolset.Bal | |||
112 | } | 113 | } |
113 | 114 | ||
114 | var isIuiBA = balBaSymbol.Type == WixBalBootstrapperApplicationType.InternalUi; | 115 | var isIuiBA = balBaSymbol.Type == WixBalBootstrapperApplicationType.InternalUi; |
116 | var isPreqBA = balBaSymbol.Type == WixBalBootstrapperApplicationType.Prerequisite; | ||
115 | var isStdBA = balBaSymbol.Type == WixBalBootstrapperApplicationType.Standard; | 117 | var isStdBA = balBaSymbol.Type == WixBalBootstrapperApplicationType.Standard; |
116 | var isMBA = balBaSymbol.Type == WixBalBootstrapperApplicationType.ManagedHost; | ||
117 | var isDNC = balBaSymbol.Type == WixBalBootstrapperApplicationType.DotNetCoreHost; | ||
118 | var isSCD = isDNC && this.VerifySCD(section); | ||
119 | 118 | ||
120 | 119 | if (!isIuiBA && !isPreqBA && !isStdBA) | |
121 | if (!isIuiBA && !isStdBA && !isMBA && !isDNC) | ||
122 | { | 120 | { |
123 | throw new WixException($"Invalid WixBalBootstrapperApplicationType: '{balBaSymbol.Type}'"); | 121 | throw new WixException($"Invalid WixBalBootstrapperApplicationType: '{balBaSymbol.Type}'"); |
124 | } | 122 | } |
125 | 123 | ||
124 | this.VerifyBAFunctions(section); | ||
125 | |||
126 | if (isIuiBA) | 126 | if (isIuiBA) |
127 | { | 127 | { |
128 | // This needs to happen before VerifyPrereqPackages because it can add prereq packages. | 128 | // This needs to happen before VerifyPrereqPackages because it can add prereq packages. |
129 | this.VerifyPrimaryPackages(section, balBaSymbol.SourceLineNumbers); | 129 | this.VerifyPrimaryPackages(section, balBaSymbol.SourceLineNumbers); |
130 | } | 130 | } |
131 | 131 | ||
132 | if (isDNC) | 132 | if (isIuiBA || isPreqBA) |
133 | { | 133 | { |
134 | this.FinalizeBAFactorySymbol(section, balBaSymbol.SourceLineNumbers); | 134 | this.VerifyPrereqPackages(section, balBaSymbol.SourceLineNumbers, isIuiBA); |
135 | } | ||
136 | |||
137 | if (isIuiBA || isStdBA || isMBA || isDNC) | ||
138 | { | ||
139 | this.VerifyBAFunctions(section); | ||
140 | } | ||
141 | |||
142 | if (isIuiBA || isMBA || (isDNC && !isSCD)) | ||
143 | { | ||
144 | this.VerifyPrereqPackages(section, balBaSymbol.SourceLineNumbers, isDNC, isIuiBA); | ||
145 | } | 135 | } |
146 | } | 136 | } |
147 | 137 | ||
148 | private void FinalizeBAFactorySymbol(IntermediateSection section, SourceLineNumber baSourceLineNumbers) | ||
149 | { | ||
150 | var factorySymbol = section.Symbols.OfType<WixBalBAFactoryAssemblySymbol>().SingleOrDefault(); | ||
151 | if (null == factorySymbol) | ||
152 | { | ||
153 | this.Messaging.Write(BalErrors.MissingDNCBAFactoryAssembly(baSourceLineNumbers)); | ||
154 | return; | ||
155 | } | ||
156 | |||
157 | var factoryPayloadSymbol = section.Symbols.OfType<WixBundlePayloadSymbol>() | ||
158 | .Where(p => p.Id.Id == factorySymbol.PayloadId) | ||
159 | .SingleOrDefault(); | ||
160 | if (null == factoryPayloadSymbol) | ||
161 | { | ||
162 | throw new WixException($"Missing payload symbol with id: 'factorySymbol.PayloadId'"); | ||
163 | } | ||
164 | |||
165 | factorySymbol.FilePath = factoryPayloadSymbol.Name; | ||
166 | } | ||
167 | |||
168 | private void VerifyBAFunctions(IntermediateSection section) | 138 | private void VerifyBAFunctions(IntermediateSection section) |
169 | { | 139 | { |
170 | WixBalBAFunctionsSymbol baFunctionsSymbol = null; | 140 | WixBalBAFunctionsSymbol baFunctionsSymbol = null; |
@@ -234,7 +204,7 @@ namespace WixToolset.Bal | |||
234 | var nonPermanentNonPrimaryPackages = new List<WixBundlePackageSymbol>(); | 204 | var nonPermanentNonPrimaryPackages = new List<WixBundlePackageSymbol>(); |
235 | 205 | ||
236 | var balPackageInfoSymbolsByPackageId = section.Symbols.OfType<WixBalPackageInfoSymbol>().ToDictionary(x => x.PackageId); | 206 | var balPackageInfoSymbolsByPackageId = section.Symbols.OfType<WixBalPackageInfoSymbol>().ToDictionary(x => x.PackageId); |
237 | var mbaPrereqInfoSymbolsByPackageId = section.Symbols.OfType<WixMbaPrereqInformationSymbol>().ToDictionary(x => x.PackageId); | 207 | var mbaPrereqInfoSymbolsByPackageId = section.Symbols.OfType<WixPrereqInformationSymbol>().ToDictionary(x => x.PackageId); |
238 | var msiPackageSymbolsByPackageId = section.Symbols.OfType<WixBundleMsiPackageSymbol>().ToDictionary(x => x.Id.Id); | 208 | var msiPackageSymbolsByPackageId = section.Symbols.OfType<WixBundleMsiPackageSymbol>().ToDictionary(x => x.Id.Id); |
239 | var packageSymbols = section.Symbols.OfType<WixBundlePackageSymbol>().ToList(); | 209 | var packageSymbols = section.Symbols.OfType<WixBundlePackageSymbol>().ToList(); |
240 | foreach (var packageSymbol in packageSymbols) | 210 | foreach (var packageSymbol in packageSymbols) |
@@ -263,7 +233,7 @@ namespace WixToolset.Bal | |||
263 | { | 233 | { |
264 | if (!isPrereq) | 234 | if (!isPrereq) |
265 | { | 235 | { |
266 | var prereqInfoSymbol = section.AddSymbol(new WixMbaPrereqInformationSymbol(packageSymbol.SourceLineNumbers, new Identifier(AccessModifier.Global, packageId)) | 236 | var prereqInfoSymbol = section.AddSymbol(new WixPrereqInformationSymbol(packageSymbol.SourceLineNumbers, new Identifier(AccessModifier.Global, packageId)) |
267 | { | 237 | { |
268 | PackageId = packageId, | 238 | PackageId = packageId, |
269 | }); | 239 | }); |
@@ -476,13 +446,12 @@ namespace WixToolset.Bal | |||
476 | } | 446 | } |
477 | } | 447 | } |
478 | 448 | ||
479 | private void VerifyPrereqPackages(IntermediateSection section, SourceLineNumber baSourceLineNumbers, bool isDNC, bool isIuiBA) | 449 | private void VerifyPrereqPackages(IntermediateSection section, SourceLineNumber baSourceLineNumbers, bool isIuiBA) |
480 | { | 450 | { |
481 | var prereqInfoSymbols = section.Symbols.OfType<WixMbaPrereqInformationSymbol>().ToList(); | 451 | var prereqInfoSymbols = section.Symbols.OfType<WixPrereqInformationSymbol>().ToList(); |
482 | if (!isIuiBA && prereqInfoSymbols.Count == 0) | 452 | if (!isIuiBA && prereqInfoSymbols.Count == 0) |
483 | { | 453 | { |
484 | var message = isDNC ? BalErrors.MissingDNCPrereq(baSourceLineNumbers) : BalErrors.MissingMBAPrereq(baSourceLineNumbers); | 454 | this.Messaging.Write(BalErrors.MissingPrereq(baSourceLineNumbers)); |
485 | this.Messaging.Write(message); | ||
486 | return; | 455 | return; |
487 | } | 456 | } |
488 | 457 | ||
@@ -514,18 +483,5 @@ namespace WixToolset.Bal | |||
514 | } | 483 | } |
515 | } | 484 | } |
516 | } | 485 | } |
517 | |||
518 | private bool VerifySCD(IntermediateSection section) | ||
519 | { | ||
520 | var isSCD = false; | ||
521 | |||
522 | var dncOptions = section.Symbols.OfType<WixDncOptionsSymbol>().SingleOrDefault(); | ||
523 | if (dncOptions != null) | ||
524 | { | ||
525 | isSCD = dncOptions.SelfContainedDeployment != 0; | ||
526 | } | ||
527 | |||
528 | return isSCD; | ||
529 | } | ||
530 | } | 486 | } |
531 | } | 487 | } |