diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.Core/Compiler_Bundle.cs | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index 976139ca..ec377a46 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs | |||
| @@ -652,8 +652,8 @@ namespace WixToolset.Core | |||
| 652 | var dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2; | 652 | var dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2; |
| 653 | 653 | ||
| 654 | // The BootstrapperApplication element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry. | 654 | // The BootstrapperApplication element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry. |
| 655 | var id = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false); | 655 | var hasSourceFile = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false, out var id); |
| 656 | if (null != id) | 656 | if (hasSourceFile) |
| 657 | { | 657 | { |
| 658 | previousId = id; | 658 | previousId = id; |
| 659 | previousType = ComplexReferenceChildType.Payload; | 659 | previousType = ComplexReferenceChildType.Payload; |
| @@ -726,7 +726,7 @@ namespace WixToolset.Core | |||
| 726 | this.Core.Write(ErrorMessages.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "Payload")); | 726 | this.Core.Write(ErrorMessages.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "Payload")); |
| 727 | } | 727 | } |
| 728 | 728 | ||
| 729 | // Add the application as an attached container and if an Id was provided add that too. | 729 | // Add the application as an attached container and if a SourceFile was provided add the Id as the BA. |
| 730 | if (!this.Core.EncounteredError) | 730 | if (!this.Core.EncounteredError) |
| 731 | { | 731 | { |
| 732 | this.Core.AddSymbol(new WixBundleContainerSymbol(sourceLineNumbers, Compiler.BurnUXContainerId) | 732 | this.Core.AddSymbol(new WixBundleContainerSymbol(sourceLineNumbers, Compiler.BurnUXContainerId) |
| @@ -735,7 +735,7 @@ namespace WixToolset.Core | |||
| 735 | Type = ContainerType.Attached | 735 | Type = ContainerType.Attached |
| 736 | }); | 736 | }); |
| 737 | 737 | ||
| 738 | if (null != id) | 738 | if (hasSourceFile) |
| 739 | { | 739 | { |
| 740 | this.Core.AddSymbol(new WixBootstrapperApplicationSymbol(sourceLineNumbers, id) | 740 | this.Core.AddSymbol(new WixBootstrapperApplicationSymbol(sourceLineNumbers, id) |
| 741 | { | 741 | { |
| @@ -1122,8 +1122,7 @@ namespace WixToolset.Core | |||
| 1122 | var previousType = ComplexReferenceChildType.Unknown; | 1122 | var previousType = ComplexReferenceChildType.Unknown; |
| 1123 | 1123 | ||
| 1124 | // The BundleExtension element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry. | 1124 | // The BundleExtension element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry. |
| 1125 | var id = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false); | 1125 | if (this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false, out var id)) |
| 1126 | if (null != id) | ||
| 1127 | { | 1126 | { |
| 1128 | previousId = id; | 1127 | previousId = id; |
| 1129 | previousType = ComplexReferenceChildType.Payload; | 1128 | previousType = ComplexReferenceChildType.Payload; |
| @@ -1290,7 +1289,7 @@ namespace WixToolset.Core | |||
| 1290 | Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); | 1289 | Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); |
| 1291 | Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PayloadGroup == previousType || ComplexReferenceChildType.Payload == previousType); | 1290 | Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PayloadGroup == previousType || ComplexReferenceChildType.Payload == previousType); |
| 1292 | 1291 | ||
| 1293 | var id = this.ParsePayloadElementContent(node, parentType, parentId, previousType, previousId, true); | 1292 | this.ParsePayloadElementContent(node, parentType, parentId, previousType, previousId, true, out var id); |
| 1294 | var context = new Dictionary<string, string> | 1293 | var context = new Dictionary<string, string> |
| 1295 | { | 1294 | { |
| 1296 | ["Id"] = id?.Id | 1295 | ["Id"] = id?.Id |
| @@ -1322,14 +1321,15 @@ namespace WixToolset.Core | |||
| 1322 | /// <param name="node">Element to parse</param> | 1321 | /// <param name="node">Element to parse</param> |
| 1323 | /// <param name="parentType">ComplexReferenceParentType of parent element.</param> | 1322 | /// <param name="parentType">ComplexReferenceParentType of parent element.</param> |
| 1324 | /// <param name="parentId">Identifier of parent element.</param> | 1323 | /// <param name="parentId">Identifier of parent element.</param> |
| 1325 | private Identifier ParsePayloadElementContent(XElement node, ComplexReferenceParentType parentType, Identifier parentId, ComplexReferenceChildType previousType, Identifier previousId, bool required) | 1324 | /// <returns>Whether SourceFile was specified.</returns> |
| 1325 | private bool ParsePayloadElementContent(XElement node, ComplexReferenceParentType parentType, Identifier parentId, ComplexReferenceChildType previousType, Identifier previousId, bool required, out Identifier id) | ||
| 1326 | { | 1326 | { |
| 1327 | Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); | 1327 | Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); |
| 1328 | 1328 | ||
| 1329 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 1329 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); |
| 1330 | var compressed = YesNoDefaultType.Default; | 1330 | var compressed = YesNoDefaultType.Default; |
| 1331 | var enableSignatureVerification = YesNoType.No; | 1331 | var enableSignatureVerification = YesNoType.No; |
| 1332 | Identifier id = null; | 1332 | id = null; |
| 1333 | string name = null; | 1333 | string name = null; |
| 1334 | string sourceFile = null; | 1334 | string sourceFile = null; |
| 1335 | string downloadUrl = null; | 1335 | string downloadUrl = null; |
| @@ -1379,12 +1379,6 @@ namespace WixToolset.Core | |||
| 1379 | } | 1379 | } |
| 1380 | } | 1380 | } |
| 1381 | 1381 | ||
| 1382 | if (!required && null == sourceFile) | ||
| 1383 | { | ||
| 1384 | // Nothing left to do! | ||
| 1385 | return null; | ||
| 1386 | } | ||
| 1387 | |||
| 1388 | if (null == id) | 1382 | if (null == id) |
| 1389 | { | 1383 | { |
| 1390 | id = this.Core.CreateIdentifier("pay", sourceFile?.ToUpperInvariant() ?? String.Empty); | 1384 | id = this.Core.CreateIdentifier("pay", sourceFile?.ToUpperInvariant() ?? String.Empty); |
| @@ -1393,7 +1387,7 @@ namespace WixToolset.Core | |||
| 1393 | // Now that the PayloadId is known, we can parse the extension attributes. | 1387 | // Now that the PayloadId is known, we can parse the extension attributes. |
| 1394 | var context = new Dictionary<string, string> | 1388 | var context = new Dictionary<string, string> |
| 1395 | { | 1389 | { |
| 1396 | ["Id"] = id?.Id | 1390 | ["Id"] = id.Id |
| 1397 | }; | 1391 | }; |
| 1398 | 1392 | ||
| 1399 | foreach (var extensionAttribute in extensionAttributes) | 1393 | foreach (var extensionAttribute in extensionAttributes) |
| @@ -1403,11 +1397,6 @@ namespace WixToolset.Core | |||
| 1403 | 1397 | ||
| 1404 | // Let caller handle the children. | 1398 | // Let caller handle the children. |
| 1405 | 1399 | ||
| 1406 | if (null == sourceFile) | ||
| 1407 | { | ||
| 1408 | sourceFile = String.Empty; | ||
| 1409 | } | ||
| 1410 | |||
| 1411 | if (Compiler.BurnUXContainerId == parentId) | 1400 | if (Compiler.BurnUXContainerId == parentId) |
| 1412 | { | 1401 | { |
| 1413 | if (compressed == YesNoDefaultType.No) | 1402 | if (compressed == YesNoDefaultType.No) |
| @@ -1418,9 +1407,18 @@ namespace WixToolset.Core | |||
| 1418 | compressed = YesNoDefaultType.Yes; | 1407 | compressed = YesNoDefaultType.Yes; |
| 1419 | } | 1408 | } |
| 1420 | 1409 | ||
| 1410 | if (sourceFile == null) | ||
| 1411 | { | ||
| 1412 | if (required) | ||
| 1413 | { | ||
| 1414 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); | ||
| 1415 | } | ||
| 1416 | return false; | ||
| 1417 | } | ||
| 1418 | |||
| 1421 | this.CreatePayloadRow(sourceLineNumbers, id, name, sourceFile, downloadUrl, parentType, parentId, previousType, previousId, compressed, enableSignatureVerification, null, null, null); | 1419 | this.CreatePayloadRow(sourceLineNumbers, id, name, sourceFile, downloadUrl, parentType, parentId, previousType, previousId, compressed, enableSignatureVerification, null, null, null); |
| 1422 | 1420 | ||
| 1423 | return id; | 1421 | return true; |
| 1424 | } | 1422 | } |
| 1425 | 1423 | ||
| 1426 | private RemotePayload ParseRemotePayloadElement(XElement node) | 1424 | private RemotePayload ParseRemotePayloadElement(XElement node) |
