diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2019-02-03 14:43:56 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2019-02-03 14:49:25 -0600 |
commit | 6f29d2fc2b3514cc85a7975e974e8e31f39288e2 (patch) | |
tree | ea93f131bdaef7c052cf9d3a855731d516c281ea /src/wixext | |
parent | 72f3dceefa2e3893b061e074380794bc60b67b6f (diff) | |
download | wix-6f29d2fc2b3514cc85a7975e974e8e31f39288e2.tar.gz wix-6f29d2fc2b3514cc85a7975e974e8e31f39288e2.tar.bz2 wix-6f29d2fc2b3514cc85a7975e974e8e31f39288e2.zip |
Integrate into latest v4.
Diffstat (limited to 'src/wixext')
-rw-r--r-- | src/wixext/DependencyCommon.cs | 2 | ||||
-rw-r--r-- | src/wixext/DependencyCompiler.cs | 263 | ||||
-rw-r--r-- | src/wixext/DependencyDecompiler.cs | 4 | ||||
-rw-r--r-- | src/wixext/DependencyErrors.cs | 37 | ||||
-rw-r--r-- | src/wixext/DependencyExtension.csproj | 50 | ||||
-rw-r--r-- | src/wixext/DependencyExtensionData.cs | 52 | ||||
-rw-r--r-- | src/wixext/DependencyExtensionFactory.cs | 18 | ||||
-rw-r--r-- | src/wixext/DependencyWarnings.cs | 60 | ||||
-rw-r--r-- | src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs (renamed from src/wixext/DependencyBinder.cs) | 32 | ||||
-rw-r--r-- | src/wixext/Tuples/DependencyTupleDefinitions.cs | 47 | ||||
-rw-r--r-- | src/wixext/Tuples/WixDependencyProviderTuple.cs | 87 | ||||
-rw-r--r-- | src/wixext/Tuples/WixDependencyRefTuple.cs | 55 | ||||
-rw-r--r-- | src/wixext/Tuples/WixDependencyTuple.cs | 79 | ||||
-rw-r--r-- | src/wixext/WixToolset.Dependency.wixext.csproj | 33 | ||||
-rw-r--r-- | src/wixext/WixToolset.Dependency.wixext.targets | 11 | ||||
-rw-r--r-- | src/wixext/messages.xml | 60 |
16 files changed, 592 insertions, 298 deletions
diff --git a/src/wixext/DependencyCommon.cs b/src/wixext/DependencyCommon.cs index 4826d8b0..cb36be36 100644 --- a/src/wixext/DependencyCommon.cs +++ b/src/wixext/DependencyCommon.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
2 | 2 | ||
3 | namespace WixToolset.Extensions | 3 | namespace WixToolset.Dependency |
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using WixToolset; | 6 | using WixToolset; |
diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs index a138c047..f866b589 100644 --- a/src/wixext/DependencyCompiler.cs +++ b/src/wixext/DependencyCompiler.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
2 | 2 | ||
3 | namespace WixToolset.Extensions | 3 | namespace WixToolset.Dependency |
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
@@ -9,11 +9,12 @@ namespace WixToolset.Extensions | |||
9 | using System.Xml.Linq; | 9 | using System.Xml.Linq; |
10 | using WixToolset.Data; | 10 | using WixToolset.Data; |
11 | using WixToolset.Extensibility; | 11 | using WixToolset.Extensibility; |
12 | using WixToolset.Extensibility.Data; | ||
12 | 13 | ||
13 | /// <summary> | 14 | /// <summary> |
14 | /// The compiler for the WiX toolset dependency extension. | 15 | /// The compiler for the WiX Toolset Dependency Extension. |
15 | /// </summary> | 16 | /// </summary> |
16 | public sealed class DependencyCompiler : CompilerExtension | 17 | public sealed class DependencyCompiler : BaseCompilerExtension |
17 | { | 18 | { |
18 | /// <summary> | 19 | /// <summary> |
19 | /// Package type when parsing the Provides element. | 20 | /// Package type when parsing the Provides element. |
@@ -27,10 +28,7 @@ namespace WixToolset.Extensions | |||
27 | MsuPackage | 28 | MsuPackage |
28 | } | 29 | } |
29 | 30 | ||
30 | public DependencyCompiler() | 31 | public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/dependency"; |
31 | { | ||
32 | this.Namespace = "http://wixtoolset.org/schemas/v4/wxs/dependency"; | ||
33 | } | ||
34 | 32 | ||
35 | /// <summary> | 33 | /// <summary> |
36 | /// Processes an attribute for the Compiler. | 34 | /// Processes an attribute for the Compiler. |
@@ -38,24 +36,24 @@ namespace WixToolset.Extensions | |||
38 | /// <param name="sourceLineNumbers">Source line number for the parent element.</param> | 36 | /// <param name="sourceLineNumbers">Source line number for the parent element.</param> |
39 | /// <param name="parentElement">Parent element of attribute.</param> | 37 | /// <param name="parentElement">Parent element of attribute.</param> |
40 | /// <param name="attribute">Attribute to process.</param> | 38 | /// <param name="attribute">Attribute to process.</param> |
41 | public override void ParseAttribute(XElement parentElement, XAttribute attribute, IDictionary<string, string> context) | 39 | public override void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary<string, string> context) |
42 | { | 40 | { |
43 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(parentElement); | 41 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); |
44 | switch (parentElement.Name.LocalName) | 42 | switch (parentElement.Name.LocalName) |
45 | { | 43 | { |
46 | case "Bundle": | 44 | case "Bundle": |
47 | switch (attribute.Name.LocalName) | 45 | switch (attribute.Name.LocalName) |
48 | { | 46 | { |
49 | case "ProviderKey": | 47 | case "ProviderKey": |
50 | this.ParseProviderKeyAttribute(sourceLineNumbers, parentElement, attribute); | 48 | this.ParseProviderKeyAttribute(section, sourceLineNumbers, parentElement, attribute); |
51 | break; | 49 | break; |
52 | default: | 50 | default: |
53 | this.Core.UnexpectedAttribute(parentElement, attribute); | 51 | this.ParseHelper.UnexpectedAttribute(parentElement, attribute); |
54 | break; | 52 | break; |
55 | } | 53 | } |
56 | break; | 54 | break; |
57 | default: | 55 | default: |
58 | this.Core.UnexpectedAttribute(parentElement, attribute); | 56 | this.ParseHelper.UnexpectedAttribute(parentElement, attribute); |
59 | break; | 57 | break; |
60 | } | 58 | } |
61 | } | 59 | } |
@@ -67,7 +65,7 @@ namespace WixToolset.Extensions | |||
67 | /// <param name="parentElement">Parent element of element to process.</param> | 65 | /// <param name="parentElement">Parent element of element to process.</param> |
68 | /// <param name="element">Element to process.</param> | 66 | /// <param name="element">Element to process.</param> |
69 | /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param> | 67 | /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param> |
70 | public override void ParseElement(XElement parentElement, XElement element, IDictionary<string, string> context) | 68 | public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context) |
71 | { | 69 | { |
72 | PackageType packageType = PackageType.None; | 70 | PackageType packageType = PackageType.None; |
73 | 71 | ||
@@ -80,10 +78,10 @@ namespace WixToolset.Extensions | |||
80 | switch (element.Name.LocalName) | 78 | switch (element.Name.LocalName) |
81 | { | 79 | { |
82 | case "Requires": | 80 | case "Requires": |
83 | this.ParseRequiresElement(element, null, false); | 81 | this.ParseRequiresElement(intermediate, section, element, null, false); |
84 | break; | 82 | break; |
85 | default: | 83 | default: |
86 | this.Core.UnexpectedElement(parentElement, element); | 84 | this.ParseHelper.UnexpectedElement(parentElement, element); |
87 | break; | 85 | break; |
88 | } | 86 | } |
89 | break; | 87 | break; |
@@ -100,7 +98,7 @@ namespace WixToolset.Extensions | |||
100 | packageType = PackageType.MsuPackage; | 98 | packageType = PackageType.MsuPackage; |
101 | break; | 99 | break; |
102 | default: | 100 | default: |
103 | this.Core.UnexpectedElement(parentElement, element); | 101 | this.ParseHelper.UnexpectedElement(parentElement, element); |
104 | break; | 102 | break; |
105 | } | 103 | } |
106 | 104 | ||
@@ -111,10 +109,10 @@ namespace WixToolset.Extensions | |||
111 | switch (element.Name.LocalName) | 109 | switch (element.Name.LocalName) |
112 | { | 110 | { |
113 | case "Provides": | 111 | case "Provides": |
114 | this.ParseProvidesElement(element, packageType, packageId); | 112 | this.ParseProvidesElement(intermediate, section, element, packageType, packageId); |
115 | break; | 113 | break; |
116 | default: | 114 | default: |
117 | this.Core.UnexpectedElement(parentElement, element); | 115 | this.ParseHelper.UnexpectedElement(parentElement, element); |
118 | break; | 116 | break; |
119 | } | 117 | } |
120 | } | 118 | } |
@@ -127,9 +125,9 @@ namespace WixToolset.Extensions | |||
127 | /// <param name="element">Element to process.</param> | 125 | /// <param name="element">Element to process.</param> |
128 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> | 126 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> |
129 | /// <returns>The component key path type if set.</returns> | 127 | /// <returns>The component key path type if set.</returns> |
130 | public override ComponentKeyPath ParsePossibleKeyPathElement(XElement parentElement, XElement element, IDictionary<string, string> context) | 128 | public override ComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context) |
131 | { | 129 | { |
132 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(parentElement); | 130 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); |
133 | ComponentKeyPath keyPath = null; | 131 | ComponentKeyPath keyPath = null; |
134 | 132 | ||
135 | switch (parentElement.Name.LocalName) | 133 | switch (parentElement.Name.LocalName) |
@@ -146,18 +144,18 @@ namespace WixToolset.Extensions | |||
146 | case "Provides": | 144 | case "Provides": |
147 | if (win64) | 145 | if (win64) |
148 | { | 146 | { |
149 | this.Core.OnMessage(DependencyWarnings.Win64Component(sourceLineNumbers, componentId)); | 147 | this.Messaging.Write(DependencyWarnings.Win64Component(sourceLineNumbers, componentId)); |
150 | } | 148 | } |
151 | 149 | ||
152 | keyPath = this.ParseProvidesElement(element, PackageType.None, componentId); | 150 | keyPath = this.ParseProvidesElement(intermediate, section, element, PackageType.None, componentId); |
153 | break; | 151 | break; |
154 | default: | 152 | default: |
155 | this.Core.UnexpectedElement(parentElement, element); | 153 | this.ParseHelper.UnexpectedElement(parentElement, element); |
156 | break; | 154 | break; |
157 | } | 155 | } |
158 | break; | 156 | break; |
159 | default: | 157 | default: |
160 | this.Core.UnexpectedElement(parentElement, element); | 158 | this.ParseHelper.UnexpectedElement(parentElement, element); |
161 | break; | 159 | break; |
162 | } | 160 | } |
163 | 161 | ||
@@ -170,7 +168,7 @@ namespace WixToolset.Extensions | |||
170 | /// <param name="sourceLineNumbers">Source line number for the parent element.</param> | 168 | /// <param name="sourceLineNumbers">Source line number for the parent element.</param> |
171 | /// <param name="parentElement">Parent element of attribute.</param> | 169 | /// <param name="parentElement">Parent element of attribute.</param> |
172 | /// <param name="attribute">The XML attribute for the ProviderKey attribute.</param> | 170 | /// <param name="attribute">The XML attribute for the ProviderKey attribute.</param> |
173 | private void ParseProviderKeyAttribute(SourceLineNumber sourceLineNumbers, XElement parentElement, XAttribute attribute) | 171 | private void ParseProviderKeyAttribute(IntermediateSection section, SourceLineNumber sourceLineNumbers, XElement parentElement, XAttribute attribute) |
174 | { | 172 | { |
175 | Identifier id = null; | 173 | Identifier id = null; |
176 | string providerKey = null; | 174 | string providerKey = null; |
@@ -179,41 +177,41 @@ namespace WixToolset.Extensions | |||
179 | switch (attribute.Name.LocalName) | 177 | switch (attribute.Name.LocalName) |
180 | { | 178 | { |
181 | case "ProviderKey": | 179 | case "ProviderKey": |
182 | providerKey = this.Core.GetAttributeValue(sourceLineNumbers, attribute); | 180 | providerKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attribute); |
183 | break; | 181 | break; |
184 | default: | 182 | default: |
185 | this.Core.UnexpectedAttribute(parentElement, attribute); | 183 | this.ParseHelper.UnexpectedAttribute(parentElement, attribute); |
186 | break; | 184 | break; |
187 | } | 185 | } |
188 | 186 | ||
189 | // Make sure the key does not contain any illegal characters or values. | 187 | // Make sure the key does not contain any illegal characters or values. |
190 | if (String.IsNullOrEmpty(providerKey)) | 188 | if (String.IsNullOrEmpty(providerKey)) |
191 | { | 189 | { |
192 | this.Core.OnMessage(WixErrors.IllegalEmptyAttributeValue(sourceLineNumbers, parentElement.Name.LocalName, attribute.Name.LocalName)); | 190 | this.Messaging.Write(ErrorMessages.IllegalEmptyAttributeValue(sourceLineNumbers, parentElement.Name.LocalName, attribute.Name.LocalName)); |
193 | } | 191 | } |
194 | else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) | 192 | else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) |
195 | { | 193 | { |
196 | StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); | 194 | StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); |
197 | Array.ForEach<char>(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); | 195 | Array.ForEach<char>(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); |
198 | 196 | ||
199 | this.Core.OnMessage(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); | 197 | this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); |
200 | } | 198 | } |
201 | else if ("ALL" == providerKey) | 199 | else if ("ALL" == providerKey) |
202 | { | 200 | { |
203 | this.Core.OnMessage(DependencyErrors.ReservedValue(sourceLineNumbers, parentElement.Name.LocalName, "ProviderKey", providerKey)); | 201 | this.Messaging.Write(DependencyErrors.ReservedValue(sourceLineNumbers, parentElement.Name.LocalName, "ProviderKey", providerKey)); |
204 | } | 202 | } |
205 | 203 | ||
206 | // Generate the primary key for the row. | 204 | // Generate the primary key for the row. |
207 | id = this.Core.CreateIdentifier("dep", attribute.Name.LocalName, providerKey); | 205 | id = this.ParseHelper.CreateIdentifier("dep", attribute.Name.LocalName, providerKey); |
208 | 206 | ||
209 | if (!this.Core.EncounteredError) | 207 | if (!this.Messaging.EncounteredError) |
210 | { | 208 | { |
211 | // Create the provider row for the bundle. The Component_ field is required | 209 | // Create the provider row for the bundle. The Component_ field is required |
212 | // in the table definition but unused for bundles, so just set it to the valid ID. | 210 | // in the table definition but unused for bundles, so just set it to the valid ID. |
213 | Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyProvider", id); | 211 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyProvider", id); |
214 | row[1] = id.Id; | 212 | row.Set(1, id.Id); |
215 | row[2] = providerKey; | 213 | row.Set(2, providerKey); |
216 | row[5] = DependencyCommon.ProvidesAttributesBundle; | 214 | row.Set(5, DependencyCommon.ProvidesAttributesBundle); |
217 | } | 215 | } |
218 | } | 216 | } |
219 | 217 | ||
@@ -225,9 +223,9 @@ namespace WixToolset.Extensions | |||
225 | /// <param name="keyPath">Explicit key path.</param> | 223 | /// <param name="keyPath">Explicit key path.</param> |
226 | /// <param name="parentId">The identifier of the parent component or package.</param> | 224 | /// <param name="parentId">The identifier of the parent component or package.</param> |
227 | /// <returns>The type of key path if set.</returns> | 225 | /// <returns>The type of key path if set.</returns> |
228 | private ComponentKeyPath ParseProvidesElement(XElement node, PackageType packageType, string parentId) | 226 | private ComponentKeyPath ParseProvidesElement(Intermediate intermediate, IntermediateSection section, XElement node, PackageType packageType, string parentId) |
229 | { | 227 | { |
230 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 228 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
231 | ComponentKeyPath keyPath = null; | 229 | ComponentKeyPath keyPath = null; |
232 | Identifier id = null; | 230 | Identifier id = null; |
233 | string key = null; | 231 | string key = null; |
@@ -243,25 +241,25 @@ namespace WixToolset.Extensions | |||
243 | switch (attrib.Name.LocalName) | 241 | switch (attrib.Name.LocalName) |
244 | { | 242 | { |
245 | case "Id": | 243 | case "Id": |
246 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); | 244 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
247 | break; | 245 | break; |
248 | case "Key": | 246 | case "Key": |
249 | key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 247 | key = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
250 | break; | 248 | break; |
251 | case "Version": | 249 | case "Version": |
252 | version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); | 250 | version = this.ParseHelper.GetAttributeVersionValue(sourceLineNumbers, attrib); |
253 | break; | 251 | break; |
254 | case "DisplayName": | 252 | case "DisplayName": |
255 | displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 253 | displayName = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
256 | break; | 254 | break; |
257 | default: | 255 | default: |
258 | this.Core.UnexpectedAttribute(node, attrib); | 256 | this.ParseHelper.UnexpectedAttribute(node, attrib); |
259 | break; | 257 | break; |
260 | } | 258 | } |
261 | } | 259 | } |
262 | else | 260 | else |
263 | { | 261 | { |
264 | this.Core.ParseExtensionAttribute(node, attrib); | 262 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); |
265 | } | 263 | } |
266 | } | 264 | } |
267 | 265 | ||
@@ -275,22 +273,22 @@ namespace WixToolset.Extensions | |||
275 | StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); | 273 | StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); |
276 | Array.ForEach<char>(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); | 274 | Array.ForEach<char>(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); |
277 | 275 | ||
278 | this.Core.OnMessage(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "Key", key[illegalChar], sb.ToString())); | 276 | this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "Key", key[illegalChar], sb.ToString())); |
279 | } | 277 | } |
280 | else if ("ALL" == key) | 278 | else if ("ALL" == key) |
281 | { | 279 | { |
282 | this.Core.OnMessage(DependencyErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Key", key)); | 280 | this.Messaging.Write(DependencyErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Key", key)); |
283 | } | 281 | } |
284 | } | 282 | } |
285 | else if (PackageType.ExePackage == packageType || PackageType.MsuPackage == packageType) | 283 | else if (PackageType.ExePackage == packageType || PackageType.MsuPackage == packageType) |
286 | { | 284 | { |
287 | // Must specify the provider key when authored for a package. | 285 | // Must specify the provider key when authored for a package. |
288 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); | 286 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); |
289 | } | 287 | } |
290 | else if (PackageType.None == packageType) | 288 | else if (PackageType.None == packageType) |
291 | { | 289 | { |
292 | // Make sure the ProductCode is authored and set the key. | 290 | // Make sure the ProductCode is authored and set the key. |
293 | this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "ProductCode"); | 291 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Property", "ProductCode"); |
294 | key = "!(bind.property.ProductCode)"; | 292 | key = "!(bind.property.ProductCode)"; |
295 | } | 293 | } |
296 | 294 | ||
@@ -300,23 +298,23 @@ namespace WixToolset.Extensions | |||
300 | switch (packageType) | 298 | switch (packageType) |
301 | { | 299 | { |
302 | case PackageType.None: | 300 | case PackageType.None: |
303 | this.Core.OnMessage(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers)); | 301 | this.Messaging.Write(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers)); |
304 | break; | 302 | break; |
305 | case PackageType.MsiPackage: | 303 | case PackageType.MsiPackage: |
306 | this.Core.OnMessage(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers, parentId)); | 304 | this.Messaging.Write(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers, parentId)); |
307 | break; | 305 | break; |
308 | } | 306 | } |
309 | } | 307 | } |
310 | else if (PackageType.MspPackage == packageType || PackageType.MsuPackage == packageType) | 308 | else if (PackageType.MspPackage == packageType || PackageType.MsuPackage == packageType) |
311 | { | 309 | { |
312 | // Must specify the Version when authored for packages that do not contain a version. | 310 | // Must specify the Version when authored for packages that do not contain a version. |
313 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); | 311 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); |
314 | } | 312 | } |
315 | 313 | ||
316 | // Need the element ID for child element processing, so generate now if not authored. | 314 | // Need the element ID for child element processing, so generate now if not authored. |
317 | if (null == id) | 315 | if (null == id) |
318 | { | 316 | { |
319 | id = this.Core.CreateIdentifier("dep", node.Name.LocalName, parentId, key); | 317 | id = this.ParseHelper.CreateIdentifier("dep", node.Name.LocalName, parentId, key); |
320 | } | 318 | } |
321 | 319 | ||
322 | foreach (XElement child in node.Elements()) | 320 | foreach (XElement child in node.Elements()) |
@@ -326,94 +324,93 @@ namespace WixToolset.Extensions | |||
326 | switch (child.Name.LocalName) | 324 | switch (child.Name.LocalName) |
327 | { | 325 | { |
328 | case "Requires": | 326 | case "Requires": |
329 | this.ParseRequiresElement(child, id.Id, PackageType.None == packageType); | 327 | this.ParseRequiresElement(intermediate, section, child, id.Id, PackageType.None == packageType); |
330 | break; | 328 | break; |
331 | case "RequiresRef": | 329 | case "RequiresRef": |
332 | this.ParseRequiresRefElement(child, id.Id, PackageType.None == packageType); | 330 | this.ParseRequiresRefElement(intermediate, section, child, id.Id, PackageType.None == packageType); |
333 | break; | 331 | break; |
334 | default: | 332 | default: |
335 | this.Core.UnexpectedElement(node, child); | 333 | this.ParseHelper.UnexpectedElement(node, child); |
336 | break; | 334 | break; |
337 | } | 335 | } |
338 | } | 336 | } |
339 | else | 337 | else |
340 | { | 338 | { |
341 | this.Core.ParseExtensionElement(node, child); | 339 | this.ParseHelper.ParseExtensionElement(this.Context.Extensions, intermediate, section, node, child); |
342 | } | 340 | } |
343 | } | 341 | } |
344 | 342 | ||
345 | if (!this.Core.EncounteredError) | 343 | if (!this.Messaging.EncounteredError) |
346 | { | 344 | { |
347 | // Create the row in the provider table. | 345 | // Create the row in the provider table. |
348 | Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyProvider", id); | 346 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyProvider", id); |
349 | row[1] = parentId; | 347 | row.Set(1, parentId); |
350 | row[2] = key; | 348 | row.Set(2, key); |
351 | 349 | ||
352 | if (!String.IsNullOrEmpty(version)) | 350 | if (!String.IsNullOrEmpty(version)) |
353 | { | 351 | { |
354 | row[3] = version; | 352 | row.Set(3, version); |
355 | } | 353 | } |
356 | 354 | ||
357 | if (!String.IsNullOrEmpty(displayName)) | 355 | if (!String.IsNullOrEmpty(displayName)) |
358 | { | 356 | { |
359 | row[4] = displayName; | 357 | row.Set(4, displayName); |
360 | } | 358 | } |
361 | 359 | ||
362 | if (0 != attributes) | 360 | if (0 != attributes) |
363 | { | 361 | { |
364 | row[5] = attributes; | 362 | row.Set(5, attributes); |
365 | } | 363 | } |
366 | 364 | ||
367 | if (PackageType.None == packageType) | 365 | if (PackageType.None == packageType) |
368 | { | 366 | { |
369 | // Reference the Check custom action to check for dependencies on the current provider. | 367 | // Reference the Check custom action to check for dependencies on the current provider. |
370 | if (Platform.ARM == this.Core.CurrentPlatform) | 368 | if (Platform.ARM == this.Context.Platform) |
371 | { | 369 | { |
372 | // Ensure the ARM version of the CA is referenced. | 370 | // Ensure the ARM version of the CA is referenced. |
373 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyCheck_ARM"); | 371 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyCheck_ARM"); |
374 | } | 372 | } |
375 | else | 373 | else |
376 | { | 374 | { |
377 | // All other supported platforms use x86. | 375 | // All other supported platforms use x86. |
378 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyCheck"); | 376 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyCheck"); |
379 | } | 377 | } |
380 | 378 | ||
381 | // Generate registry rows for the provider using binder properties. | 379 | // Generate registry rows for the provider using binder properties. |
382 | string keyProvides = String.Concat(DependencyCommon.RegistryRoot, key); | 380 | string keyProvides = String.Concat(DependencyCommon.RegistryRoot, key); |
383 | 381 | ||
384 | row = this.Core.CreateRow(sourceLineNumbers, "Registry", this.Core.CreateIdentifier("reg", id.Id, "(Default)")); | 382 | row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "(Default)")); |
385 | row[1] = -1; | 383 | row.Set(1, -1); |
386 | row[2] = keyProvides; | 384 | row.Set(2, keyProvides); |
387 | row[3] = null; | 385 | row.Set(4, "[ProductCode]"); |
388 | row[4] = "[ProductCode]"; | 386 | row.Set(5, parentId); |
389 | row[5] = parentId; | ||
390 | 387 | ||
391 | // Use the Version registry value and use that as a potential key path. | 388 | // Use the Version registry value and use that as a potential key path. |
392 | Identifier idVersion = this.Core.CreateIdentifier("reg", id.Id, "Version"); | 389 | Identifier idVersion = this.ParseHelper.CreateIdentifier("reg", id.Id, "Version"); |
393 | keyPath = new ComponentKeyPath() { Id = idVersion.Id, Explicit = false, Type = ComponentKeyPathType.Registry }; | 390 | keyPath = new ComponentKeyPath() { Id = idVersion.Id, Explicit = false, Type = ComponentKeyPathType.Registry }; |
394 | 391 | ||
395 | row = this.Core.CreateRow(sourceLineNumbers, "Registry", idVersion); | 392 | row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", idVersion); |
396 | row[1] = -1; | 393 | row.Set(1, -1); |
397 | row[2] = keyProvides; | 394 | row.Set(2, keyProvides); |
398 | row[3] = "Version"; | 395 | row.Set(3, "Version"); |
399 | row[4] = !String.IsNullOrEmpty(version) ? version : "[ProductVersion]"; | 396 | row.Set(4, !String.IsNullOrEmpty(version) ? version : "[ProductVersion]"); |
400 | row[5] = parentId; | 397 | row.Set(5, parentId); |
401 | 398 | ||
402 | row = this.Core.CreateRow(sourceLineNumbers, "Registry", this.Core.CreateIdentifier("reg", id.Id, "DisplayName")); | 399 | row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "DisplayName")); |
403 | row[1] = -1; | 400 | row.Set(1, -1); |
404 | row[2] = keyProvides; | 401 | row.Set(2, keyProvides); |
405 | row[3] = "DisplayName"; | 402 | row.Set(3, "DisplayName"); |
406 | row[4] = !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]"; | 403 | row.Set(4, !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]"); |
407 | row[5] = parentId; | 404 | row.Set(5, parentId); |
408 | 405 | ||
409 | if (0 != attributes) | 406 | if (0 != attributes) |
410 | { | 407 | { |
411 | row = this.Core.CreateRow(sourceLineNumbers, "Registry", this.Core.CreateIdentifier("reg", id.Id, "Attributes")); | 408 | row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "Attributes")); |
412 | row[1] = -1; | 409 | row.Set(1, -1); |
413 | row[2] = keyProvides; | 410 | row.Set(2, keyProvides); |
414 | row[3] = "Attributes"; | 411 | row.Set(3, "Attributes"); |
415 | row[4] = String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat)); | 412 | row.Set(4, String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat))); |
416 | row[5] = parentId; | 413 | row.Set(5, parentId); |
417 | } | 414 | } |
418 | } | 415 | } |
419 | } | 416 | } |
@@ -427,9 +424,9 @@ namespace WixToolset.Extensions | |||
427 | /// <param name="node">The XML node for the Requires element.</param> | 424 | /// <param name="node">The XML node for the Requires element.</param> |
428 | /// <param name="providerId">The parent provider identifier.</param> | 425 | /// <param name="providerId">The parent provider identifier.</param> |
429 | /// <param name="requiresAction">Whether the Requires custom action should be referenced.</param> | 426 | /// <param name="requiresAction">Whether the Requires custom action should be referenced.</param> |
430 | private void ParseRequiresElement(XElement node, string providerId, bool requiresAction) | 427 | private void ParseRequiresElement(Intermediate intermediate, IntermediateSection section, XElement node, string providerId, bool requiresAction) |
431 | { | 428 | { |
432 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 429 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
433 | Identifier id = null; | 430 | Identifier id = null; |
434 | string providerKey = null; | 431 | string providerKey = null; |
435 | string minVersion = null; | 432 | string minVersion = null; |
@@ -444,41 +441,41 @@ namespace WixToolset.Extensions | |||
444 | switch (attrib.Name.LocalName) | 441 | switch (attrib.Name.LocalName) |
445 | { | 442 | { |
446 | case "Id": | 443 | case "Id": |
447 | id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); | 444 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
448 | break; | 445 | break; |
449 | case "ProviderKey": | 446 | case "ProviderKey": |
450 | providerKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 447 | providerKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
451 | break; | 448 | break; |
452 | case "Minimum": | 449 | case "Minimum": |
453 | minVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); | 450 | minVersion = this.ParseHelper.GetAttributeVersionValue(sourceLineNumbers, attrib); |
454 | break; | 451 | break; |
455 | case "Maximum": | 452 | case "Maximum": |
456 | maxVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); | 453 | maxVersion = this.ParseHelper.GetAttributeVersionValue(sourceLineNumbers, attrib); |
457 | break; | 454 | break; |
458 | case "IncludeMinimum": | 455 | case "IncludeMinimum": |
459 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 456 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
460 | { | 457 | { |
461 | attributes |= DependencyCommon.RequiresAttributesMinVersionInclusive; | 458 | attributes |= DependencyCommon.RequiresAttributesMinVersionInclusive; |
462 | } | 459 | } |
463 | break; | 460 | break; |
464 | case "IncludeMaximum": | 461 | case "IncludeMaximum": |
465 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 462 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
466 | { | 463 | { |
467 | attributes |= DependencyCommon.RequiresAttributesMaxVersionInclusive; | 464 | attributes |= DependencyCommon.RequiresAttributesMaxVersionInclusive; |
468 | } | 465 | } |
469 | break; | 466 | break; |
470 | default: | 467 | default: |
471 | this.Core.UnexpectedAttribute(node, attrib); | 468 | this.ParseHelper.UnexpectedAttribute(node, attrib); |
472 | break; | 469 | break; |
473 | } | 470 | } |
474 | } | 471 | } |
475 | else | 472 | else |
476 | { | 473 | { |
477 | this.Core.ParseExtensionAttribute(node, attrib); | 474 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); |
478 | } | 475 | } |
479 | } | 476 | } |
480 | 477 | ||
481 | this.Core.ParseForExtensionElements(node); | 478 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); |
482 | 479 | ||
483 | if (null == id) | 480 | if (null == id) |
484 | { | 481 | { |
@@ -486,18 +483,18 @@ namespace WixToolset.Extensions | |||
486 | // element will be necessary and the Id attribute will be required. | 483 | // element will be necessary and the Id attribute will be required. |
487 | if (!String.IsNullOrEmpty(providerId)) | 484 | if (!String.IsNullOrEmpty(providerId)) |
488 | { | 485 | { |
489 | id = this.Core.CreateIdentifier("dep", node.Name.LocalName, providerKey); | 486 | id = this.ParseHelper.CreateIdentifier("dep", node.Name.LocalName, providerKey); |
490 | } | 487 | } |
491 | else | 488 | else |
492 | { | 489 | { |
493 | this.Core.OnMessage(WixErrors.ExpectedAttributeWhenElementNotUnderElement(sourceLineNumbers, node.Name.LocalName, "Id", "Provides")); | 490 | this.Messaging.Write(ErrorMessages.ExpectedAttributeWhenElementNotUnderElement(sourceLineNumbers, node.Name.LocalName, "Id", "Provides")); |
494 | id = Identifier.Invalid; | 491 | id = Identifier.Invalid; |
495 | } | 492 | } |
496 | } | 493 | } |
497 | 494 | ||
498 | if (String.IsNullOrEmpty(providerKey)) | 495 | if (String.IsNullOrEmpty(providerKey)) |
499 | { | 496 | { |
500 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ProviderKey")); | 497 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ProviderKey")); |
501 | } | 498 | } |
502 | // Make sure the key does not contain any illegal characters. | 499 | // Make sure the key does not contain any illegal characters. |
503 | else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) | 500 | else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) |
@@ -505,44 +502,44 @@ namespace WixToolset.Extensions | |||
505 | StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); | 502 | StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); |
506 | Array.ForEach<char>(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); | 503 | Array.ForEach<char>(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); |
507 | 504 | ||
508 | this.Core.OnMessage(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); | 505 | this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); |
509 | } | 506 | } |
510 | 507 | ||
511 | 508 | ||
512 | if (!this.Core.EncounteredError) | 509 | if (!this.Messaging.EncounteredError) |
513 | { | 510 | { |
514 | // Reference the Require custom action if required. | 511 | // Reference the Require custom action if required. |
515 | if (requiresAction) | 512 | if (requiresAction) |
516 | { | 513 | { |
517 | if (Platform.ARM == this.Core.CurrentPlatform) | 514 | if (Platform.ARM == this.Context.Platform) |
518 | { | 515 | { |
519 | // Ensure the ARM version of the CA is referenced. | 516 | // Ensure the ARM version of the CA is referenced. |
520 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); | 517 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); |
521 | } | 518 | } |
522 | else | 519 | else |
523 | { | 520 | { |
524 | // All other supported platforms use x86. | 521 | // All other supported platforms use x86. |
525 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire"); | 522 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire"); |
526 | } | 523 | } |
527 | } | 524 | } |
528 | 525 | ||
529 | Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependency", id); | 526 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependency", id); |
530 | row[1] = providerKey; | 527 | row.Set(1, providerKey); |
531 | row[2] = minVersion; | 528 | row.Set(2, minVersion); |
532 | row[3] = maxVersion; | 529 | row.Set(3, maxVersion); |
533 | 530 | ||
534 | if (0 != attributes) | 531 | if (0 != attributes) |
535 | { | 532 | { |
536 | row[4] = attributes; | 533 | row.Set(4, attributes); |
537 | } | 534 | } |
538 | 535 | ||
539 | // Create the relationship between this WixDependency row and the WixDependencyProvider row. | 536 | // Create the relationship between this WixDependency row and the WixDependencyProvider row. |
540 | if (!String.IsNullOrEmpty(providerId)) | 537 | if (!String.IsNullOrEmpty(providerId)) |
541 | { | 538 | { |
542 | // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. | 539 | // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. |
543 | row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyRef"); | 540 | row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyRef"); |
544 | row[0] = providerId; | 541 | row.Set(0, providerId); |
545 | row[1] = id.Id; | 542 | row.Set(1, id.Id); |
546 | } | 543 | } |
547 | } | 544 | } |
548 | } | 545 | } |
@@ -553,9 +550,9 @@ namespace WixToolset.Extensions | |||
553 | /// <param name="node">The XML node for the RequiresRef element.</param> | 550 | /// <param name="node">The XML node for the RequiresRef element.</param> |
554 | /// <param name="providerId">The parent provider identifier.</param> | 551 | /// <param name="providerId">The parent provider identifier.</param> |
555 | /// <param name="requiresAction">Whether the Requires custom action should be referenced.</param> | 552 | /// <param name="requiresAction">Whether the Requires custom action should be referenced.</param> |
556 | private void ParseRequiresRefElement(XElement node, string providerId, bool requiresAction) | 553 | private void ParseRequiresRefElement(Intermediate intermediate, IntermediateSection section, XElement node, string providerId, bool requiresAction) |
557 | { | 554 | { |
558 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 555 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
559 | string id = null; | 556 | string id = null; |
560 | 557 | ||
561 | foreach (XAttribute attrib in node.Attributes()) | 558 | foreach (XAttribute attrib in node.Attributes()) |
@@ -565,50 +562,50 @@ namespace WixToolset.Extensions | |||
565 | switch (attrib.Name.LocalName) | 562 | switch (attrib.Name.LocalName) |
566 | { | 563 | { |
567 | case "Id": | 564 | case "Id": |
568 | id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 565 | id = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
569 | break; | 566 | break; |
570 | default: | 567 | default: |
571 | this.Core.UnexpectedAttribute(node, attrib); | 568 | this.ParseHelper.UnexpectedAttribute(node, attrib); |
572 | break; | 569 | break; |
573 | } | 570 | } |
574 | } | 571 | } |
575 | else | 572 | else |
576 | { | 573 | { |
577 | this.Core.ParseExtensionAttribute(node, attrib); | 574 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); |
578 | } | 575 | } |
579 | } | 576 | } |
580 | 577 | ||
581 | this.Core.ParseForExtensionElements(node); | 578 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); |
582 | 579 | ||
583 | if (String.IsNullOrEmpty(id)) | 580 | if (String.IsNullOrEmpty(id)) |
584 | { | 581 | { |
585 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); | 582 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); |
586 | } | 583 | } |
587 | 584 | ||
588 | if (!this.Core.EncounteredError) | 585 | if (!this.Messaging.EncounteredError) |
589 | { | 586 | { |
590 | // Reference the Require custom action if required. | 587 | // Reference the Require custom action if required. |
591 | if (requiresAction) | 588 | if (requiresAction) |
592 | { | 589 | { |
593 | if (Platform.ARM == this.Core.CurrentPlatform) | 590 | if (Platform.ARM == this.Context.Platform) |
594 | { | 591 | { |
595 | // Ensure the ARM version of the CA is referenced. | 592 | // Ensure the ARM version of the CA is referenced. |
596 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); | 593 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); |
597 | } | 594 | } |
598 | else | 595 | else |
599 | { | 596 | { |
600 | // All other supported platforms use x86. | 597 | // All other supported platforms use x86. |
601 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire"); | 598 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire"); |
602 | } | 599 | } |
603 | } | 600 | } |
604 | 601 | ||
605 | // Create a link dependency on the row that contains information we'll need during bind. | 602 | // Create a link dependency on the row that contains information we'll need during bind. |
606 | this.Core.CreateSimpleReference(sourceLineNumbers, "WixDependency", id); | 603 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "WixDependency", id); |
607 | 604 | ||
608 | // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. | 605 | // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. |
609 | Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyRef"); | 606 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyRef"); |
610 | row[0] = providerId; | 607 | row.Set(0, providerId); |
611 | row[1] = id; | 608 | row.Set(1, id); |
612 | } | 609 | } |
613 | } | 610 | } |
614 | } | 611 | } |
diff --git a/src/wixext/DependencyDecompiler.cs b/src/wixext/DependencyDecompiler.cs index 3013cf7c..31de3097 100644 --- a/src/wixext/DependencyDecompiler.cs +++ b/src/wixext/DependencyDecompiler.cs | |||
@@ -1,7 +1,8 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
2 | 2 | ||
3 | namespace WixToolset.Extensions | 3 | namespace WixToolset.Dependency |
4 | { | 4 | { |
5 | #if TODO_CONSIDER_DECOMPILER | ||
5 | using System; | 6 | using System; |
6 | using System.Collections.Generic; | 7 | using System.Collections.Generic; |
7 | using System.Collections.ObjectModel; | 8 | using System.Collections.ObjectModel; |
@@ -342,4 +343,5 @@ namespace WixToolset.Extensions | |||
342 | } | 343 | } |
343 | } | 344 | } |
344 | } | 345 | } |
346 | #endif | ||
345 | } | 347 | } |
diff --git a/src/wixext/DependencyErrors.cs b/src/wixext/DependencyErrors.cs new file mode 100644 index 00000000..83c0986a --- /dev/null +++ b/src/wixext/DependencyErrors.cs | |||
@@ -0,0 +1,37 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Dependency | ||
4 | { | ||
5 | using System; | ||
6 | using System.Resources; | ||
7 | using WixToolset.Data; | ||
8 | |||
9 | public static class DependencyErrors | ||
10 | { | ||
11 | public static Message IllegalCharactersInProvider(SourceLineNumber sourceLineNumbers, string attributeName, Char illegalChar, string illegalChars) | ||
12 | { | ||
13 | return Message(sourceLineNumbers, Ids.IllegalCharactersInProvider, "The provider key authored into the {0} attribute contains an illegal character, '{1}'. Please author the provider key without any of the following characters: {2}", attributeName, illegalChar, illegalChars); | ||
14 | } | ||
15 | |||
16 | public static Message ReservedValue(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string attributeValue) | ||
17 | { | ||
18 | return Message(sourceLineNumbers, Ids.ReservedValue, "The {0}/@{1} attribute value '{2}' is reserved and cannot be used here. Please choose a different value.", elementName, attributeName, attributeValue); | ||
19 | } | ||
20 | |||
21 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) | ||
22 | { | ||
23 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); | ||
24 | } | ||
25 | |||
26 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) | ||
27 | { | ||
28 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, resourceManager, resourceName, args); | ||
29 | } | ||
30 | |||
31 | public enum Ids | ||
32 | { | ||
33 | IllegalCharactersInProvider = 5400, | ||
34 | ReservedValue = 5401, | ||
35 | } | ||
36 | } | ||
37 | } | ||
diff --git a/src/wixext/DependencyExtension.csproj b/src/wixext/DependencyExtension.csproj deleted file mode 100644 index 050e8662..00000000 --- a/src/wixext/DependencyExtension.csproj +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | |||
4 | |||
5 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | ||
6 | <PropertyGroup> | ||
7 | <ProjectGuid>{A0B6D3F1-AE5E-423B-BA92-60C9926CA498}</ProjectGuid> | ||
8 | <AssemblyName>WixDependencyExtension</AssemblyName> | ||
9 | <OutputType>Library</OutputType> | ||
10 | <RootNamespace>WixToolset.Extensions</RootNamespace> | ||
11 | </PropertyGroup> | ||
12 | <ItemGroup> | ||
13 | <Compile Include="AssemblyInfo.cs" /> | ||
14 | <Compile Include="DependencyBinder.cs" /> | ||
15 | <Compile Include="DependencyCommon.cs" /> | ||
16 | <Compile Include="DependencyCompiler.cs" /> | ||
17 | <Compile Include="DependencyDecompiler.cs" /> | ||
18 | <Compile Include="DependencyExtensionData.cs" /> | ||
19 | <EmbeddedFlattenedResource Include="Data\tables.xml"> | ||
20 | <LogicalName>$(RootNamespace).Data.tables.xml</LogicalName> | ||
21 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
22 | </EmbeddedFlattenedResource> | ||
23 | <MsgGenSource Include="Data\messages.xml"> | ||
24 | <ResourcesLogicalName>$(RootNamespace).Data.Messages.resources</ResourcesLogicalName> | ||
25 | </MsgGenSource> | ||
26 | <EmbeddedFlattenedResource Include="Xsd\Dependency.xsd"> | ||
27 | <LogicalName>$(RootNamespace).Xsd.Dependency.xsd</LogicalName> | ||
28 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
29 | </EmbeddedFlattenedResource> | ||
30 | <XsdGenSource Include="Xsd\Dependency.xsd"> | ||
31 | <CommonNamespace>WixToolset.Data.Serialize</CommonNamespace> | ||
32 | <Namespace>WixToolset.Extensions.Serialize.Dependency</Namespace> | ||
33 | </XsdGenSource> | ||
34 | <EmbeddedResource Include="$(OutputPath)Dependency.wixlib"> | ||
35 | <Link>Data\Dependency.wixlib</Link> | ||
36 | </EmbeddedResource> | ||
37 | </ItemGroup> | ||
38 | <ItemGroup> | ||
39 | <Reference Include="System" /> | ||
40 | <Reference Include="System.Xml" /> | ||
41 | <Reference Include="System.Xml.Linq" /> | ||
42 | <ProjectReference Include="..\..\..\libs\WixToolset.Data\WixToolset.Data.csproj" /> | ||
43 | <ProjectReference Include="..\..\..\libs\WixToolset.Extensibility\WixToolset.Extensibility.csproj" /> | ||
44 | <ProjectReference Include="..\..\..\tools\wix\Wix.csproj" /> | ||
45 | <ProjectReference Include="..\wixlib\DependencyExtension.wixproj"> | ||
46 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
47 | </ProjectReference> | ||
48 | </ItemGroup> | ||
49 | <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.targets" /> | ||
50 | </Project> | ||
diff --git a/src/wixext/DependencyExtensionData.cs b/src/wixext/DependencyExtensionData.cs index da2215ce..e92aeff1 100644 --- a/src/wixext/DependencyExtensionData.cs +++ b/src/wixext/DependencyExtensionData.cs | |||
@@ -1,64 +1,30 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
2 | 2 | ||
3 | namespace WixToolset.Extensions | 3 | namespace WixToolset.Dependency |
4 | { | 4 | { |
5 | using System; | ||
6 | using System.Reflection; | ||
7 | using WixToolset.Data; | 5 | using WixToolset.Data; |
8 | using WixToolset.Extensibility; | 6 | using WixToolset.Extensibility; |
9 | 7 | ||
10 | /// <summary> | 8 | /// <summary> |
11 | /// The WiX toolset dependency extension. | 9 | /// The WiX Toolset Dependency Extension. |
12 | /// </summary> | 10 | /// </summary> |
13 | public sealed class DependencyExtensionData : ExtensionData | 11 | public sealed class DependencyExtensionData : BaseExtensionData |
14 | { | 12 | { |
15 | /// <summary> | 13 | /// <summary> |
16 | /// Gets the default culture. | 14 | /// Gets the default culture. |
17 | /// </summary> | 15 | /// </summary> |
18 | /// <value>The default culture.</value> | 16 | /// <value>The default culture.</value> |
19 | public override string DefaultCulture | 17 | public override string DefaultCulture => "en-US"; |
20 | { | ||
21 | get { return "en-us"; } | ||
22 | } | ||
23 | |||
24 | /// <summary> | ||
25 | /// Gets the optional table definitions for this extension. | ||
26 | /// </summary> | ||
27 | /// <value>The optional table definitions for this extension.</value> | ||
28 | public override TableDefinitionCollection TableDefinitions | ||
29 | { | ||
30 | get | ||
31 | { | ||
32 | return DependencyExtensionData.GetExtensionTableDefinitions(); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | /// <summary> | ||
37 | /// Gets the library associated with this extension. | ||
38 | /// </summary> | ||
39 | /// <param name="tableDefinitions">The table definitions to use while loading the library.</param> | ||
40 | /// <returns>The loaded library.</returns> | ||
41 | public override Library GetLibrary(TableDefinitionCollection tableDefinitions) | ||
42 | { | ||
43 | return DependencyExtensionData.GetExtensionLibrary(tableDefinitions); | ||
44 | } | ||
45 | 18 | ||
46 | /// <summary> | 19 | public override bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition) |
47 | /// Internal mechanism to access the extension's table definitions. | ||
48 | /// </summary> | ||
49 | /// <returns>Extension's table definitions.</returns> | ||
50 | internal static TableDefinitionCollection GetExtensionTableDefinitions() | ||
51 | { | 20 | { |
52 | return ExtensionData.LoadTableDefinitionHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.tables.xml"); | 21 | tupleDefinition = DependencyTupleDefinitions.ByName(name); |
22 | return tupleDefinition != null; | ||
53 | } | 23 | } |
54 | 24 | ||
55 | /// <summary> | 25 | public override Intermediate GetLibrary(ITupleDefinitionCreator tupleDefinitions) |
56 | /// Internal mechanism to access the extension's library. | ||
57 | /// </summary> | ||
58 | /// <returns>Extension's library.</returns> | ||
59 | internal static Library GetExtensionLibrary(TableDefinitionCollection tableDefinitions) | ||
60 | { | 26 | { |
61 | return ExtensionData.LoadLibraryHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.Dependency.wixlib", tableDefinitions); | 27 | return Intermediate.Load(typeof(DependencyExtensionData).Assembly, "WixToolset.Dependency.dependency.wixlib", tupleDefinitions); |
62 | } | 28 | } |
63 | } | 29 | } |
64 | } | 30 | } |
diff --git a/src/wixext/DependencyExtensionFactory.cs b/src/wixext/DependencyExtensionFactory.cs new file mode 100644 index 00000000..c5b89658 --- /dev/null +++ b/src/wixext/DependencyExtensionFactory.cs | |||
@@ -0,0 +1,18 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Dependency | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections.Generic; | ||
7 | using WixToolset.Extensibility; | ||
8 | |||
9 | public class DependencyExtensionFactory : BaseExtensionFactory | ||
10 | { | ||
11 | protected override IEnumerable<Type> ExtensionTypes => new[] | ||
12 | { | ||
13 | typeof(DependencyCompiler), | ||
14 | typeof(DependencyExtensionData), | ||
15 | typeof(DependencyWindowsInstallerBackendBinderExtension), | ||
16 | }; | ||
17 | } | ||
18 | } | ||
diff --git a/src/wixext/DependencyWarnings.cs b/src/wixext/DependencyWarnings.cs new file mode 100644 index 00000000..802edc22 --- /dev/null +++ b/src/wixext/DependencyWarnings.cs | |||
@@ -0,0 +1,60 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Dependency | ||
4 | { | ||
5 | using System; | ||
6 | using System.Resources; | ||
7 | using WixToolset.Data; | ||
8 | |||
9 | public static class DependencyWarnings | ||
10 | { | ||
11 | public static Message DiscouragedVersionAttribute(SourceLineNumber sourceLineNumbers) | ||
12 | { | ||
13 | return Message(sourceLineNumbers, Ids.DiscouragedVersionAttribute, "The Provides/@Version attribute should not be specified in an MSI package. The ProductVersion will be used by default."); | ||
14 | } | ||
15 | |||
16 | public static Message DiscouragedVersionAttribute(SourceLineNumber sourceLineNumbers, string id) | ||
17 | { | ||
18 | return Message(sourceLineNumbers, Ids.DiscouragedVersionAttribute, "The Provides/@Version attribute should not be specified for MSI package {0}. The ProductVersion will be used by default.", id); | ||
19 | } | ||
20 | |||
21 | public static Message PropertyRemoved(string name) | ||
22 | { | ||
23 | return Message(null, Ids.PropertyRemoved, "The property {0} was authored in the package with a value and will be removed. The property should not be authored.", name); | ||
24 | } | ||
25 | |||
26 | public static Message ProvidesKeyNotFound(SourceLineNumber sourceLineNumbers, string id) | ||
27 | { | ||
28 | return Message(sourceLineNumbers, Ids.ProvidesKeyNotFound, "The provider key with identifier {0} was not found in the WixDependencyProvider table. Related registry rows will not be removed from authoring.", id); | ||
29 | } | ||
30 | |||
31 | public static Message RequiresKeyNotFound(SourceLineNumber sourceLineNumbers, string id) | ||
32 | { | ||
33 | return Message(sourceLineNumbers, Ids.RequiresKeyNotFound, "The dependency key with identifier {0} was not found in the WixDependency table. Related registry rows will not be removed from authoring.", id); | ||
34 | } | ||
35 | |||
36 | public static Message Win64Component(SourceLineNumber sourceLineNumbers, string componentId) | ||
37 | { | ||
38 | return Message(sourceLineNumbers, Ids.Win64Component, "The Provides element should not be authored in the 64-bit component with identifier {0}. The dependency feature may not work if installing this package on 64-bit Windows operating systems prior to Windows 7 and Windows Server 2008 R2. Set the Component/@Win64 attribute to \"no\" to make sure the dependency feature works correctly on all supported operating systems.", componentId); | ||
39 | } | ||
40 | |||
41 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) | ||
42 | { | ||
43 | return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args); | ||
44 | } | ||
45 | |||
46 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) | ||
47 | { | ||
48 | return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, resourceManager, resourceName, args); | ||
49 | } | ||
50 | |||
51 | public enum Ids | ||
52 | { | ||
53 | ProvidesKeyNotFound = 5431, | ||
54 | RequiresKeyNotFound = 5432, | ||
55 | PropertyRemoved = 5433, | ||
56 | DiscouragedVersionAttribute = 5434, | ||
57 | Win64Component = 5435, | ||
58 | } | ||
59 | } | ||
60 | } | ||
diff --git a/src/wixext/DependencyBinder.cs b/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs index 13fea203..485453a1 100644 --- a/src/wixext/DependencyBinder.cs +++ b/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs | |||
@@ -1,24 +1,35 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
2 | 2 | ||
3 | namespace WixToolset.Extensions | 3 | namespace WixToolset.Dependency |
4 | { | 4 | { |
5 | using System; | 5 | using System.Linq; |
6 | using System.Collections.ObjectModel; | 6 | using System.Xml; |
7 | using System.Globalization; | 7 | using WixToolset.Data.WindowsInstaller; |
8 | using WixToolset.Data; | ||
9 | using WixToolset.Extensibility; | 8 | using WixToolset.Extensibility; |
10 | 9 | ||
11 | /// <summary> | 10 | public class DependencyWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension |
12 | /// The compiler for the WiX toolset dependency extension. | ||
13 | /// </summary> | ||
14 | public sealed class DependencyBinder : BinderExtension | ||
15 | { | 11 | { |
12 | private static readonly TableDefinition[] Tables = LoadTables(); | ||
13 | |||
14 | protected override TableDefinition[] TableDefinitionsForTuples => Tables; | ||
15 | |||
16 | private static TableDefinition[] LoadTables() | ||
17 | { | ||
18 | using (var resourceStream = typeof(DependencyWindowsInstallerBackendBinderExtension).Assembly.GetManifestResourceStream("WixToolset.Dependency.tables.xml")) | ||
19 | using (var reader = XmlReader.Create(resourceStream)) | ||
20 | { | ||
21 | var tables = TableDefinitionCollection.Load(reader); | ||
22 | return tables.ToArray(); | ||
23 | } | ||
24 | } | ||
25 | |||
26 | #if TODO_TAG_BINDER_EXTENSION | ||
16 | private Output output; | 27 | private Output output; |
17 | 28 | ||
18 | /// <summary> | 29 | /// <summary> |
19 | /// Called after all output changes occur and right before the output is bound into its final format. | 30 | /// Called after all output changes occur and right before the output is bound into its final format. |
20 | /// </summary> | 31 | /// </summary> |
21 | public override void Finish(Output output) | 32 | public void Finish(Output output) |
22 | { | 33 | { |
23 | // Only process MSI packages. | 34 | // Only process MSI packages. |
24 | if (OutputType.Product != output.Type) | 35 | if (OutputType.Product != output.Type) |
@@ -165,5 +176,6 @@ namespace WixToolset.Extensions | |||
165 | return row.GetPrimaryKey('/'); | 176 | return row.GetPrimaryKey('/'); |
166 | } | 177 | } |
167 | } | 178 | } |
179 | #endif | ||
168 | } | 180 | } |
169 | } | 181 | } |
diff --git a/src/wixext/Tuples/DependencyTupleDefinitions.cs b/src/wixext/Tuples/DependencyTupleDefinitions.cs new file mode 100644 index 00000000..fdd3f0b5 --- /dev/null +++ b/src/wixext/Tuples/DependencyTupleDefinitions.cs | |||
@@ -0,0 +1,47 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Dependency | ||
4 | { | ||
5 | using System; | ||
6 | using WixToolset.Data; | ||
7 | |||
8 | public enum DependencyTupleDefinitionType | ||
9 | { | ||
10 | WixDependency, | ||
11 | WixDependencyProvider, | ||
12 | WixDependencyRef, | ||
13 | } | ||
14 | |||
15 | public static partial class DependencyTupleDefinitions | ||
16 | { | ||
17 | public static readonly Version Version = new Version("4.0.0"); | ||
18 | |||
19 | public static IntermediateTupleDefinition ByName(string name) | ||
20 | { | ||
21 | if (!Enum.TryParse(name, out DependencyTupleDefinitionType type)) | ||
22 | { | ||
23 | return null; | ||
24 | } | ||
25 | |||
26 | return ByType(type); | ||
27 | } | ||
28 | |||
29 | public static IntermediateTupleDefinition ByType(DependencyTupleDefinitionType type) | ||
30 | { | ||
31 | switch (type) | ||
32 | { | ||
33 | case DependencyTupleDefinitionType.WixDependency: | ||
34 | return DependencyTupleDefinitions.WixDependency; | ||
35 | |||
36 | case DependencyTupleDefinitionType.WixDependencyProvider: | ||
37 | return DependencyTupleDefinitions.WixDependencyProvider; | ||
38 | |||
39 | case DependencyTupleDefinitionType.WixDependencyRef: | ||
40 | return DependencyTupleDefinitions.WixDependencyRef; | ||
41 | |||
42 | default: | ||
43 | throw new ArgumentOutOfRangeException(nameof(type)); | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | } | ||
diff --git a/src/wixext/Tuples/WixDependencyProviderTuple.cs b/src/wixext/Tuples/WixDependencyProviderTuple.cs new file mode 100644 index 00000000..2fd6a805 --- /dev/null +++ b/src/wixext/Tuples/WixDependencyProviderTuple.cs | |||
@@ -0,0 +1,87 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Dependency | ||
4 | { | ||
5 | using WixToolset.Data; | ||
6 | using WixToolset.Dependency.Tuples; | ||
7 | |||
8 | public static partial class DependencyTupleDefinitions | ||
9 | { | ||
10 | public static readonly IntermediateTupleDefinition WixDependencyProvider = new IntermediateTupleDefinition( | ||
11 | DependencyTupleDefinitionType.WixDependencyProvider.ToString(), | ||
12 | new[] | ||
13 | { | ||
14 | new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.WixDependencyProvider), IntermediateFieldType.String), | ||
15 | new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.Component_), IntermediateFieldType.String), | ||
16 | new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.ProviderKey), IntermediateFieldType.String), | ||
17 | new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.Version), IntermediateFieldType.String), | ||
18 | new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.DisplayName), IntermediateFieldType.String), | ||
19 | new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.Attributes), IntermediateFieldType.Number), | ||
20 | }, | ||
21 | typeof(WixDependencyProviderTuple)); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | namespace WixToolset.Dependency.Tuples | ||
26 | { | ||
27 | using WixToolset.Data; | ||
28 | |||
29 | public enum WixDependencyProviderTupleFields | ||
30 | { | ||
31 | WixDependencyProvider, | ||
32 | Component_, | ||
33 | ProviderKey, | ||
34 | Version, | ||
35 | DisplayName, | ||
36 | Attributes, | ||
37 | } | ||
38 | |||
39 | public class WixDependencyProviderTuple : IntermediateTuple | ||
40 | { | ||
41 | public WixDependencyProviderTuple() : base(DependencyTupleDefinitions.WixDependencyProvider, null, null) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | public WixDependencyProviderTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencyTupleDefinitions.WixDependencyProvider, sourceLineNumber, id) | ||
46 | { | ||
47 | } | ||
48 | |||
49 | public IntermediateField this[WixDependencyProviderTupleFields index] => this.Fields[(int)index]; | ||
50 | |||
51 | public string WixDependencyProvider | ||
52 | { | ||
53 | get => this.Fields[(int)WixDependencyProviderTupleFields.WixDependencyProvider].AsString(); | ||
54 | set => this.Set((int)WixDependencyProviderTupleFields.WixDependencyProvider, value); | ||
55 | } | ||
56 | |||
57 | public string Component_ | ||
58 | { | ||
59 | get => this.Fields[(int)WixDependencyProviderTupleFields.Component_].AsString(); | ||
60 | set => this.Set((int)WixDependencyProviderTupleFields.Component_, value); | ||
61 | } | ||
62 | |||
63 | public string ProviderKey | ||
64 | { | ||
65 | get => this.Fields[(int)WixDependencyProviderTupleFields.ProviderKey].AsString(); | ||
66 | set => this.Set((int)WixDependencyProviderTupleFields.ProviderKey, value); | ||
67 | } | ||
68 | |||
69 | public string Version | ||
70 | { | ||
71 | get => this.Fields[(int)WixDependencyProviderTupleFields.Version].AsString(); | ||
72 | set => this.Set((int)WixDependencyProviderTupleFields.Version, value); | ||
73 | } | ||
74 | |||
75 | public string DisplayName | ||
76 | { | ||
77 | get => this.Fields[(int)WixDependencyProviderTupleFields.DisplayName].AsString(); | ||
78 | set => this.Set((int)WixDependencyProviderTupleFields.DisplayName, value); | ||
79 | } | ||
80 | |||
81 | public int Attributes | ||
82 | { | ||
83 | get => this.Fields[(int)WixDependencyProviderTupleFields.Attributes].AsNumber(); | ||
84 | set => this.Set((int)WixDependencyProviderTupleFields.Attributes, value); | ||
85 | } | ||
86 | } | ||
87 | } \ No newline at end of file | ||
diff --git a/src/wixext/Tuples/WixDependencyRefTuple.cs b/src/wixext/Tuples/WixDependencyRefTuple.cs new file mode 100644 index 00000000..3e996f5f --- /dev/null +++ b/src/wixext/Tuples/WixDependencyRefTuple.cs | |||
@@ -0,0 +1,55 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Dependency | ||
4 | { | ||
5 | using WixToolset.Data; | ||
6 | using WixToolset.Dependency.Tuples; | ||
7 | |||
8 | public static partial class DependencyTupleDefinitions | ||
9 | { | ||
10 | public static readonly IntermediateTupleDefinition WixDependencyRef = new IntermediateTupleDefinition( | ||
11 | DependencyTupleDefinitionType.WixDependencyRef.ToString(), | ||
12 | new[] | ||
13 | { | ||
14 | new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependencyProvider_), IntermediateFieldType.String), | ||
15 | new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependency_), IntermediateFieldType.String), | ||
16 | }, | ||
17 | typeof(WixDependencyRefTuple)); | ||
18 | } | ||
19 | } | ||
20 | |||
21 | namespace WixToolset.Dependency.Tuples | ||
22 | { | ||
23 | using WixToolset.Data; | ||
24 | |||
25 | public enum WixDependencyRefTupleFields | ||
26 | { | ||
27 | WixDependencyProvider_, | ||
28 | WixDependency_, | ||
29 | } | ||
30 | |||
31 | public class WixDependencyRefTuple : IntermediateTuple | ||
32 | { | ||
33 | public WixDependencyRefTuple() : base(DependencyTupleDefinitions.WixDependencyRef, null, null) | ||
34 | { | ||
35 | } | ||
36 | |||
37 | public WixDependencyRefTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencyTupleDefinitions.WixDependencyRef, sourceLineNumber, id) | ||
38 | { | ||
39 | } | ||
40 | |||
41 | public IntermediateField this[WixDependencyRefTupleFields index] => this.Fields[(int)index]; | ||
42 | |||
43 | public string WixDependencyProvider_ | ||
44 | { | ||
45 | get => this.Fields[(int)WixDependencyRefTupleFields.WixDependencyProvider_].AsString(); | ||
46 | set => this.Set((int)WixDependencyRefTupleFields.WixDependencyProvider_, value); | ||
47 | } | ||
48 | |||
49 | public string WixDependency_ | ||
50 | { | ||
51 | get => this.Fields[(int)WixDependencyRefTupleFields.WixDependency_].AsString(); | ||
52 | set => this.Set((int)WixDependencyRefTupleFields.WixDependency_, value); | ||
53 | } | ||
54 | } | ||
55 | } \ No newline at end of file | ||
diff --git a/src/wixext/Tuples/WixDependencyTuple.cs b/src/wixext/Tuples/WixDependencyTuple.cs new file mode 100644 index 00000000..81e05ad1 --- /dev/null +++ b/src/wixext/Tuples/WixDependencyTuple.cs | |||
@@ -0,0 +1,79 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Dependency | ||
4 | { | ||
5 | using WixToolset.Data; | ||
6 | using WixToolset.Dependency.Tuples; | ||
7 | |||
8 | public static partial class DependencyTupleDefinitions | ||
9 | { | ||
10 | public static readonly IntermediateTupleDefinition WixDependency = new IntermediateTupleDefinition( | ||
11 | DependencyTupleDefinitionType.WixDependency.ToString(), | ||
12 | new[] | ||
13 | { | ||
14 | new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.WixDependency), IntermediateFieldType.String), | ||
15 | new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.ProviderKey), IntermediateFieldType.String), | ||
16 | new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.MinVersion), IntermediateFieldType.String), | ||
17 | new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.MaxVersion), IntermediateFieldType.String), | ||
18 | new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.Attributes), IntermediateFieldType.Number), | ||
19 | }, | ||
20 | typeof(WixDependencyTuple)); | ||
21 | } | ||
22 | } | ||
23 | |||
24 | namespace WixToolset.Dependency.Tuples | ||
25 | { | ||
26 | using WixToolset.Data; | ||
27 | |||
28 | public enum WixDependencyTupleFields | ||
29 | { | ||
30 | WixDependency, | ||
31 | ProviderKey, | ||
32 | MinVersion, | ||
33 | MaxVersion, | ||
34 | Attributes, | ||
35 | } | ||
36 | |||
37 | public class WixDependencyTuple : IntermediateTuple | ||
38 | { | ||
39 | public WixDependencyTuple() : base(DependencyTupleDefinitions.WixDependency, null, null) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | public WixDependencyTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencyTupleDefinitions.WixDependency, sourceLineNumber, id) | ||
44 | { | ||
45 | } | ||
46 | |||
47 | public IntermediateField this[WixDependencyTupleFields index] => this.Fields[(int)index]; | ||
48 | |||
49 | public string WixDependency | ||
50 | { | ||
51 | get => this.Fields[(int)WixDependencyTupleFields.WixDependency].AsString(); | ||
52 | set => this.Set((int)WixDependencyTupleFields.WixDependency, value); | ||
53 | } | ||
54 | |||
55 | public string ProviderKey | ||
56 | { | ||
57 | get => this.Fields[(int)WixDependencyTupleFields.ProviderKey].AsString(); | ||
58 | set => this.Set((int)WixDependencyTupleFields.ProviderKey, value); | ||
59 | } | ||
60 | |||
61 | public string MinVersion | ||
62 | { | ||
63 | get => this.Fields[(int)WixDependencyTupleFields.MinVersion].AsString(); | ||
64 | set => this.Set((int)WixDependencyTupleFields.MinVersion, value); | ||
65 | } | ||
66 | |||
67 | public string MaxVersion | ||
68 | { | ||
69 | get => this.Fields[(int)WixDependencyTupleFields.MaxVersion].AsString(); | ||
70 | set => this.Set((int)WixDependencyTupleFields.MaxVersion, value); | ||
71 | } | ||
72 | |||
73 | public int Attributes | ||
74 | { | ||
75 | get => this.Fields[(int)WixDependencyTupleFields.Attributes].AsNumber(); | ||
76 | set => this.Set((int)WixDependencyTupleFields.Attributes, value); | ||
77 | } | ||
78 | } | ||
79 | } \ No newline at end of file | ||
diff --git a/src/wixext/WixToolset.Dependency.wixext.csproj b/src/wixext/WixToolset.Dependency.wixext.csproj new file mode 100644 index 00000000..7e9f1e3a --- /dev/null +++ b/src/wixext/WixToolset.Dependency.wixext.csproj | |||
@@ -0,0 +1,33 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
5 | <PropertyGroup> | ||
6 | <TargetFramework>netstandard2.0</TargetFramework> | ||
7 | <RootNamespace>WixToolset.Dependency</RootNamespace> | ||
8 | <Description>WiX Toolset Dependency Extension</Description> | ||
9 | <Title>WiX Toolset Dependency Extension</Title> | ||
10 | <IsTool>true</IsTool> | ||
11 | <ContentTargetFolders>build</ContentTargetFolders> | ||
12 | </PropertyGroup> | ||
13 | |||
14 | <ItemGroup> | ||
15 | <Content Include="$(MSBuildThisFileName).targets" /> | ||
16 | <Content Include="dependency.xsd" PackagePath="tools" /> | ||
17 | <EmbeddedResource Include="tables.xml" /> | ||
18 | <EmbeddedResource Include="$(OutputPath)..\dependency.wixlib" /> | ||
19 | </ItemGroup> | ||
20 | |||
21 | <ItemGroup> | ||
22 | <PackageReference Include="WixToolset.Data" Version="4.0.*" PrivateAssets="all" /> | ||
23 | <PackageReference Include="WixToolset.Extensibility" Version="4.0.*" PrivateAssets="all" /> | ||
24 | </ItemGroup> | ||
25 | |||
26 | <ItemGroup> | ||
27 | <ProjectReference Include="..\wixlib\dependency.wixproj" ReferenceOutputAssembly="false" Condition=" '$(NCrunch)'=='' " /> | ||
28 | </ItemGroup> | ||
29 | |||
30 | <ItemGroup> | ||
31 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" /> | ||
32 | </ItemGroup> | ||
33 | </Project> | ||
diff --git a/src/wixext/WixToolset.Dependency.wixext.targets b/src/wixext/WixToolset.Dependency.wixext.targets new file mode 100644 index 00000000..494c0184 --- /dev/null +++ b/src/wixext/WixToolset.Dependency.wixext.targets | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | |||
4 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | ||
5 | <PropertyGroup> | ||
6 | <WixToolsetDepedencyWixextPath Condition=" '$(WixToolsetDepedencyWixextPath)' == '' ">$(MSBuildThisFileDirectory)..\tools\WixToolset.Depedency.wixext.dll</WixToolsetDepedencyWixextPath> | ||
7 | </PropertyGroup> | ||
8 | <ItemGroup> | ||
9 | <WixExtension Include="$(WixToolsetDepedencyWixextPath)" /> | ||
10 | </ItemGroup> | ||
11 | </Project> | ||
diff --git a/src/wixext/messages.xml b/src/wixext/messages.xml deleted file mode 100644 index bd6eb602..00000000 --- a/src/wixext/messages.xml +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | <?xml version='1.0' encoding='utf-8'?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | |||
4 | |||
5 | <Messages Namespace="WixToolset.Extensions" Resources="Data.Messages" xmlns="http://schemas.microsoft.com/genmsgs/2004/07/messages"> | ||
6 | <Class Name="DependencyErrors" ContainerName="DependencyErrorEventArgs" BaseContainerName="MessageEventArgs"> | ||
7 | <Message Id="IllegalCharactersInProvider" Number="5400"> | ||
8 | <Instance> | ||
9 | The provider key authored into the {0} attribute contains an illegal character, '{1}'. Please author the provider key without any of the following characters: {2} | ||
10 | <Parameter Type="System.String" Name="attributeName" /> | ||
11 | <Parameter Type="System.Char" Name="illegalChar" /> | ||
12 | <Parameter Type="System.String" Name="illegalChars" /> | ||
13 | </Instance> | ||
14 | </Message> | ||
15 | <Message Id="ReservedValue" Number="5401"> | ||
16 | <Instance> | ||
17 | The {0}/@{1} attribute value '{2}' is reserved and cannot be used here. Please choose a different value. | ||
18 | <Parameter Type="System.String" Name="elementName" /> | ||
19 | <Parameter Type="System.String" Name="attributeName" /> | ||
20 | <Parameter Type="System.String" Name="attributeValue" /> | ||
21 | </Instance> | ||
22 | </Message> | ||
23 | </Class> | ||
24 | <Class Name="DependencyWarnings" ContainerName="DependencyWarningEventArgs" BaseContainerName="MessageEventArgs"> | ||
25 | <Message Id="ProvidesKeyNotFound" Number="5431"> | ||
26 | <Instance> | ||
27 | The provider key with identifier {0} was not found in the WixDependencyProvider table. Related registry rows will not be removed from authoring. | ||
28 | <Parameter Type="System.String" Name="id" /> | ||
29 | </Instance> | ||
30 | </Message> | ||
31 | <Message Id="RequiresKeyNotFound" Number="5432"> | ||
32 | <Instance> | ||
33 | The dependency key with identifier {0} was not found in the WixDependency table. Related registry rows will not be removed from authoring. | ||
34 | <Parameter Type="System.String" Name="id" /> | ||
35 | </Instance> | ||
36 | </Message> | ||
37 | <Message Id="PropertyRemoved" Number="5433" SourceLineNumbers="no"> | ||
38 | <Instance> | ||
39 | The property {0} was authored in the package with a value and will be removed. The property should not be authored. | ||
40 | <Parameter Type="System.String" Name="name" /> | ||
41 | </Instance> | ||
42 | </Message> | ||
43 | <Message Id="DiscouragedVersionAttribute" Number="5434"> | ||
44 | <Instance> | ||
45 | The Provides/@Version attribute should not be specified in an MSI package. The ProductVersion will be used by default. | ||
46 | </Instance> | ||
47 | <Instance> | ||
48 | The Provides/@Version attribute should not be specified for MSI package {0}. The ProductVersion will be used by default. | ||
49 | <Parameter Type="System.String" Name="id" /> | ||
50 | </Instance> | ||
51 | </Message> | ||
52 | <Message Id="Win64Component" Number="5435"> | ||
53 | <Instance> | ||
54 | The Provides element should not be authored in the 64-bit component with identifier {0}. The dependency feature may not work if installing this package on 64-bit Windows operating systems prior to Windows 7 and Windows Server 2008 R2. Set the Component/@Win64 attribute to "no" to make sure the dependency feature works correctly on all supported operating systems. | ||
55 | <Parameter Type="System.String" Name="componentId" /> | ||
56 | </Instance> | ||
57 | </Message> | ||
58 | </Class> | ||
59 | <Class Name="DependencyVerboses" ContainerName="DependencyVerboseEventArgs" BaseContainerName="MessageEventArgs" /> | ||
60 | </Messages> | ||