diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.Core/Compiler.cs | 3 | ||||
| -rw-r--r-- | src/WixToolset.Core/Compiler_Bundle.cs | 77 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/TestData/BundleCustomTable/BundleCustomTable.wxs | 21 |
3 files changed, 92 insertions, 9 deletions
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index cb85281d..9681cb3f 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs | |||
| @@ -6229,6 +6229,9 @@ namespace WixToolset.Core | |||
| 6229 | case "BundleCustomData": | 6229 | case "BundleCustomData": |
| 6230 | this.ParseBundleCustomDataElement(child); | 6230 | this.ParseBundleCustomDataElement(child); |
| 6231 | break; | 6231 | break; |
| 6232 | case "BundleCustomDataRef": | ||
| 6233 | this.ParseBundleCustomDataRefElement(child); | ||
| 6234 | break; | ||
| 6232 | case "BundleExtension": | 6235 | case "BundleExtension": |
| 6233 | this.ParseBundleExtensionElement(child); | 6236 | this.ParseBundleExtensionElement(child); |
| 6234 | break; | 6237 | break; |
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index 5154a72f..2b274474 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs | |||
| @@ -280,6 +280,9 @@ namespace WixToolset.Core | |||
| 280 | case "BundleCustomData": | 280 | case "BundleCustomData": |
| 281 | this.ParseBundleCustomDataElement(child); | 281 | this.ParseBundleCustomDataElement(child); |
| 282 | break; | 282 | break; |
| 283 | case "BundleCustomDataRef": | ||
| 284 | this.ParseBundleCustomDataRefElement(child); | ||
| 285 | break; | ||
| 283 | case "BundleExtension": | 286 | case "BundleExtension": |
| 284 | this.ParseBundleExtensionElement(child); | 287 | this.ParseBundleExtensionElement(child); |
| 285 | break; | 288 | break; |
| @@ -784,6 +787,7 @@ namespace WixToolset.Core | |||
| 784 | WixBundleCustomDataType? customDataType = null; | 787 | WixBundleCustomDataType? customDataType = null; |
| 785 | string extensionId = null; | 788 | string extensionId = null; |
| 786 | var attributeDefinitions = new List<WixBundleCustomDataAttributeTuple>(); | 789 | var attributeDefinitions = new List<WixBundleCustomDataAttributeTuple>(); |
| 790 | var foundAttributeDefinitions = false; | ||
| 787 | 791 | ||
| 788 | foreach (var attrib in node.Attributes()) | 792 | foreach (var attrib in node.Attributes()) |
| 789 | { | 793 | { |
| @@ -831,9 +835,9 @@ namespace WixToolset.Core | |||
| 831 | } | 835 | } |
| 832 | 836 | ||
| 833 | var hasExtensionId = null != extensionId; | 837 | var hasExtensionId = null != extensionId; |
| 834 | if (hasExtensionId && !customDataType.HasValue) | 838 | if (!customDataType.HasValue) |
| 835 | { | 839 | { |
| 836 | customDataType = WixBundleCustomDataType.BundleExtension; | 840 | customDataType = hasExtensionId ? WixBundleCustomDataType.BundleExtension : WixBundleCustomDataType.BootstrapperApplication; |
| 837 | } | 841 | } |
| 838 | 842 | ||
| 839 | if (!customDataType.HasValue) | 843 | if (!customDataType.HasValue) |
| @@ -860,6 +864,8 @@ namespace WixToolset.Core | |||
| 860 | switch (child.Name.LocalName) | 864 | switch (child.Name.LocalName) |
| 861 | { | 865 | { |
| 862 | case "BundleAttributeDefinition": | 866 | case "BundleAttributeDefinition": |
| 867 | foundAttributeDefinitions = true; | ||
| 868 | |||
| 863 | var attributeDefinition = this.ParseBundleAttributeDefinitionElement(child, childSourceLineNumbers, customDataId); | 869 | var attributeDefinition = this.ParseBundleAttributeDefinitionElement(child, childSourceLineNumbers, customDataId); |
| 864 | if (attributeDefinition != null) | 870 | if (attributeDefinition != null) |
| 865 | { | 871 | { |
| @@ -894,6 +900,73 @@ namespace WixToolset.Core | |||
| 894 | }); | 900 | }); |
| 895 | } | 901 | } |
| 896 | } | 902 | } |
| 903 | else if (!foundAttributeDefinitions) | ||
| 904 | { | ||
| 905 | this.Core.Write(ErrorMessages.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "BundleAttributeDefinition")); | ||
| 906 | } | ||
| 907 | } | ||
| 908 | |||
| 909 | /// <summary> | ||
| 910 | /// Parses a BundleCustomDataRef element. | ||
| 911 | /// </summary> | ||
| 912 | /// <param name="node">Element to parse.</param> | ||
| 913 | private void ParseBundleCustomDataRefElement(XElement node) | ||
| 914 | { | ||
| 915 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | ||
| 916 | string customDataId = null; | ||
| 917 | var foundChild = false; | ||
| 918 | |||
| 919 | foreach (var attrib in node.Attributes()) | ||
| 920 | { | ||
| 921 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) | ||
| 922 | { | ||
| 923 | switch (attrib.Name.LocalName) | ||
| 924 | { | ||
| 925 | case "Id": | ||
| 926 | customDataId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | ||
| 927 | break; | ||
| 928 | default: | ||
| 929 | this.Core.UnexpectedAttribute(node, attrib); | ||
| 930 | break; | ||
| 931 | } | ||
| 932 | } | ||
| 933 | else | ||
| 934 | { | ||
| 935 | this.Core.ParseExtensionAttribute(node, attrib); | ||
| 936 | } | ||
| 937 | } | ||
| 938 | |||
| 939 | if (null == customDataId) | ||
| 940 | { | ||
| 941 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); | ||
| 942 | } | ||
| 943 | |||
| 944 | foreach (var child in node.Elements()) | ||
| 945 | { | ||
| 946 | foundChild = true; | ||
| 947 | if (CompilerCore.WixNamespace == child.Name.Namespace) | ||
| 948 | { | ||
| 949 | var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); | ||
| 950 | switch (child.Name.LocalName) | ||
| 951 | { | ||
| 952 | case "BundleElement": | ||
| 953 | this.ParseBundleElementElement(child, childSourceLineNumbers, customDataId); | ||
| 954 | break; | ||
| 955 | default: | ||
| 956 | this.Core.UnexpectedElement(node, child); | ||
| 957 | break; | ||
| 958 | } | ||
| 959 | } | ||
| 960 | else | ||
| 961 | { | ||
| 962 | this.Core.ParseExtensionElement(node, child); | ||
| 963 | } | ||
| 964 | } | ||
| 965 | |||
| 966 | if (!foundChild) | ||
| 967 | { | ||
| 968 | this.Core.Write(ErrorMessages.ExpectedElement(sourceLineNumbers, node.Name.LocalName)); | ||
| 969 | } | ||
| 897 | } | 970 | } |
| 898 | 971 | ||
| 899 | /// <summary> | 972 | /// <summary> |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleCustomTable/BundleCustomTable.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleCustomTable/BundleCustomTable.wxs index 38d207ca..8482a57e 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/BundleCustomTable/BundleCustomTable.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BundleCustomTable/BundleCustomTable.wxs | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | <PackageGroupRef Id="MinimalPackageGroup" /> | 5 | <PackageGroupRef Id="MinimalPackageGroup" /> |
| 6 | </PackageGroup> | 6 | </PackageGroup> |
| 7 | 7 | ||
| 8 | <BundleCustomData Id="BundleCustomTableBA" Type="bootstrapperApplication"> | 8 | <BundleCustomData Id="BundleCustomTableBA"> |
| 9 | <BundleAttributeDefinition Id="Id" /> | 9 | <BundleAttributeDefinition Id="Id" /> |
| 10 | <BundleAttributeDefinition Id="Column2" /> | 10 | <BundleAttributeDefinition Id="Column2" /> |
| 11 | 11 | ||
| @@ -17,16 +17,23 @@ | |||
| 17 | <BundleAttribute Id="Column2"><</BundleAttribute> | 17 | <BundleAttribute Id="Column2"><</BundleAttribute> |
| 18 | <BundleAttribute Id="Id">></BundleAttribute> | 18 | <BundleAttribute Id="Id">></BundleAttribute> |
| 19 | </BundleElement> | 19 | </BundleElement> |
| 20 | <BundleElement> | ||
| 21 | <BundleAttribute Id="Id">1</BundleAttribute> | ||
| 22 | <BundleAttribute Id="Column2">2</BundleAttribute> | ||
| 23 | </BundleElement> | ||
| 24 | </BundleCustomData> | 20 | </BundleCustomData> |
| 25 | 21 | ||
| 26 | <BundleCustomData Id="BundleCustomTableBE" Type="bundleExtension" ExtensionId="CustomTableExtension"> | 22 | <BundleCustomData Id="BundleCustomTableBE" ExtensionId="CustomTableExtension"> |
| 27 | <BundleAttributeDefinition Id="Id" /> | 23 | <BundleAttributeDefinition Id="Id" /> |
| 28 | <BundleAttributeDefinition Id="Column2" /> | 24 | <BundleAttributeDefinition Id="Column2" /> |
| 25 | </BundleCustomData> | ||
| 26 | </Fragment> | ||
| 29 | 27 | ||
| 28 | <Fragment> | ||
| 29 | <BundleCustomDataRef Id="BundleCustomTableBA"> | ||
| 30 | <BundleElement> | ||
| 31 | <BundleAttribute Id="Id">1</BundleAttribute> | ||
| 32 | <BundleAttribute Id="Column2">2</BundleAttribute> | ||
| 33 | </BundleElement> | ||
| 34 | </BundleCustomDataRef> | ||
| 35 | |||
| 36 | <BundleCustomDataRef Id="BundleCustomTableBE"> | ||
| 30 | <BundleElement> | 37 | <BundleElement> |
| 31 | <BundleAttribute Id="Id">one</BundleAttribute> | 38 | <BundleAttribute Id="Id">one</BundleAttribute> |
| 32 | <BundleAttribute Id="Column2">two</BundleAttribute> | 39 | <BundleAttribute Id="Column2">two</BundleAttribute> |
| @@ -39,7 +46,7 @@ | |||
| 39 | <BundleAttribute Id="Id">1</BundleAttribute> | 46 | <BundleAttribute Id="Id">1</BundleAttribute> |
| 40 | <BundleAttribute Id="Column2">2</BundleAttribute> | 47 | <BundleAttribute Id="Column2">2</BundleAttribute> |
| 41 | </BundleElement> | 48 | </BundleElement> |
| 42 | </BundleCustomData> | 49 | </BundleCustomDataRef> |
| 43 | 50 | ||
| 44 | <BundleExtension Id="CustomTableExtension" SourceFile="fakeba.dll" /> | 51 | <BundleExtension Id="CustomTableExtension" SourceFile="fakeba.dll" /> |
| 45 | </Fragment> | 52 | </Fragment> |
