diff options
author | Rob Mensching <rob@firegiant.com> | 2021-02-11 13:46:45 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-02-11 13:52:29 -0800 |
commit | c6e2213e818b869c44c1af7355fc06f45ebf1a1f (patch) | |
tree | db01cac18404c9be74c95183956b1ceb517ef5c8 /src/WixToolset.Core | |
parent | 0fcb0cb1d0a2f741f83feb76bc276926f499686d (diff) | |
download | wix-c6e2213e818b869c44c1af7355fc06f45ebf1a1f.tar.gz wix-c6e2213e818b869c44c1af7355fc06f45ebf1a1f.tar.bz2 wix-c6e2213e818b869c44c1af7355fc06f45ebf1a1f.zip |
Replace Win64 attribute with Bitness attribute
Closes wixtoolset/#4707
Diffstat (limited to 'src/WixToolset.Core')
-rw-r--r-- | src/WixToolset.Core/CompileContext.cs | 2 | ||||
-rw-r--r-- | src/WixToolset.Core/Compiler.cs | 105 | ||||
-rw-r--r-- | src/WixToolset.Core/Compiler_Bundle.cs | 25 |
3 files changed, 82 insertions, 50 deletions
diff --git a/src/WixToolset.Core/CompileContext.cs b/src/WixToolset.Core/CompileContext.cs index 44da6c8a..e781b692 100644 --- a/src/WixToolset.Core/CompileContext.cs +++ b/src/WixToolset.Core/CompileContext.cs | |||
@@ -25,6 +25,8 @@ namespace WixToolset.Core | |||
25 | 25 | ||
26 | public Platform Platform { get; set; } | 26 | public Platform Platform { get; set; } |
27 | 27 | ||
28 | public bool IsCurrentPlatform64Bit => this.Platform == Platform.ARM64 || this.Platform == Platform.X64; | ||
29 | |||
28 | public XDocument Source { get; set; } | 30 | public XDocument Source { get; set; } |
29 | 31 | ||
30 | public CancellationToken CancellationToken { get; set; } | 32 | public CancellationToken CancellationToken { get; set; } |
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index 5267a232..85261cce 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs | |||
@@ -59,13 +59,9 @@ namespace WixToolset.Core | |||
59 | 59 | ||
60 | internal Compiler(IWixToolsetServiceProvider serviceProvider) | 60 | internal Compiler(IWixToolsetServiceProvider serviceProvider) |
61 | { | 61 | { |
62 | this.ServiceProvider = serviceProvider; | ||
63 | |||
64 | this.Messaging = serviceProvider.GetService<IMessaging>(); | 62 | this.Messaging = serviceProvider.GetService<IMessaging>(); |
65 | } | 63 | } |
66 | 64 | ||
67 | private IWixToolsetServiceProvider ServiceProvider { get; } | ||
68 | |||
69 | public IMessaging Messaging { get; } | 65 | public IMessaging Messaging { get; } |
70 | 66 | ||
71 | private ICompileContext Context { get; set; } | 67 | private ICompileContext Context { get; set; } |
@@ -79,12 +75,6 @@ namespace WixToolset.Core | |||
79 | public Platform CurrentPlatform => this.Context.Platform; | 75 | public Platform CurrentPlatform => this.Context.Platform; |
80 | 76 | ||
81 | /// <summary> | 77 | /// <summary> |
82 | /// Gets or sets the platform which the compiler will use when defaulting 64-bit attributes and elements. | ||
83 | /// </summary> | ||
84 | /// <value>The platform which the compiler will use when defaulting 64-bit attributes and elements.</value> | ||
85 | public bool IsCurrentPlatform64Bit => this.Context.Platform == Platform.ARM64 || this.Context.Platform == Platform.X64; | ||
86 | |||
87 | /// <summary> | ||
88 | /// Gets or sets the option to show pedantic messages. | 78 | /// Gets or sets the option to show pedantic messages. |
89 | /// </summary> | 79 | /// </summary> |
90 | /// <value>The option to show pedantic messages.</value> | 80 | /// <value>The option to show pedantic messages.</value> |
@@ -1724,14 +1714,12 @@ namespace WixToolset.Core | |||
1724 | private string ParseRegistrySearchElement(XElement node) | 1714 | private string ParseRegistrySearchElement(XElement node) |
1725 | { | 1715 | { |
1726 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 1716 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); |
1727 | var explicitWin64 = false; | ||
1728 | Identifier id = null; | 1717 | Identifier id = null; |
1729 | string key = null; | 1718 | string key = null; |
1730 | string name = null; | 1719 | string name = null; |
1731 | string signature = null; | ||
1732 | RegistryRootType? root = null; | 1720 | RegistryRootType? root = null; |
1733 | RegLocatorType? type = null; | 1721 | RegLocatorType? type = null; |
1734 | var search64bit = false; | 1722 | var search64bit = this.Context.IsCurrentPlatform64Bit; |
1735 | 1723 | ||
1736 | foreach (var attrib in node.Attributes()) | 1724 | foreach (var attrib in node.Attributes()) |
1737 | { | 1725 | { |
@@ -1742,6 +1730,24 @@ namespace WixToolset.Core | |||
1742 | case "Id": | 1730 | case "Id": |
1743 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); | 1731 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); |
1744 | break; | 1732 | break; |
1733 | case "Bitness": | ||
1734 | var bitnessValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
1735 | switch (bitnessValue) | ||
1736 | { | ||
1737 | case "always32": | ||
1738 | search64bit = false; | ||
1739 | break; | ||
1740 | case "always64": | ||
1741 | search64bit = true; | ||
1742 | break; | ||
1743 | case "default": | ||
1744 | case "": | ||
1745 | break; | ||
1746 | default: | ||
1747 | this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, bitnessValue, "default", "always32", "always64")); | ||
1748 | break; | ||
1749 | } | ||
1750 | break; | ||
1745 | case "Key": | 1751 | case "Key": |
1746 | key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 1752 | key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
1747 | break; | 1753 | break; |
@@ -1771,10 +1777,6 @@ namespace WixToolset.Core | |||
1771 | break; | 1777 | break; |
1772 | } | 1778 | } |
1773 | break; | 1779 | break; |
1774 | case "Win64": | ||
1775 | explicitWin64 = true; | ||
1776 | search64bit = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); | ||
1777 | break; | ||
1778 | default: | 1780 | default: |
1779 | this.Core.UnexpectedAttribute(node, attrib); | 1781 | this.Core.UnexpectedAttribute(node, attrib); |
1780 | break; | 1782 | break; |
@@ -1786,11 +1788,6 @@ namespace WixToolset.Core | |||
1786 | } | 1788 | } |
1787 | } | 1789 | } |
1788 | 1790 | ||
1789 | if (!explicitWin64 && this.IsCurrentPlatform64Bit) | ||
1790 | { | ||
1791 | search64bit = true; | ||
1792 | } | ||
1793 | |||
1794 | if (null == id) | 1791 | if (null == id) |
1795 | { | 1792 | { |
1796 | id = this.Core.CreateIdentifier("reg", root.ToString(), key, name, type.ToString(), search64bit.ToString()); | 1793 | id = this.Core.CreateIdentifier("reg", root.ToString(), key, name, type.ToString(), search64bit.ToString()); |
@@ -1811,7 +1808,7 @@ namespace WixToolset.Core | |||
1811 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type")); | 1808 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type")); |
1812 | } | 1809 | } |
1813 | 1810 | ||
1814 | signature = id.Id; | 1811 | var signature = id.Id; |
1815 | var oneChild = false; | 1812 | var oneChild = false; |
1816 | foreach (var child in node.Elements()) | 1813 | foreach (var child in node.Elements()) |
1817 | { | 1814 | { |
@@ -2125,8 +2122,7 @@ namespace WixToolset.Core | |||
2125 | var sharedDllRefCount = false; | 2122 | var sharedDllRefCount = false; |
2126 | var transitive = false; | 2123 | var transitive = false; |
2127 | var uninstallWhenSuperseded = false; | 2124 | var uninstallWhenSuperseded = false; |
2128 | var explicitWin64 = false; | 2125 | var win64 = this.Context.IsCurrentPlatform64Bit; |
2129 | var win64 = false; | ||
2130 | 2126 | ||
2131 | var multiInstance = false; | 2127 | var multiInstance = false; |
2132 | var symbols = new List<string>(); | 2128 | var symbols = new List<string>(); |
@@ -2141,6 +2137,24 @@ namespace WixToolset.Core | |||
2141 | case "Id": | 2137 | case "Id": |
2142 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); | 2138 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); |
2143 | break; | 2139 | break; |
2140 | case "Bitness": | ||
2141 | var bitnessValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
2142 | switch (bitnessValue) | ||
2143 | { | ||
2144 | case "always32": | ||
2145 | win64 = false; | ||
2146 | break; | ||
2147 | case "always64": | ||
2148 | win64 = true; | ||
2149 | break; | ||
2150 | case "default": | ||
2151 | case "": | ||
2152 | break; | ||
2153 | default: | ||
2154 | this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, bitnessValue, "default", "always32", "always64")); | ||
2155 | break; | ||
2156 | } | ||
2157 | break; | ||
2144 | case "ComPlusFlags": | 2158 | case "ComPlusFlags": |
2145 | comPlusBits = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue); | 2159 | comPlusBits = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue); |
2146 | break; | 2160 | break; |
@@ -2240,15 +2254,6 @@ namespace WixToolset.Core | |||
2240 | // bits |= MsiInterop.MsidbComponentAttributesUninstallOnSupersedence; | 2254 | // bits |= MsiInterop.MsidbComponentAttributesUninstallOnSupersedence; |
2241 | //} | 2255 | //} |
2242 | break; | 2256 | break; |
2243 | case "Win64": | ||
2244 | explicitWin64 = true; | ||
2245 | win64 = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); | ||
2246 | //if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
2247 | //{ | ||
2248 | // bits |= MsiInterop.MsidbComponentAttributes64bit; | ||
2249 | // win64 = true; | ||
2250 | //} | ||
2251 | break; | ||
2252 | default: | 2257 | default: |
2253 | this.Core.UnexpectedAttribute(node, attrib); | 2258 | this.Core.UnexpectedAttribute(node, attrib); |
2254 | break; | 2259 | break; |
@@ -2260,12 +2265,6 @@ namespace WixToolset.Core | |||
2260 | } | 2265 | } |
2261 | } | 2266 | } |
2262 | 2267 | ||
2263 | if (!explicitWin64 && this.IsCurrentPlatform64Bit) | ||
2264 | { | ||
2265 | //bits |= MsiInterop.MsidbComponentAttributes64bit; | ||
2266 | win64 = true; | ||
2267 | } | ||
2268 | |||
2269 | if (id == null) | 2268 | if (id == null) |
2270 | { | 2269 | { |
2271 | // Placeholder id for defaulting Component/@Id to keypath id. | 2270 | // Placeholder id for defaulting Component/@Id to keypath id. |
@@ -3157,6 +3156,26 @@ namespace WixToolset.Core | |||
3157 | sourceType = CustomActionSourceType.Binary; | 3156 | sourceType = CustomActionSourceType.Binary; |
3158 | this.Core.CreateSimpleReference(sourceLineNumbers, SymbolDefinitions.Binary, source); // add a reference to the appropriate Binary | 3157 | this.Core.CreateSimpleReference(sourceLineNumbers, SymbolDefinitions.Binary, source); // add a reference to the appropriate Binary |
3159 | break; | 3158 | break; |
3159 | case "Bitness": | ||
3160 | var bitnessValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
3161 | switch (bitnessValue) | ||
3162 | { | ||
3163 | case "always32": | ||
3164 | explicitWin64 = true; | ||
3165 | win64 = false; | ||
3166 | break; | ||
3167 | case "always64": | ||
3168 | explicitWin64 = true; | ||
3169 | win64 = true; | ||
3170 | break; | ||
3171 | case "default": | ||
3172 | case "": | ||
3173 | break; | ||
3174 | default: | ||
3175 | this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, bitnessValue, "default", "always32", "always64")); | ||
3176 | break; | ||
3177 | } | ||
3178 | break; | ||
3160 | case "Directory": | 3179 | case "Directory": |
3161 | if (null != source) | 3180 | if (null != source) |
3162 | { | 3181 | { |
@@ -3345,10 +3364,6 @@ namespace WixToolset.Core | |||
3345 | target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid | 3364 | target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid |
3346 | targetType = CustomActionTargetType.VBScript; | 3365 | targetType = CustomActionTargetType.VBScript; |
3347 | break; | 3366 | break; |
3348 | case "Win64": | ||
3349 | explicitWin64 = true; | ||
3350 | win64 = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); | ||
3351 | break; | ||
3352 | default: | 3367 | default: |
3353 | this.Core.UnexpectedAttribute(node, attrib); | 3368 | this.Core.UnexpectedAttribute(node, attrib); |
3354 | break; | 3369 | break; |
@@ -3366,7 +3381,7 @@ namespace WixToolset.Core | |||
3366 | id = Identifier.Invalid; | 3381 | id = Identifier.Invalid; |
3367 | } | 3382 | } |
3368 | 3383 | ||
3369 | if (!explicitWin64 && this.IsCurrentPlatform64Bit && (CustomActionTargetType.VBScript == targetType || CustomActionTargetType.JScript == targetType)) | 3384 | if (!explicitWin64 && this.Context.IsCurrentPlatform64Bit && (CustomActionTargetType.VBScript == targetType || CustomActionTargetType.JScript == targetType)) |
3370 | { | 3385 | { |
3371 | win64 = true; | 3386 | win64 = true; |
3372 | } | 3387 | } |
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index 944f089e..7a386de7 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs | |||
@@ -33,7 +33,7 @@ namespace WixToolset.Core | |||
33 | Identifier id = null; | 33 | Identifier id = null; |
34 | string key = null; | 34 | string key = null; |
35 | string valueName = null; | 35 | string valueName = null; |
36 | var win64 = YesNoType.NotSet; | 36 | var win64 = this.Context.IsCurrentPlatform64Bit; |
37 | 37 | ||
38 | foreach (var attrib in node.Attributes()) | 38 | foreach (var attrib in node.Attributes()) |
39 | { | 39 | { |
@@ -44,15 +44,30 @@ namespace WixToolset.Core | |||
44 | case "Id": | 44 | case "Id": |
45 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); | 45 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); |
46 | break; | 46 | break; |
47 | case "Bitness": | ||
48 | var bitnessValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
49 | switch (bitnessValue) | ||
50 | { | ||
51 | case "always32": | ||
52 | win64 = false; | ||
53 | break; | ||
54 | case "always64": | ||
55 | win64 = true; | ||
56 | break; | ||
57 | case "default": | ||
58 | case "": | ||
59 | break; | ||
60 | default: | ||
61 | this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, bitnessValue, "default", "always32", "always64")); | ||
62 | break; | ||
63 | } | ||
64 | break; | ||
47 | case "Key": | 65 | case "Key": |
48 | key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 66 | key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
49 | break; | 67 | break; |
50 | case "Value": | 68 | case "Value": |
51 | valueName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 69 | valueName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
52 | break; | 70 | break; |
53 | case "Win64": | ||
54 | win64 = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); | ||
55 | break; | ||
56 | default: | 71 | default: |
57 | this.Core.UnexpectedAttribute(node, attrib); | 72 | this.Core.UnexpectedAttribute(node, attrib); |
58 | break; | 73 | break; |
@@ -76,7 +91,7 @@ namespace WixToolset.Core | |||
76 | 91 | ||
77 | var attributes = WixApprovedExeForElevationAttributes.None; | 92 | var attributes = WixApprovedExeForElevationAttributes.None; |
78 | 93 | ||
79 | if (win64 == YesNoType.Yes) | 94 | if (win64) |
80 | { | 95 | { |
81 | attributes |= WixApprovedExeForElevationAttributes.Win64; | 96 | attributes |= WixApprovedExeForElevationAttributes.Win64; |
82 | } | 97 | } |