diff options
Diffstat (limited to 'src/WixToolset.Core/Compiler_Bundle.cs')
| -rw-r--r-- | src/WixToolset.Core/Compiler_Bundle.cs | 467 |
1 files changed, 264 insertions, 203 deletions
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index 21028b6f..2ec66333 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs | |||
| @@ -17,9 +17,10 @@ namespace WixToolset.Core | |||
| 17 | /// </summary> | 17 | /// </summary> |
| 18 | internal partial class Compiler : ICompiler | 18 | internal partial class Compiler : ICompiler |
| 19 | { | 19 | { |
| 20 | public const string BurnUXContainerId = "WixUXContainer"; | 20 | public static readonly Identifier BurnUXContainerId = new Identifier(AccessModifier.Private, "WixUXContainer"); |
| 21 | public const string BurnDefaultAttachedContainerId = "WixAttachedContainer"; | 21 | public static readonly Identifier BurnDefaultAttachedContainerId = new Identifier(AccessModifier.Private, "WixAttachedContainer"); |
| 22 | 22 | public static readonly Identifier BundleLayoutOnlyPayloads = new Identifier(AccessModifier.Private, "BundleLayoutOnlyPayloads"); | |
| 23 | |||
| 23 | // The following constants must stay in sync with src\burn\engine\core.h | 24 | // The following constants must stay in sync with src\burn\engine\core.h |
| 24 | private const string BURN_BUNDLE_NAME = "WixBundleName"; | 25 | private const string BURN_BUNDLE_NAME = "WixBundleName"; |
| 25 | private const string BURN_BUNDLE_ORIGINAL_SOURCE = "WixBundleOriginalSource"; | 26 | private const string BURN_BUNDLE_ORIGINAL_SOURCE = "WixBundleOriginalSource"; |
| @@ -88,10 +89,14 @@ namespace WixToolset.Core | |||
| 88 | 89 | ||
| 89 | if (!this.Core.EncounteredError) | 90 | if (!this.Core.EncounteredError) |
| 90 | { | 91 | { |
| 91 | var wixApprovedExeForElevationRow = (WixApprovedExeForElevationTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixApprovedExeForElevation, id); | 92 | var tuple = new WixApprovedExeForElevationTuple(sourceLineNumbers, id) |
| 92 | wixApprovedExeForElevationRow.Key = key; | 93 | { |
| 93 | wixApprovedExeForElevationRow.Value = valueName; | 94 | Key = key, |
| 94 | wixApprovedExeForElevationRow.Attributes = (int)attributes; | 95 | Value = valueName, |
| 96 | Attributes = attributes | ||
| 97 | }; | ||
| 98 | |||
| 99 | this.Core.AddTuple(tuple); | ||
| 95 | } | 100 | } |
| 96 | } | 101 | } |
| 97 | 102 | ||
| @@ -311,10 +316,10 @@ namespace WixToolset.Core | |||
| 311 | logSeen = true; | 316 | logSeen = true; |
| 312 | break; | 317 | break; |
| 313 | case "PayloadGroup": | 318 | case "PayloadGroup": |
| 314 | this.ParsePayloadGroupElement(child, ComplexReferenceParentType.Layout, "BundleLayoutOnlyPayloads"); | 319 | this.ParsePayloadGroupElement(child, ComplexReferenceParentType.Layout, Compiler.BundleLayoutOnlyPayloads); |
| 315 | break; | 320 | break; |
| 316 | case "PayloadGroupRef": | 321 | case "PayloadGroupRef": |
| 317 | this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Layout, "BundleLayoutOnlyPayloads", ComplexReferenceChildType.Unknown, null); | 322 | this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Layout, Compiler.BundleLayoutOnlyPayloads, ComplexReferenceChildType.Unknown, null); |
| 318 | break; | 323 | break; |
| 319 | case "RelatedBundle": | 324 | case "RelatedBundle": |
| 320 | this.ParseRelatedBundleElement(child); | 325 | this.ParseRelatedBundleElement(child); |
| @@ -348,72 +353,75 @@ namespace WixToolset.Core | |||
| 348 | { | 353 | { |
| 349 | if (null != upgradeCode) | 354 | if (null != upgradeCode) |
| 350 | { | 355 | { |
| 351 | var tuple = new WixRelatedBundleTuple(sourceLineNumbers) | 356 | this.Core.AddTuple(new WixRelatedBundleTuple(sourceLineNumbers) |
| 352 | { | 357 | { |
| 353 | BundleId = upgradeCode, | 358 | BundleId = upgradeCode, |
| 354 | Action = RelatedBundleActionType.Upgrade, | 359 | Action = RelatedBundleActionType.Upgrade, |
| 355 | }; | 360 | }); |
| 356 | |||
| 357 | this.Core.AddTuple(tuple); | ||
| 358 | } | 361 | } |
| 359 | 362 | ||
| 360 | var containerRow = (WixBundleContainerTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleContainer); | 363 | this.Core.AddTuple(new WixBundleContainerTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, Compiler.BurnDefaultAttachedContainerId)) |
| 361 | containerRow.WixBundleContainer = Compiler.BurnDefaultAttachedContainerId; | 364 | { |
| 362 | containerRow.Name = "bundle-attached.cab"; | 365 | Name = "bundle-attached.cab", |
| 363 | containerRow.Type = ContainerType.Attached; | 366 | Type = ContainerType.Attached |
| 367 | }); | ||
| 364 | 368 | ||
| 365 | var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundle); | 369 | var bundleTuple = this.Core.CreateTuple(sourceLineNumbers, TupleDefinitionType.WixBundle); |
| 366 | row.Set(0, version); | 370 | bundleTuple.Set(0, version); |
| 367 | row.Set(1, copyright); | 371 | bundleTuple.Set(1, copyright); |
| 368 | row.Set(2, name); | 372 | bundleTuple.Set(2, name); |
| 369 | row.Set(3, aboutUrl); | 373 | bundleTuple.Set(3, aboutUrl); |
| 370 | if (-1 != disableModify) | 374 | if (-1 != disableModify) |
| 371 | { | 375 | { |
| 372 | row.Set(4, disableModify); | 376 | bundleTuple.Set(4, disableModify); |
| 373 | } | 377 | } |
| 374 | if (YesNoType.NotSet != disableRemove) | 378 | if (YesNoType.NotSet != disableRemove) |
| 375 | { | 379 | { |
| 376 | row.Set(5, (YesNoType.Yes == disableRemove) ? 1 : 0); | 380 | bundleTuple.Set(5, (YesNoType.Yes == disableRemove) ? 1 : 0); |
| 377 | } | 381 | } |
| 378 | // row.Set(6] - (deprecated) "disable repair" | 382 | // row.Set(6] - (deprecated) "disable repair" |
| 379 | row.Set(7, helpTelephone); | 383 | bundleTuple.Set(7, helpTelephone); |
| 380 | row.Set(8, helpUrl); | 384 | bundleTuple.Set(8, helpUrl); |
| 381 | row.Set(9, manufacturer); | 385 | bundleTuple.Set(9, manufacturer); |
| 382 | row.Set(10, updateUrl); | 386 | bundleTuple.Set(10, updateUrl); |
| 383 | if (YesNoDefaultType.Default != compressed) | 387 | if (YesNoDefaultType.Default != compressed) |
| 384 | { | 388 | { |
| 385 | row.Set(11, (YesNoDefaultType.Yes == compressed) ? 1 : 0); | 389 | bundleTuple.Set(11, (YesNoDefaultType.Yes == compressed) ? 1 : 0); |
| 386 | } | 390 | } |
| 387 | 391 | ||
| 388 | row.Set(12, logVariablePrefixAndExtension); | 392 | bundleTuple.Set(12, logVariablePrefixAndExtension); |
| 389 | row.Set(13, iconSourceFile); | 393 | bundleTuple.Set(13, iconSourceFile); |
| 390 | row.Set(14, splashScreenSourceFile); | 394 | bundleTuple.Set(14, splashScreenSourceFile); |
| 391 | row.Set(15, condition); | 395 | bundleTuple.Set(15, condition); |
| 392 | row.Set(16, tag); | 396 | bundleTuple.Set(16, tag); |
| 393 | row.Set(17, this.CurrentPlatform.ToString()); | 397 | bundleTuple.Set(17, this.CurrentPlatform.ToString()); |
| 394 | row.Set(18, parentName); | 398 | bundleTuple.Set(18, parentName); |
| 395 | row.Set(19, upgradeCode); | 399 | bundleTuple.Set(19, upgradeCode); |
| 396 | 400 | ||
| 397 | // Ensure that the bundle stores the well-known persisted values. | 401 | // Ensure that the bundle stores the well-known persisted values. |
| 398 | var bundleNameWellKnownVariable = (WixBundleVariableTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleVariable); | 402 | this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, Compiler.BURN_BUNDLE_NAME)) |
| 399 | bundleNameWellKnownVariable.WixBundleVariable = Compiler.BURN_BUNDLE_NAME; | 403 | { |
| 400 | bundleNameWellKnownVariable.Hidden = false; | 404 | Hidden = false, |
| 401 | bundleNameWellKnownVariable.Persisted = true; | 405 | Persisted = true |
| 402 | 406 | }); | |
| 403 | var bundleOriginalSourceWellKnownVariable = (WixBundleVariableTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleVariable); | 407 | |
| 404 | bundleOriginalSourceWellKnownVariable.WixBundleVariable = Compiler.BURN_BUNDLE_ORIGINAL_SOURCE; | 408 | this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, Compiler.BURN_BUNDLE_ORIGINAL_SOURCE)) |
| 405 | bundleOriginalSourceWellKnownVariable.Hidden = false; | 409 | { |
| 406 | bundleOriginalSourceWellKnownVariable.Persisted = true; | 410 | Hidden = false, |
| 407 | 411 | Persisted = true | |
| 408 | var bundleOriginalSourceFolderWellKnownVariable = (WixBundleVariableTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleVariable); | 412 | }); |
| 409 | bundleOriginalSourceFolderWellKnownVariable.WixBundleVariable = Compiler.BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER; | 413 | |
| 410 | bundleOriginalSourceFolderWellKnownVariable.Hidden = false; | 414 | this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, Compiler.BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER)) |
| 411 | bundleOriginalSourceFolderWellKnownVariable.Persisted = true; | 415 | { |
| 412 | 416 | Hidden = false, | |
| 413 | var bundleLastUsedSourceWellKnownVariable = (WixBundleVariableTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleVariable); | 417 | Persisted = true |
| 414 | bundleLastUsedSourceWellKnownVariable.WixBundleVariable = Compiler.BURN_BUNDLE_LAST_USED_SOURCE; | 418 | }); |
| 415 | bundleLastUsedSourceWellKnownVariable.Hidden = false; | 419 | |
| 416 | bundleLastUsedSourceWellKnownVariable.Persisted = true; | 420 | this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, Compiler.BURN_BUNDLE_LAST_USED_SOURCE)) |
| 421 | { | ||
| 422 | Hidden = false, | ||
| 423 | Persisted = true | ||
| 424 | }); | ||
| 417 | } | 425 | } |
| 418 | } | 426 | } |
| 419 | 427 | ||
| @@ -514,8 +522,10 @@ namespace WixToolset.Core | |||
| 514 | { | 522 | { |
| 515 | this.CreatePayloadRow(sourceLineNumbers, id, Path.GetFileName(sourceFile), sourceFile, null, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, ComplexReferenceChildType.Unknown, null, YesNoDefaultType.Yes, YesNoType.Yes, null, null, null); | 523 | this.CreatePayloadRow(sourceLineNumbers, id, Path.GetFileName(sourceFile), sourceFile, null, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, ComplexReferenceChildType.Unknown, null, YesNoDefaultType.Yes, YesNoType.Yes, null, null, null); |
| 516 | 524 | ||
| 517 | var wixCatalogRow = (WixBundleCatalogTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleCatalog, id); | 525 | this.Core.AddTuple(new WixBundleCatalogTuple(sourceLineNumbers, id) |
| 518 | wixCatalogRow.Payload_ = id.Id; | 526 | { |
| 527 | Payload_ = id.Id, | ||
| 528 | }); | ||
| 519 | } | 529 | } |
| 520 | } | 530 | } |
| 521 | 531 | ||
| @@ -614,10 +624,12 @@ namespace WixToolset.Core | |||
| 614 | 624 | ||
| 615 | if (!this.Core.EncounteredError) | 625 | if (!this.Core.EncounteredError) |
| 616 | { | 626 | { |
| 617 | var row = (WixBundleContainerTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleContainer, id); | 627 | this.Core.AddTuple(new WixBundleContainerTuple(sourceLineNumbers, id) |
| 618 | row.Name = name; | 628 | { |
| 619 | row.Type = type; | 629 | Name = name, |
| 620 | row.DownloadUrl = downloadUrl; | 630 | Type = type, |
| 631 | DownloadUrl = downloadUrl | ||
| 632 | }); | ||
| 621 | } | 633 | } |
| 622 | } | 634 | } |
| 623 | 635 | ||
| @@ -628,12 +640,11 @@ namespace WixToolset.Core | |||
| 628 | private void ParseBootstrapperApplicationElement(XElement node) | 640 | private void ParseBootstrapperApplicationElement(XElement node) |
| 629 | { | 641 | { |
| 630 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 642 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); |
| 631 | string id = null; | 643 | Identifier previousId = null; |
| 632 | string previousId = null; | ||
| 633 | var previousType = ComplexReferenceChildType.Unknown; | 644 | var previousType = ComplexReferenceChildType.Unknown; |
| 634 | 645 | ||
| 635 | // The BootstrapperApplication element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry. | 646 | // The BootstrapperApplication element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry. |
| 636 | id = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false); | 647 | var id = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false); |
| 637 | if (null != id) | 648 | if (null != id) |
| 638 | { | 649 | { |
| 639 | previousId = id; | 650 | previousId = id; |
| @@ -676,15 +687,15 @@ namespace WixToolset.Core | |||
| 676 | // Add the application as an attached container and if an Id was provided add that too. | 687 | // Add the application as an attached container and if an Id was provided add that too. |
| 677 | if (!this.Core.EncounteredError) | 688 | if (!this.Core.EncounteredError) |
| 678 | { | 689 | { |
| 679 | var containerRow = (WixBundleContainerTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleContainer); | 690 | this.Core.AddTuple(new WixBundleContainerTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, Compiler.BurnUXContainerId)) |
| 680 | containerRow.WixBundleContainer = Compiler.BurnUXContainerId; | 691 | { |
| 681 | containerRow.Name = "bundle-ux.cab"; | 692 | Name = "bundle-ux.cab", |
| 682 | containerRow.Type = ContainerType.Attached; | 693 | Type = ContainerType.Attached |
| 694 | }); | ||
| 683 | 695 | ||
| 684 | if (!String.IsNullOrEmpty(id)) | 696 | if (null != id) |
| 685 | { | 697 | { |
| 686 | var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBootstrapperApplication); | 698 | this.Core.AddTuple(new WixBootstrapperApplicationTuple(sourceLineNumbers, id)); |
| 687 | row.Set(0, id); | ||
| 688 | } | 699 | } |
| 689 | } | 700 | } |
| 690 | } | 701 | } |
| @@ -697,7 +708,7 @@ namespace WixToolset.Core | |||
| 697 | { | 708 | { |
| 698 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 709 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); |
| 699 | string id = null; | 710 | string id = null; |
| 700 | string previousId = null; | 711 | Identifier previousId = null; |
| 701 | var previousType = ComplexReferenceChildType.Unknown; | 712 | var previousType = ComplexReferenceChildType.Unknown; |
| 702 | 713 | ||
| 703 | foreach (var attrib in node.Attributes()) | 714 | foreach (var attrib in node.Attributes()) |
| @@ -847,12 +858,14 @@ namespace WixToolset.Core | |||
| 847 | 858 | ||
| 848 | if (!this.Core.EncounteredError) | 859 | if (!this.Core.EncounteredError) |
| 849 | { | 860 | { |
| 850 | var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixUpdateRegistration); | 861 | this.Core.AddTuple(new WixUpdateRegistrationTuple(sourceLineNumbers) |
| 851 | row.Set(0, manufacturer); | 862 | { |
| 852 | row.Set(1, department); | 863 | Manufacturer = manufacturer, |
| 853 | row.Set(2, productFamily); | 864 | Department = department, |
| 854 | row.Set(3, name); | 865 | ProductFamily = productFamily, |
| 855 | row.Set(4, classification); | 866 | Name = name, |
| 867 | Classification = classification | ||
| 868 | }); | ||
| 856 | } | 869 | } |
| 857 | } | 870 | } |
| 858 | 871 | ||
| @@ -862,7 +875,7 @@ namespace WixToolset.Core | |||
| 862 | /// <param name="node">Element to parse</param> | 875 | /// <param name="node">Element to parse</param> |
| 863 | /// <param name="parentType">ComplexReferenceParentType of parent element. (BA or PayloadGroup)</param> | 876 | /// <param name="parentType">ComplexReferenceParentType of parent element. (BA or PayloadGroup)</param> |
| 864 | /// <param name="parentId">Identifier of parent element.</param> | 877 | /// <param name="parentId">Identifier of parent element.</param> |
| 865 | private string ParsePayloadElement(XElement node, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId) | 878 | private Identifier ParsePayloadElement(XElement node, ComplexReferenceParentType parentType, Identifier parentId, ComplexReferenceChildType previousType, Identifier previousId) |
| 866 | { | 879 | { |
| 867 | Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); | 880 | Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); |
| 868 | Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PayloadGroup == previousType || ComplexReferenceChildType.Payload == previousType); | 881 | Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PayloadGroup == previousType || ComplexReferenceChildType.Payload == previousType); |
| @@ -870,7 +883,7 @@ namespace WixToolset.Core | |||
| 870 | var id = this.ParsePayloadElementContent(node, parentType, parentId, previousType, previousId, true); | 883 | var id = this.ParsePayloadElementContent(node, parentType, parentId, previousType, previousId, true); |
| 871 | var context = new Dictionary<string, string> | 884 | var context = new Dictionary<string, string> |
| 872 | { | 885 | { |
| 873 | ["Id"] = id | 886 | ["Id"] = id.Id |
| 874 | }; | 887 | }; |
| 875 | 888 | ||
| 876 | foreach (var child in node.Elements()) | 889 | foreach (var child in node.Elements()) |
| @@ -899,7 +912,7 @@ namespace WixToolset.Core | |||
| 899 | /// <param name="node">Element to parse</param> | 912 | /// <param name="node">Element to parse</param> |
| 900 | /// <param name="parentType">ComplexReferenceParentType of parent element.</param> | 913 | /// <param name="parentType">ComplexReferenceParentType of parent element.</param> |
| 901 | /// <param name="parentId">Identifier of parent element.</param> | 914 | /// <param name="parentId">Identifier of parent element.</param> |
| 902 | private string ParsePayloadElementContent(XElement node, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId, bool required) | 915 | private Identifier ParsePayloadElementContent(XElement node, ComplexReferenceParentType parentType, Identifier parentId, ComplexReferenceChildType previousType, Identifier previousId, bool required) |
| 903 | { | 916 | { |
| 904 | Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); | 917 | Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); |
| 905 | 918 | ||
| @@ -959,7 +972,7 @@ namespace WixToolset.Core | |||
| 959 | 972 | ||
| 960 | if (null == id) | 973 | if (null == id) |
| 961 | { | 974 | { |
| 962 | id = this.Core.CreateIdentifier("pay", (null != sourceFile) ? sourceFile.ToUpperInvariant() : String.Empty); | 975 | id = this.Core.CreateIdentifier("pay", sourceFile?.ToUpperInvariant() ?? String.Empty); |
| 963 | } | 976 | } |
| 964 | 977 | ||
| 965 | // Now that the PayloadId is known, we can parse the extension attributes. | 978 | // Now that the PayloadId is known, we can parse the extension attributes. |
| @@ -1022,7 +1035,7 @@ namespace WixToolset.Core | |||
| 1022 | 1035 | ||
| 1023 | this.CreatePayloadRow(sourceLineNumbers, id, name, sourceFile, downloadUrl, parentType, parentId, previousType, previousId, compressed, enableSignatureVerification, null, null, remotePayload); | 1036 | this.CreatePayloadRow(sourceLineNumbers, id, name, sourceFile, downloadUrl, parentType, parentId, previousType, previousId, compressed, enableSignatureVerification, null, null, remotePayload); |
| 1024 | 1037 | ||
| 1025 | return id.Id; | 1038 | return id; |
| 1026 | } | 1039 | } |
| 1027 | 1040 | ||
| 1028 | private RemotePayload ParseRemotePayloadElement(XElement node) | 1041 | private RemotePayload ParseRemotePayloadElement(XElement node) |
| @@ -1103,38 +1116,42 @@ namespace WixToolset.Core | |||
| 1103 | /// <param name="parentType">ComplexReferenceParentType of parent element</param> | 1116 | /// <param name="parentType">ComplexReferenceParentType of parent element</param> |
| 1104 | /// <param name="parentId">Identifier of parent element.</param> | 1117 | /// <param name="parentId">Identifier of parent element.</param> |
| 1105 | private WixBundlePayloadTuple CreatePayloadRow(SourceLineNumber sourceLineNumbers, Identifier id, string name, string sourceFile, string downloadUrl, ComplexReferenceParentType parentType, | 1118 | private WixBundlePayloadTuple CreatePayloadRow(SourceLineNumber sourceLineNumbers, Identifier id, string name, string sourceFile, string downloadUrl, ComplexReferenceParentType parentType, |
| 1106 | string parentId, ComplexReferenceChildType previousType, string previousId, YesNoDefaultType compressed, YesNoType enableSignatureVerification, string displayName, string description, | 1119 | Identifier parentId, ComplexReferenceChildType previousType, Identifier previousId, YesNoDefaultType compressed, YesNoType enableSignatureVerification, string displayName, string description, |
| 1107 | RemotePayload remotePayload) | 1120 | RemotePayload remotePayload) |
| 1108 | { | 1121 | { |
| 1109 | WixBundlePayloadTuple row = null; | 1122 | WixBundlePayloadTuple tuple = null; |
| 1110 | 1123 | ||
| 1111 | if (!this.Core.EncounteredError) | 1124 | if (!this.Core.EncounteredError) |
| 1112 | { | 1125 | { |
| 1113 | row = (WixBundlePayloadTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePayload, id); | 1126 | tuple = new WixBundlePayloadTuple(sourceLineNumbers, id) |
| 1114 | row.Name = String.IsNullOrEmpty(name) ? Path.GetFileName(sourceFile) : name; | 1127 | { |
| 1115 | row.SourceFile = sourceFile; | 1128 | Name = String.IsNullOrEmpty(name) ? Path.GetFileName(sourceFile) : name, |
| 1116 | row.DownloadUrl = downloadUrl; | 1129 | SourceFile = sourceFile, |
| 1117 | row.Compressed = compressed; | 1130 | DownloadUrl = downloadUrl, |
| 1118 | row.UnresolvedSourceFile = sourceFile; // duplicate of sourceFile but in a string column so it won't get resolved to a full path during binding. | 1131 | Compressed = compressed, |
| 1119 | row.DisplayName = displayName; | 1132 | UnresolvedSourceFile = sourceFile, // duplicate of sourceFile but in a string column so it won't get resolved to a full path during binding. |
| 1120 | row.Description = description; | 1133 | DisplayName = displayName, |
| 1121 | row.EnableSignatureValidation = (YesNoType.Yes == enableSignatureVerification); | 1134 | Description = description, |
| 1135 | EnableSignatureValidation = (YesNoType.Yes == enableSignatureVerification) | ||
| 1136 | }; | ||
| 1122 | 1137 | ||
| 1123 | if (null != remotePayload) | 1138 | if (null != remotePayload) |
| 1124 | { | 1139 | { |
| 1125 | row.Description = remotePayload.Description; | 1140 | tuple.Description = remotePayload.Description; |
| 1126 | row.DisplayName = remotePayload.ProductName; | 1141 | tuple.DisplayName = remotePayload.ProductName; |
| 1127 | row.Hash = remotePayload.Hash; | 1142 | tuple.Hash = remotePayload.Hash; |
| 1128 | row.PublicKey = remotePayload.CertificatePublicKey; | 1143 | tuple.PublicKey = remotePayload.CertificatePublicKey; |
| 1129 | row.Thumbprint = remotePayload.CertificateThumbprint; | 1144 | tuple.Thumbprint = remotePayload.CertificateThumbprint; |
| 1130 | row.FileSize = remotePayload.Size; | 1145 | tuple.FileSize = remotePayload.Size; |
| 1131 | row.Version = remotePayload.Version; | 1146 | tuple.Version = remotePayload.Version; |
| 1132 | } | 1147 | } |
| 1133 | 1148 | ||
| 1134 | this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Payload, id.Id, previousType, previousId); | 1149 | this.Core.AddTuple(tuple); |
| 1150 | |||
| 1151 | this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId.Id, ComplexReferenceChildType.Payload, id.Id, previousType, previousId.Id); | ||
| 1135 | } | 1152 | } |
| 1136 | 1153 | ||
| 1137 | return row; | 1154 | return tuple; |
| 1138 | } | 1155 | } |
| 1139 | 1156 | ||
| 1140 | /// <summary> | 1157 | /// <summary> |
| @@ -1143,7 +1160,7 @@ namespace WixToolset.Core | |||
| 1143 | /// <param name="node">Element to parse</param> | 1160 | /// <param name="node">Element to parse</param> |
| 1144 | /// <param name="parentType">Optional ComplexReferenceParentType of parent element. (typically another PayloadGroup)</param> | 1161 | /// <param name="parentType">Optional ComplexReferenceParentType of parent element. (typically another PayloadGroup)</param> |
| 1145 | /// <param name="parentId">Identifier of parent element.</param> | 1162 | /// <param name="parentId">Identifier of parent element.</param> |
| 1146 | private void ParsePayloadGroupElement(XElement node, ComplexReferenceParentType parentType, string parentId) | 1163 | private void ParsePayloadGroupElement(XElement node, ComplexReferenceParentType parentType, Identifier parentId) |
| 1147 | { | 1164 | { |
| 1148 | Debug.Assert(ComplexReferenceParentType.Unknown == parentType || ComplexReferenceParentType.Layout == parentType || ComplexReferenceParentType.PayloadGroup == parentType); | 1165 | Debug.Assert(ComplexReferenceParentType.Unknown == parentType || ComplexReferenceParentType.Layout == parentType || ComplexReferenceParentType.PayloadGroup == parentType); |
| 1149 | 1166 | ||
| @@ -1177,7 +1194,7 @@ namespace WixToolset.Core | |||
| 1177 | } | 1194 | } |
| 1178 | 1195 | ||
| 1179 | var previousType = ComplexReferenceChildType.Unknown; | 1196 | var previousType = ComplexReferenceChildType.Unknown; |
| 1180 | string previousId = null; | 1197 | Identifier previousId = null; |
| 1181 | foreach (var child in node.Elements()) | 1198 | foreach (var child in node.Elements()) |
| 1182 | { | 1199 | { |
| 1183 | if (CompilerCore.WixNamespace == child.Name.Namespace) | 1200 | if (CompilerCore.WixNamespace == child.Name.Namespace) |
| @@ -1185,11 +1202,11 @@ namespace WixToolset.Core | |||
| 1185 | switch (child.Name.LocalName) | 1202 | switch (child.Name.LocalName) |
| 1186 | { | 1203 | { |
| 1187 | case "Payload": | 1204 | case "Payload": |
| 1188 | previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.PayloadGroup, id.Id, previousType, previousId); | 1205 | previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.PayloadGroup, id, previousType, previousId); |
| 1189 | previousType = ComplexReferenceChildType.Payload; | 1206 | previousType = ComplexReferenceChildType.Payload; |
| 1190 | break; | 1207 | break; |
| 1191 | case "PayloadGroupRef": | 1208 | case "PayloadGroupRef": |
| 1192 | previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.PayloadGroup, id.Id, previousType, previousId); | 1209 | previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.PayloadGroup, id, previousType, previousId); |
| 1193 | previousType = ComplexReferenceChildType.PayloadGroup; | 1210 | previousType = ComplexReferenceChildType.PayloadGroup; |
| 1194 | break; | 1211 | break; |
| 1195 | default: | 1212 | default: |
| @@ -1206,9 +1223,9 @@ namespace WixToolset.Core | |||
| 1206 | 1223 | ||
| 1207 | if (!this.Core.EncounteredError) | 1224 | if (!this.Core.EncounteredError) |
| 1208 | { | 1225 | { |
| 1209 | this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePayloadGroup, id); | 1226 | this.Core.AddTuple(new WixBundlePayloadGroupTuple(sourceLineNumbers, id)); |
| 1210 | 1227 | ||
| 1211 | this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.PayloadGroup, id.Id, ComplexReferenceChildType.Unknown, null); | 1228 | this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId?.Id, ComplexReferenceChildType.PayloadGroup, id.Id, ComplexReferenceChildType.Unknown, null); |
| 1212 | } | 1229 | } |
| 1213 | } | 1230 | } |
| 1214 | 1231 | ||
| @@ -1218,13 +1235,13 @@ namespace WixToolset.Core | |||
| 1218 | /// <param name="node">Element to parse.</param> | 1235 | /// <param name="node">Element to parse.</param> |
| 1219 | /// <param name="parentType">ComplexReferenceParentType of parent element (BA or PayloadGroup).</param> | 1236 | /// <param name="parentType">ComplexReferenceParentType of parent element (BA or PayloadGroup).</param> |
| 1220 | /// <param name="parentId">Identifier of parent element.</param> | 1237 | /// <param name="parentId">Identifier of parent element.</param> |
| 1221 | private string ParsePayloadGroupRefElement(XElement node, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId) | 1238 | private Identifier ParsePayloadGroupRefElement(XElement node, ComplexReferenceParentType parentType, Identifier parentId, ComplexReferenceChildType previousType, Identifier previousId) |
| 1222 | { | 1239 | { |
| 1223 | Debug.Assert(ComplexReferenceParentType.Layout == parentType || ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); | 1240 | Debug.Assert(ComplexReferenceParentType.Layout == parentType || ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); |
| 1224 | Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PayloadGroup == previousType || ComplexReferenceChildType.Payload == previousType); | 1241 | Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PayloadGroup == previousType || ComplexReferenceChildType.Payload == previousType); |
| 1225 | 1242 | ||
| 1226 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 1243 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); |
| 1227 | string id = null; | 1244 | Identifier id = null; |
| 1228 | 1245 | ||
| 1229 | foreach (var attrib in node.Attributes()) | 1246 | foreach (var attrib in node.Attributes()) |
| 1230 | { | 1247 | { |
| @@ -1233,8 +1250,8 @@ namespace WixToolset.Core | |||
| 1233 | switch (attrib.Name.LocalName) | 1250 | switch (attrib.Name.LocalName) |
| 1234 | { | 1251 | { |
| 1235 | case "Id": | 1252 | case "Id": |
| 1236 | id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 1253 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 1237 | this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePayloadGroup", id); | 1254 | this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePayloadGroup", id.Id); |
| 1238 | break; | 1255 | break; |
| 1239 | default: | 1256 | default: |
| 1240 | this.Core.UnexpectedAttribute(node, attrib); | 1257 | this.Core.UnexpectedAttribute(node, attrib); |
| @@ -1254,7 +1271,7 @@ namespace WixToolset.Core | |||
| 1254 | 1271 | ||
| 1255 | this.Core.ParseForExtensionElements(node); | 1272 | this.Core.ParseForExtensionElements(node); |
| 1256 | 1273 | ||
| 1257 | this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.PayloadGroup, id, previousType, previousId); | 1274 | this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId.Id, ComplexReferenceChildType.PayloadGroup, id.Id, previousType, previousId.Id); |
| 1258 | 1275 | ||
| 1259 | return id; | 1276 | return id; |
| 1260 | } | 1277 | } |
| @@ -1274,6 +1291,11 @@ namespace WixToolset.Core | |||
| 1274 | ComplexReferenceChildType type, string id, | 1291 | ComplexReferenceChildType type, string id, |
| 1275 | ComplexReferenceChildType previousType, string previousId) | 1292 | ComplexReferenceChildType previousType, string previousId) |
| 1276 | { | 1293 | { |
| 1294 | if (this.Core.EncounteredError) | ||
| 1295 | { | ||
| 1296 | return; | ||
| 1297 | } | ||
| 1298 | |||
| 1277 | if (ComplexReferenceParentType.Unknown != parentType && null != parentId) | 1299 | if (ComplexReferenceParentType.Unknown != parentType && null != parentId) |
| 1278 | { | 1300 | { |
| 1279 | this.Core.CreateWixGroupRow(sourceLineNumbers, parentType, parentId, type, id); | 1301 | this.Core.CreateWixGroupRow(sourceLineNumbers, parentType, parentId, type, id); |
| @@ -1281,7 +1303,18 @@ namespace WixToolset.Core | |||
| 1281 | 1303 | ||
| 1282 | if (ComplexReferenceChildType.Unknown != previousType && null != previousId) | 1304 | if (ComplexReferenceChildType.Unknown != previousType && null != previousId) |
| 1283 | { | 1305 | { |
| 1284 | this.CreateWixOrderingRow(sourceLineNumbers, type, id, previousType, previousId); | 1306 | // TODO: Should we define our own enum for this, just to ensure there's no "cross-contamination"? |
| 1307 | // TODO: Also, we could potentially include an 'Attributes' field to track things like | ||
| 1308 | // 'before' vs. 'after', and explicit vs. inferred dependencies. | ||
| 1309 | var tuple = new WixOrderingTuple(sourceLineNumbers) | ||
| 1310 | { | ||
| 1311 | ItemType = type, | ||
| 1312 | ItemId_ = id, | ||
| 1313 | DependsOnType = previousType, | ||
| 1314 | DependsOnId_ = previousId | ||
| 1315 | }; | ||
| 1316 | |||
| 1317 | this.Core.AddTuple(tuple); | ||
| 1285 | } | 1318 | } |
| 1286 | } | 1319 | } |
| 1287 | 1320 | ||
| @@ -1307,7 +1340,7 @@ namespace WixToolset.Core | |||
| 1307 | break; | 1340 | break; |
| 1308 | case "Behavior": | 1341 | case "Behavior": |
| 1309 | var behaviorString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 1342 | var behaviorString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
| 1310 | if (!Enum.TryParse<ExitCodeBehaviorType>(behaviorString, true, out behavior)) | 1343 | if (!Enum.TryParse(behaviorString, true, out behavior)) |
| 1311 | { | 1344 | { |
| 1312 | this.Core.Write(ErrorMessages.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Behavior", behaviorString, "success, error, scheduleReboot, forceReboot")); | 1345 | this.Core.Write(ErrorMessages.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Behavior", behaviorString, "success, error, scheduleReboot, forceReboot")); |
| 1313 | } | 1346 | } |
| @@ -1332,10 +1365,12 @@ namespace WixToolset.Core | |||
| 1332 | 1365 | ||
| 1333 | if (!this.Core.EncounteredError) | 1366 | if (!this.Core.EncounteredError) |
| 1334 | { | 1367 | { |
| 1335 | var row = (WixBundlePackageExitCodeTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePackageExitCode); | 1368 | this.Core.AddTuple(new WixBundlePackageExitCodeTuple(sourceLineNumbers) |
| 1336 | row.ChainPackageId = packageId; | 1369 | { |
| 1337 | row.Code = value; | 1370 | ChainPackageId = packageId, |
| 1338 | row.Behavior = behavior; | 1371 | Code = value, |
| 1372 | Behavior = behavior | ||
| 1373 | }); | ||
| 1339 | } | 1374 | } |
| 1340 | } | 1375 | } |
| 1341 | 1376 | ||
| @@ -1384,7 +1419,7 @@ namespace WixToolset.Core | |||
| 1384 | } | 1419 | } |
| 1385 | 1420 | ||
| 1386 | // Ensure there is always a rollback boundary at the beginning of the chain. | 1421 | // Ensure there is always a rollback boundary at the beginning of the chain. |
| 1387 | this.CreateRollbackBoundary(sourceLineNumbers, new Identifier("WixDefaultBoundary", AccessModifier.Public), YesNoType.Yes, YesNoType.No, ComplexReferenceParentType.PackageGroup, "WixChain", ComplexReferenceChildType.Unknown, null); | 1422 | this.CreateRollbackBoundary(sourceLineNumbers, new Identifier(AccessModifier.Public, "WixDefaultBoundary"), YesNoType.Yes, YesNoType.No, ComplexReferenceParentType.PackageGroup, "WixChain", ComplexReferenceChildType.Unknown, null); |
| 1388 | 1423 | ||
| 1389 | var previousId = "WixDefaultBoundary"; | 1424 | var previousId = "WixDefaultBoundary"; |
| 1390 | var previousType = ComplexReferenceChildType.Package; | 1425 | var previousType = ComplexReferenceChildType.Package; |
| @@ -1438,8 +1473,10 @@ namespace WixToolset.Core | |||
| 1438 | 1473 | ||
| 1439 | if (!this.Core.EncounteredError) | 1474 | if (!this.Core.EncounteredError) |
| 1440 | { | 1475 | { |
| 1441 | var row = (WixChainTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixChain); | 1476 | this.Core.AddTuple(new WixChainTuple(sourceLineNumbers) |
| 1442 | row.Attributes = attributes; | 1477 | { |
| 1478 | Attributes = attributes | ||
| 1479 | }); | ||
| 1443 | } | 1480 | } |
| 1444 | } | 1481 | } |
| 1445 | 1482 | ||
| @@ -1680,7 +1717,24 @@ namespace WixToolset.Core | |||
| 1680 | installCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 1717 | installCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
| 1681 | break; | 1718 | break; |
| 1682 | case "Cache": | 1719 | case "Cache": |
| 1683 | cache = this.Core.GetAttributeYesNoAlwaysValue(sourceLineNumbers, attrib); | 1720 | var value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
| 1721 | switch (value) | ||
| 1722 | { | ||
| 1723 | case "always": | ||
| 1724 | cache = YesNoAlwaysType.Always; | ||
| 1725 | break; | ||
| 1726 | case "yes": | ||
| 1727 | cache = YesNoAlwaysType.Yes; | ||
| 1728 | break; | ||
| 1729 | case "no": | ||
| 1730 | cache = YesNoAlwaysType.No; | ||
| 1731 | break; | ||
| 1732 | case "": | ||
| 1733 | break; | ||
| 1734 | default: | ||
| 1735 | this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "button", "yes", "no")); | ||
| 1736 | break; | ||
| 1737 | } | ||
| 1684 | break; | 1738 | break; |
| 1685 | case "CacheId": | 1739 | case "CacheId": |
| 1686 | cacheId = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 1740 | cacheId = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -1933,10 +1987,10 @@ namespace WixToolset.Core | |||
| 1933 | } | 1987 | } |
| 1934 | break; | 1988 | break; |
| 1935 | case "Payload": | 1989 | case "Payload": |
| 1936 | this.ParsePayloadElement(child, ComplexReferenceParentType.Package, id.Id, ComplexReferenceChildType.Unknown, null); | 1990 | this.ParsePayloadElement(child, ComplexReferenceParentType.Package, id, ComplexReferenceChildType.Unknown, null); |
| 1937 | break; | 1991 | break; |
| 1938 | case "PayloadGroupRef": | 1992 | case "PayloadGroupRef": |
| 1939 | this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Package, id.Id, ComplexReferenceChildType.Unknown, null); | 1993 | this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Package, id, ComplexReferenceChildType.Unknown, null); |
| 1940 | break; | 1994 | break; |
| 1941 | case "ExitCode": | 1995 | case "ExitCode": |
| 1942 | allowed = (packageType == WixBundlePackageType.Exe); | 1996 | allowed = (packageType == WixBundlePackageType.Exe); |
| @@ -1975,60 +2029,60 @@ namespace WixToolset.Core | |||
| 1975 | if (!this.Core.EncounteredError) | 2029 | if (!this.Core.EncounteredError) |
| 1976 | { | 2030 | { |
| 1977 | // We create the package contents as a payload with this package as the parent | 2031 | // We create the package contents as a payload with this package as the parent |
| 1978 | this.CreatePayloadRow(sourceLineNumbers, id, name, sourceFile, downloadUrl, ComplexReferenceParentType.Package, id.Id, | 2032 | this.CreatePayloadRow(sourceLineNumbers, id, name, sourceFile, downloadUrl, ComplexReferenceParentType.Package, id, |
| 1979 | ComplexReferenceChildType.Unknown, null, compressed, enableSignatureVerification, displayName, description, remotePayload); | 2033 | ComplexReferenceChildType.Unknown, null, compressed, enableSignatureVerification, displayName, description, remotePayload); |
| 1980 | 2034 | ||
| 1981 | var chainItemRow = (WixChainItemTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixChainItem, id); | 2035 | this.Core.AddTuple(new WixChainItemTuple(sourceLineNumbers, id)); |
| 1982 | 2036 | ||
| 1983 | WixBundlePackageAttributes attributes = 0; | 2037 | WixBundlePackageAttributes attributes = 0; |
| 1984 | attributes |= (YesNoType.Yes == permanent) ? WixBundlePackageAttributes.Permanent : 0; | 2038 | attributes |= (YesNoType.Yes == permanent) ? WixBundlePackageAttributes.Permanent : 0; |
| 1985 | attributes |= (YesNoType.Yes == visible) ? WixBundlePackageAttributes.Visible : 0; | 2039 | attributes |= (YesNoType.Yes == visible) ? WixBundlePackageAttributes.Visible : 0; |
| 1986 | 2040 | ||
| 1987 | var chainPackageRow = (WixBundlePackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePackage, id); | 2041 | var chainPackageTuple = new WixBundlePackageTuple(sourceLineNumbers, id) |
| 1988 | chainPackageRow.Type = packageType; | 2042 | { |
| 1989 | chainPackageRow.Payload_ = id.Id; | 2043 | Type = packageType, |
| 1990 | chainPackageRow.Attributes = attributes; | 2044 | Payload_ = id.Id, |
| 1991 | 2045 | Attributes = attributes, | |
| 1992 | chainPackageRow.InstallCondition = installCondition; | 2046 | InstallCondition = installCondition, |
| 2047 | CacheId = cacheId, | ||
| 2048 | LogPathVariable = logPathVariable, | ||
| 2049 | RollbackLogPathVariable = rollbackPathVariable, | ||
| 2050 | }; | ||
| 1993 | 2051 | ||
| 1994 | if (YesNoAlwaysType.NotSet != cache) | 2052 | if (YesNoAlwaysType.NotSet != cache) |
| 1995 | { | 2053 | { |
| 1996 | chainPackageRow.Cache = cache; | 2054 | chainPackageTuple.Cache = cache; |
| 1997 | } | 2055 | } |
| 1998 | 2056 | ||
| 1999 | chainPackageRow.CacheId = cacheId; | ||
| 2000 | |||
| 2001 | if (YesNoType.NotSet != vital) | 2057 | if (YesNoType.NotSet != vital) |
| 2002 | { | 2058 | { |
| 2003 | chainPackageRow.Vital = (vital == YesNoType.Yes); | 2059 | chainPackageTuple.Vital = (vital == YesNoType.Yes); |
| 2004 | } | 2060 | } |
| 2005 | 2061 | ||
| 2006 | if (YesNoDefaultType.NotSet != perMachine) | 2062 | if (YesNoDefaultType.NotSet != perMachine) |
| 2007 | { | 2063 | { |
| 2008 | chainPackageRow.PerMachine = perMachine; | 2064 | chainPackageTuple.PerMachine = perMachine; |
| 2009 | } | 2065 | } |
| 2010 | 2066 | ||
| 2011 | chainPackageRow.LogPathVariable = logPathVariable; | ||
| 2012 | chainPackageRow.RollbackLogPathVariable = rollbackPathVariable; | ||
| 2013 | |||
| 2014 | if (CompilerConstants.IntegerNotSet != installSize) | 2067 | if (CompilerConstants.IntegerNotSet != installSize) |
| 2015 | { | 2068 | { |
| 2016 | chainPackageRow.InstallSize = installSize; | 2069 | chainPackageTuple.InstallSize = installSize; |
| 2017 | } | 2070 | } |
| 2018 | 2071 | ||
| 2072 | this.Core.AddTuple(chainPackageTuple); | ||
| 2073 | |||
| 2019 | switch (packageType) | 2074 | switch (packageType) |
| 2020 | { | 2075 | { |
| 2021 | case WixBundlePackageType.Exe: | 2076 | case WixBundlePackageType.Exe: |
| 2022 | WixBundleExePackageAttributes exeAttributes = 0; | 2077 | this.Core.AddTuple(new WixBundleExePackageTuple(sourceLineNumbers, id) |
| 2023 | exeAttributes |= (YesNoType.Yes == repairable) ? WixBundleExePackageAttributes.Repairable : 0; | 2078 | { |
| 2024 | 2079 | Attributes = (YesNoType.Yes == repairable) ? WixBundleExePackageAttributes.Repairable : 0, | |
| 2025 | var exeRow = (WixBundleExePackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleExePackage, id); | 2080 | DetectCondition = detectCondition, |
| 2026 | exeRow.Attributes = exeAttributes; | 2081 | InstallCommand = installCommand, |
| 2027 | exeRow.DetectCondition = detectCondition; | 2082 | RepairCommand = repairCommand, |
| 2028 | exeRow.InstallCommand = installCommand; | 2083 | UninstallCommand = uninstallCommand, |
| 2029 | exeRow.RepairCommand = repairCommand; | 2084 | ExeProtocol = protocol |
| 2030 | exeRow.UninstallCommand = uninstallCommand; | 2085 | }); |
| 2031 | exeRow.ExeProtocol = protocol; | ||
| 2032 | break; | 2086 | break; |
| 2033 | 2087 | ||
| 2034 | case WixBundlePackageType.Msi: | 2088 | case WixBundlePackageType.Msi: |
| @@ -2038,8 +2092,10 @@ namespace WixToolset.Core | |||
| 2038 | msiAttributes |= (YesNoType.Yes == forcePerMachine) ? WixBundleMsiPackageAttributes.ForcePerMachine : 0; | 2092 | msiAttributes |= (YesNoType.Yes == forcePerMachine) ? WixBundleMsiPackageAttributes.ForcePerMachine : 0; |
| 2039 | msiAttributes |= (YesNoType.Yes == suppressLooseFilePayloadGeneration) ? WixBundleMsiPackageAttributes.SuppressLooseFilePayloadGeneration : 0; | 2093 | msiAttributes |= (YesNoType.Yes == suppressLooseFilePayloadGeneration) ? WixBundleMsiPackageAttributes.SuppressLooseFilePayloadGeneration : 0; |
| 2040 | 2094 | ||
| 2041 | var msiRow = (WixBundleMsiPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMsiPackage, id); | 2095 | this.Core.AddTuple(new WixBundleMsiPackageTuple(sourceLineNumbers, id) |
| 2042 | msiRow.Attributes = msiAttributes; | 2096 | { |
| 2097 | Attributes = msiAttributes | ||
| 2098 | }); | ||
| 2043 | break; | 2099 | break; |
| 2044 | 2100 | ||
| 2045 | case WixBundlePackageType.Msp: | 2101 | case WixBundlePackageType.Msp: |
| @@ -2047,14 +2103,18 @@ namespace WixToolset.Core | |||
| 2047 | mspAttributes |= (YesNoType.Yes == displayInternalUI) ? WixBundleMspPackageAttributes.DisplayInternalUI : 0; | 2103 | mspAttributes |= (YesNoType.Yes == displayInternalUI) ? WixBundleMspPackageAttributes.DisplayInternalUI : 0; |
| 2048 | mspAttributes |= (YesNoType.Yes == slipstream) ? WixBundleMspPackageAttributes.Slipstream : 0; | 2104 | mspAttributes |= (YesNoType.Yes == slipstream) ? WixBundleMspPackageAttributes.Slipstream : 0; |
| 2049 | 2105 | ||
| 2050 | var mspRow = (WixBundleMspPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMspPackage, id); | 2106 | this.Core.AddTuple(new WixBundleMspPackageTuple(sourceLineNumbers, id) |
| 2051 | mspRow.Attributes = mspAttributes; | 2107 | { |
| 2108 | Attributes = mspAttributes | ||
| 2109 | }); | ||
| 2052 | break; | 2110 | break; |
| 2053 | 2111 | ||
| 2054 | case WixBundlePackageType.Msu: | 2112 | case WixBundlePackageType.Msu: |
| 2055 | var msuRow = (WixBundleMsuPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMsuPackage, id); | 2113 | this.Core.AddTuple(new WixBundleMsuPackageTuple(sourceLineNumbers, id) |
| 2056 | msuRow.DetectCondition = detectCondition; | 2114 | { |
| 2057 | msuRow.MsuKB = msuKB; | 2115 | DetectCondition = detectCondition, |
| 2116 | MsuKB = msuKB | ||
| 2117 | }); | ||
| 2058 | break; | 2118 | break; |
| 2059 | } | 2119 | } |
| 2060 | 2120 | ||
| @@ -2114,12 +2174,14 @@ namespace WixToolset.Core | |||
| 2114 | 2174 | ||
| 2115 | if (!this.Core.EncounteredError) | 2175 | if (!this.Core.EncounteredError) |
| 2116 | { | 2176 | { |
| 2117 | var row = (WixBundlePackageCommandLineTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePackageCommandLine); | 2177 | this.Core.AddTuple(new WixBundlePackageCommandLineTuple(sourceLineNumbers) |
| 2118 | row.WixBundlePackage_ = packageId; | 2178 | { |
| 2119 | row.InstallArgument = installArgument; | 2179 | WixBundlePackage_ = packageId, |
| 2120 | row.UninstallArgument = uninstallArgument; | 2180 | InstallArgument = installArgument, |
| 2121 | row.RepairArgument = repairArgument; | 2181 | UninstallArgument = uninstallArgument, |
| 2122 | row.Condition = condition; | 2182 | RepairArgument = repairArgument, |
| 2183 | Condition = condition | ||
| 2184 | }); | ||
| 2123 | } | 2185 | } |
| 2124 | } | 2186 | } |
| 2125 | 2187 | ||
| @@ -2204,7 +2266,7 @@ namespace WixToolset.Core | |||
| 2204 | 2266 | ||
| 2205 | if (!this.Core.EncounteredError) | 2267 | if (!this.Core.EncounteredError) |
| 2206 | { | 2268 | { |
| 2207 | this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundlePackageGroup, id); | 2269 | this.Core.AddTuple(new WixBundlePackageGroupTuple(sourceLineNumbers, id)); |
| 2208 | } | 2270 | } |
| 2209 | } | 2271 | } |
| 2210 | 2272 | ||
| @@ -2299,19 +2361,22 @@ namespace WixToolset.Core | |||
| 2299 | /// <param name="previousId">Identifier of previous item, if any.</param> | 2361 | /// <param name="previousId">Identifier of previous item, if any.</param> |
| 2300 | private void CreateRollbackBoundary(SourceLineNumber sourceLineNumbers, Identifier id, YesNoType vital, YesNoType transaction, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId) | 2362 | private void CreateRollbackBoundary(SourceLineNumber sourceLineNumbers, Identifier id, YesNoType vital, YesNoType transaction, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId) |
| 2301 | { | 2363 | { |
| 2302 | var row = (WixChainItemTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixChainItem, id); | 2364 | this.Core.AddTuple(new WixChainItemTuple(sourceLineNumbers, id)); |
| 2303 | 2365 | ||
| 2304 | var rollbackBoundary = (WixBundleRollbackBoundaryTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleRollbackBoundary, id); | 2366 | var rollbackBoundary = new WixBundleRollbackBoundaryTuple(sourceLineNumbers, id); |
| 2305 | 2367 | ||
| 2306 | if (YesNoType.NotSet != vital) | 2368 | if (YesNoType.NotSet != vital) |
| 2307 | { | 2369 | { |
| 2308 | rollbackBoundary.Vital = (vital == YesNoType.Yes); | 2370 | rollbackBoundary.Vital = (vital == YesNoType.Yes); |
| 2309 | } | 2371 | } |
| 2372 | |||
| 2310 | if (YesNoType.NotSet != transaction) | 2373 | if (YesNoType.NotSet != transaction) |
| 2311 | { | 2374 | { |
| 2312 | rollbackBoundary.Transaction = (transaction == YesNoType.Yes); | 2375 | rollbackBoundary.Transaction = (transaction == YesNoType.Yes); |
| 2313 | } | 2376 | } |
| 2314 | 2377 | ||
| 2378 | this.Core.AddTuple(rollbackBoundary); | ||
| 2379 | |||
| 2315 | this.CreateChainPackageMetaRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Package, id.Id, previousType, previousId, null); | 2380 | this.CreateChainPackageMetaRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Package, id.Id, previousType, previousId, null); |
| 2316 | } | 2381 | } |
| 2317 | 2382 | ||
| @@ -2341,23 +2406,6 @@ namespace WixToolset.Core | |||
| 2341 | this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId, type, id, previousType, previousId); | 2406 | this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId, type, id, previousType, previousId); |
| 2342 | } | 2407 | } |
| 2343 | 2408 | ||
| 2344 | // TODO: Should we define our own enum for this, just to ensure there's no "cross-contamination"? | ||
| 2345 | // TODO: Also, we could potentially include an 'Attributes' field to track things like | ||
| 2346 | // 'before' vs. 'after', and explicit vs. inferred dependencies. | ||
| 2347 | private void CreateWixOrderingRow(SourceLineNumber sourceLineNumbers, | ||
| 2348 | ComplexReferenceChildType itemType, string itemId, | ||
| 2349 | ComplexReferenceChildType dependsOnType, string dependsOnId) | ||
| 2350 | { | ||
| 2351 | if (!this.Core.EncounteredError) | ||
| 2352 | { | ||
| 2353 | var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixOrdering); | ||
| 2354 | row.Set(0, itemType.ToString()); | ||
| 2355 | row.Set(1, itemId); | ||
| 2356 | row.Set(2, dependsOnType.ToString()); | ||
| 2357 | row.Set(3, dependsOnId); | ||
| 2358 | } | ||
| 2359 | } | ||
| 2360 | |||
| 2361 | /// <summary> | 2409 | /// <summary> |
| 2362 | /// Parse MsiProperty element | 2410 | /// Parse MsiProperty element |
| 2363 | /// </summary> | 2411 | /// </summary> |
| @@ -2410,15 +2458,19 @@ namespace WixToolset.Core | |||
| 2410 | 2458 | ||
| 2411 | if (!this.Core.EncounteredError) | 2459 | if (!this.Core.EncounteredError) |
| 2412 | { | 2460 | { |
| 2413 | var row = (WixBundleMsiPropertyTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMsiProperty); | 2461 | var tuple = new WixBundleMsiPropertyTuple(sourceLineNumbers) |
| 2414 | row.WixBundlePackage_ = packageId; | 2462 | { |
| 2415 | row.Name = name; | 2463 | WixBundlePackage_ = packageId, |
| 2416 | row.Value = value; | 2464 | Name = name, |
| 2465 | Value = value | ||
| 2466 | }; | ||
| 2417 | 2467 | ||
| 2418 | if (!String.IsNullOrEmpty(condition)) | 2468 | if (!String.IsNullOrEmpty(condition)) |
| 2419 | { | 2469 | { |
| 2420 | row.Condition = condition; | 2470 | tuple.Condition = condition; |
| 2421 | } | 2471 | } |
| 2472 | |||
| 2473 | this.Core.AddTuple(tuple); | ||
| 2422 | } | 2474 | } |
| 2423 | } | 2475 | } |
| 2424 | 2476 | ||
| @@ -2462,9 +2514,11 @@ namespace WixToolset.Core | |||
| 2462 | 2514 | ||
| 2463 | if (!this.Core.EncounteredError) | 2515 | if (!this.Core.EncounteredError) |
| 2464 | { | 2516 | { |
| 2465 | var row = (WixBundleSlipstreamMspTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleSlipstreamMsp); | 2517 | this.Core.AddTuple(new WixBundleSlipstreamMspTuple(sourceLineNumbers) |
| 2466 | row.WixBundlePackage_ = packageId; | 2518 | { |
| 2467 | row.WixBundlePackage_Msp = id; | 2519 | WixBundlePackage_ = packageId, |
| 2520 | WixBundlePackage_Msp = id | ||
| 2521 | }); | ||
| 2468 | } | 2522 | } |
| 2469 | } | 2523 | } |
| 2470 | 2524 | ||
| @@ -2585,8 +2639,12 @@ namespace WixToolset.Core | |||
| 2585 | 2639 | ||
| 2586 | if (!this.Core.EncounteredError) | 2640 | if (!this.Core.EncounteredError) |
| 2587 | { | 2641 | { |
| 2588 | var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleUpdate); | 2642 | var tuple = new WixBundleUpdateTuple(sourceLineNumbers) |
| 2589 | row.Set(0, location); | 2643 | { |
| 2644 | Location = location | ||
| 2645 | }; | ||
| 2646 | |||
| 2647 | this.Core.AddTuple(tuple); | ||
| 2590 | } | 2648 | } |
| 2591 | } | 2649 | } |
| 2592 | 2650 | ||
| @@ -2698,12 +2756,15 @@ namespace WixToolset.Core | |||
| 2698 | 2756 | ||
| 2699 | if (!this.Core.EncounteredError) | 2757 | if (!this.Core.EncounteredError) |
| 2700 | { | 2758 | { |
| 2701 | var row = (WixBundleVariableTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleVariable); | 2759 | var tuple = new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, name)) |
| 2702 | row.WixBundleVariable = name; | 2760 | { |
| 2703 | row.Value = value; | 2761 | Value = value, |
| 2704 | row.Type = type; | 2762 | Type = type, |
| 2705 | row.Hidden = hidden; | 2763 | Hidden = hidden, |
| 2706 | row.Persisted = persisted; | 2764 | Persisted = persisted |
| 2765 | }; | ||
| 2766 | |||
| 2767 | this.Core.AddTuple(tuple); | ||
| 2707 | } | 2768 | } |
| 2708 | } | 2769 | } |
| 2709 | 2770 | ||
