@joebigelow / wix-1 / commits / 9524fee3

Modernize DependencyCompiler and tuples.

Sean Hall committed Apr 8, 2020 at 13:52 UTC 9524fee3de3853748ceaef4606dd045edcaffb7d
10 files changed +151 -268
src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs
+2 -2
@@ -19,8 +19,8 @@ namespace WixToolsetTest.Dependency
19 var results = build.BuildAndQuery(Build, "WixDependencyProvider");
20 Assert.Equal(new[]
21 {
22 - "WixDependencyProvider:depJQsOasf1FRUsKxq8THB9sXk8yws\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t0",
23 - }, results.OrderBy(s => s).ToArray());
22 + "WixDependencyProvider:depJQsOasf1FRUsKxq8THB9sXk8yws\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t",
23 + }, results);
24 }
25
26 private static void Build(string[] args)
src/wixext/DependencyCompiler.cs
+80 -102
@@ -8,6 +8,8 @@ namespace WixToolset.Dependency
8 using System.Text;
9 using System.Xml.Linq;
10 using WixToolset.Data;
11 + using WixToolset.Data.Tuples;
12 + using WixToolset.Dependency.Tuples;
13 using WixToolset.Extensibility;
14 using WixToolset.Extensibility.Data;
15
@@ -38,7 +40,7 @@ namespace WixToolset.Dependency
40 /// <param name="attribute">Attribute to process.</param>
41 public override void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary<string, string> context)
42 {
41 - SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement);
43 + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement);
44 switch (parentElement.Name.LocalName)
45 {
46 case "Bundle":
@@ -67,7 +69,7 @@ namespace WixToolset.Dependency
69 /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
70 public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context)
71 {
70 - PackageType packageType = PackageType.None;
72 + var packageType = PackageType.None;
73
74 switch (parentElement.Name.LocalName)
75 {
@@ -104,7 +106,7 @@ namespace WixToolset.Dependency
106
107 if (PackageType.None != packageType)
108 {
107 - string packageId = context["PackageId"];
109 + var packageId = context["PackageId"];
110
111 switch (element.Name.LocalName)
112 {
@@ -127,17 +129,16 @@ namespace WixToolset.Dependency
129 /// <returns>The component key path type if set.</returns>
130 public override IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context)
131 {
130 - SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement);
132 + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement);
133 IComponentKeyPath keyPath = null;
134
135 switch (parentElement.Name.LocalName)
136 {
137 case "Component":
136 - string componentId = context["ComponentId"];
138 + var componentId = context["ComponentId"];
139
140 // 64-bit components may cause issues downlevel.
139 - bool win64 = false;
140 - Boolean.TryParse(context["Win64"], out win64);
141 + Boolean.TryParse(context["Win64"], out var win64);
142
143 switch (element.Name.LocalName)
144 {
@@ -191,7 +192,7 @@ namespace WixToolset.Dependency
192 }
193 else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters)))
194 {
194 - StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2);
195 + var sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2);
196 Array.ForEach<char>(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" "));
197
198 this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString()));
@@ -206,12 +207,14 @@ namespace WixToolset.Dependency
207
208 if (!this.Messaging.EncounteredError)
209 {
209 - // Create the provider row for the bundle. The Component_ field is required
210 + // Create the provider tuple for the bundle. The Component_ field is required
211 // in the table definition but unused for bundles, so just set it to the valid ID.
211 - var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyProvider", id);
212 - row.Set(1, id.Id);
213 - row.Set(2, providerKey);
214 - row.Set(5, DependencyCommon.ProvidesAttributesBundle);
212 + section.AddTuple(new WixDependencyProviderTuple(sourceLineNumbers, id)
213 + {
214 + ComponentRef = id.Id,
215 + ProviderKey = providerKey,
216 + Attributes = WixDependencyProviderAttributes.ProvidesAttributesBundle,
217 + });
218 }
219 }
220
@@ -225,16 +228,15 @@ namespace WixToolset.Dependency
228 /// <returns>The type of key path if set.</returns>
229 private IComponentKeyPath ParseProvidesElement(Intermediate intermediate, IntermediateSection section, XElement node, PackageType packageType, string parentId)
230 {
228 - SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
231 + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
232 IComponentKeyPath keyPath = null;
233 Identifier id = null;
234 string key = null;
235 string version = null;
236 string displayName = null;
234 - int attributes = 0;
237 int illegalChar = -1;
238
237 - foreach (XAttribute attrib in node.Attributes())
239 + foreach (var attrib in node.Attributes())
240 {
241 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
242 {
@@ -270,7 +272,7 @@ namespace WixToolset.Dependency
272 // Make sure the key does not contain any illegal characters or values.
273 if (0 <= (illegalChar = key.IndexOfAny(DependencyCommon.InvalidCharacters)))
274 {
273 - StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2);
275 + var sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2);
276 Array.ForEach<char>(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" "));
277
278 this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "Key", key[illegalChar], sb.ToString()));
@@ -288,7 +290,7 @@ namespace WixToolset.Dependency
290 else if (PackageType.None == packageType)
291 {
292 // Make sure the ProductCode is authored and set the key.
291 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Property", "ProductCode");
293 + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Property, "ProductCode");
294 key = "!(bind.property.ProductCode)";
295 }
296
@@ -317,7 +319,7 @@ namespace WixToolset.Dependency
319 id = this.ParseHelper.CreateIdentifier("dep", node.Name.LocalName, parentId, key);
320 }
321
320 - foreach (XElement child in node.Elements())
322 + foreach (var child in node.Elements())
323 {
324 if (this.Namespace == child.Name.Namespace)
325 {
@@ -342,24 +344,20 @@ namespace WixToolset.Dependency
344
345 if (!this.Messaging.EncounteredError)
346 {
345 - // Create the row in the provider table.
346 - var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyProvider", id);
347 - row.Set(1, parentId);
348 - row.Set(2, key);
347 + var tuple = section.AddTuple(new WixDependencyProviderTuple(sourceLineNumbers, id)
348 + {
349 + ComponentRef = parentId,
350 + ProviderKey = key,
351 + });
352
353 if (!String.IsNullOrEmpty(version))
354 {
352 - row.Set(3, version);
355 + tuple.Version = version;
356 }
357
358 if (!String.IsNullOrEmpty(displayName))
359 {
357 - row.Set(4, displayName);
358 - }
359 -
360 - if (0 != attributes)
361 - {
362 - row.Set(5, attributes);
360 + tuple.DisplayName = displayName;
361 }
362
363 if (PackageType.None == packageType)
@@ -377,44 +375,24 @@ namespace WixToolset.Dependency
375 }
376
377 // Generate registry rows for the provider using binder properties.
380 - string keyProvides = String.Concat(DependencyCommon.RegistryRoot, key);
378 + var keyProvides = String.Concat(DependencyCommon.RegistryRoot, key);
379 + var root = RegistryRootType.MachineUser;
380 +
381 + var value = "[ProductCode]";
382 + this.ParseHelper.CreateRegistryTuple(section, sourceLineNumbers, root, keyProvides, null, value, parentId, false);
383
382 - row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "(Default)"));
383 - row.Set(1, -1);
384 - row.Set(2, keyProvides);
385 - row.Set(4, "[ProductCode]");
386 - row.Set(5, parentId);
384 + value = !String.IsNullOrEmpty(version) ? version : "[ProductVersion]";
385 + var versionRegistryTuple =
386 + this.ParseHelper.CreateRegistryTuple(section, sourceLineNumbers, root, keyProvides, "Version", value, parentId, false);
387 +
388 + value = !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]";
389 + this.ParseHelper.CreateRegistryTuple(section, sourceLineNumbers, root, keyProvides, "DisplayName", value, parentId, false);
390
391 // Use the Version registry value and use that as a potential key path.
389 - Identifier idVersion = this.ParseHelper.CreateIdentifier("reg", id.Id, "Version");
392 keyPath = this.CreateComponentKeyPath();
391 - keyPath.Id = idVersion.Id;
393 + keyPath.Id = versionRegistryTuple.Id;
394 keyPath.Explicit = false;
395 keyPath.Type = PossibleKeyPathType.Registry;
394 -
395 - row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", idVersion);
396 - row.Set(1, -1);
397 - row.Set(2, keyProvides);
398 - row.Set(3, "Version");
399 - row.Set(4, !String.IsNullOrEmpty(version) ? version : "[ProductVersion]");
400 - row.Set(5, parentId);
401 -
402 - row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "DisplayName"));
403 - row.Set(1, -1);
404 - row.Set(2, keyProvides);
405 - row.Set(3, "DisplayName");
406 - row.Set(4, !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]");
407 - row.Set(5, parentId);
408 -
409 - if (0 != attributes)
410 - {
411 - row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "Attributes"));
412 - row.Set(1, -1);
413 - row.Set(2, keyProvides);
414 - row.Set(3, "Attributes");
415 - row.Set(4, String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat)));
416 - row.Set(5, parentId);
417 - }
396 }
397 }
398
@@ -429,7 +407,7 @@ namespace WixToolset.Dependency
407 /// <param name="requiresAction">Whether the Requires custom action should be referenced.</param>
408 private void ParseRequiresElement(Intermediate intermediate, IntermediateSection section, XElement node, string providerId, bool requiresAction)
409 {
432 - SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
410 + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
411 Identifier id = null;
412 string providerKey = null;
413 string minVersion = null;
@@ -437,7 +415,7 @@ namespace WixToolset.Dependency
415 int attributes = 0;
416 int illegalChar = -1;
417
440 - foreach (XAttribute attrib in node.Attributes())
418 + foreach (var attrib in node.Attributes())
419 {
420 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
421 {
@@ -502,47 +480,40 @@ namespace WixToolset.Dependency
480 // Make sure the key does not contain any illegal characters.
481 else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters)))
482 {
505 - StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2);
483 + var sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2);
484 Array.ForEach<char>(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" "));
485
486 this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString()));
487 }
488
511 -
489 if (!this.Messaging.EncounteredError)
490 {
491 // Reference the Require custom action if required.
492 if (requiresAction)
493 {
517 - if (Platform.ARM == this.Context.Platform)
518 - {
519 - // Ensure the ARM version of the CA is referenced.
520 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM");
521 - }
522 - else
523 - {
524 - // All other supported platforms use x86.
525 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire");
526 - }
494 + this.AddReferenceToWixDependencyRequire(section, sourceLineNumbers);
495 }
496
529 - var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependency", id);
530 - row.Set(1, providerKey);
531 - row.Set(2, minVersion);
532 - row.Set(3, maxVersion);
497 + var tuple = section.AddTuple(new WixDependencyTuple(sourceLineNumbers, id)
498 + {
499 + ProviderKey = providerKey,
500 + MinVersion = minVersion,
501 + MaxVersion = maxVersion,
502 + });
503
504 if (0 != attributes)
505 {
536 - row.Set(4, attributes);
506 + tuple.Attributes = attributes;
507 }
508
539 - // Create the relationship between this WixDependency row and the WixDependencyProvider row.
509 + // Create the relationship between this WixDependency tuple and the WixDependencyProvider tuple.
510 if (!String.IsNullOrEmpty(providerId))
511 {
542 - // Create the relationship between the WixDependency row and the parent WixDependencyProvider row.
543 - row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyRef");
544 - row.Set(0, providerId);
545 - row.Set(1, id.Id);
512 + section.AddTuple(new WixDependencyRefTuple(sourceLineNumbers)
513 + {
514 + WixDependencyProviderRef = providerId,
515 + WixDependencyRef = id.Id,
516 + });
517 }
518 }
519 }
@@ -555,10 +526,10 @@ namespace WixToolset.Dependency
526 /// <param name="requiresAction">Whether the Requires custom action should be referenced.</param>
527 private void ParseRequiresRefElement(Intermediate intermediate, IntermediateSection section, XElement node, string providerId, bool requiresAction)
528 {
558 - SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
529 + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
530 string id = null;
531
561 - foreach (XAttribute attrib in node.Attributes())
532 + foreach (var attrib in node.Attributes())
533 {
534 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
535 {
@@ -590,25 +561,32 @@ namespace WixToolset.Dependency
561 // Reference the Require custom action if required.
562 if (requiresAction)
563 {
593 - if (Platform.ARM == this.Context.Platform)
594 - {
595 - // Ensure the ARM version of the CA is referenced.
596 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM");
597 - }
598 - else
599 - {
600 - // All other supported platforms use x86.
601 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire");
602 - }
564 + this.AddReferenceToWixDependencyRequire(section, sourceLineNumbers);
565 }
566
567 // Create a link dependency on the row that contains information we'll need during bind.
606 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "WixDependency", id);
568 + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, DependencyTupleDefinitions.WixDependency, id);
569
570 // Create the relationship between the WixDependency row and the parent WixDependencyProvider row.
609 - var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyRef");
610 - row.Set(0, providerId);
611 - row.Set(1, id);
571 + section.AddTuple(new WixDependencyRefTuple(sourceLineNumbers)
572 + {
573 + WixDependencyProviderRef = providerId,
574 + WixDependencyRef = id,
575 + });
576 + }
577 + }
578 +
579 + private void AddReferenceToWixDependencyRequire(IntermediateSection section, SourceLineNumber sourceLineNumbers)
580 + {
581 + if (Platform.ARM == this.Context.Platform)
582 + {
583 + // Ensure the ARM version of the CA is referenced.
584 + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM");
585 + }
586 + else
587 + {
588 + // All other supported platforms use x86.
589 + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire");
590 }
591 }
592 }
src/wixext/DependencyTableDefinitions.cs new
+57
@@ -0,0 +1,57 @@
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.Data.WindowsInstaller;
7 +
8 + public static class DependencyTableDefinitions
9 + {
10 + public static readonly TableDefinition WixDependencyProvider = new TableDefinition(
11 + "WixDependencyProvider",
12 + new[]
13 + {
14 + new ColumnDefinition("WixDependencyProvider", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The non-localized primary key for the table.", modularizeType: ColumnModularizeType.Column),
15 + new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "The foreign key into the Component table used to determine install state.", modularizeType: ColumnModularizeType.Column),
16 + new ColumnDefinition("ProviderKey", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Text, description: "The name of the registry key that holds the provider identity."),
17 + new ColumnDefinition("Version", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Version, description: "The version of the package."),
18 + new ColumnDefinition("DisplayName", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Text, description: "The display name of the package."),
19 + new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied."),
20 + },
21 + tupleDefinitionName: TupleDefinitions.WixDependencyProvider.Name,
22 + tupleIdIsPrimaryKey: true
23 + );
24 +
25 + public static readonly TableDefinition WixDependency = new TableDefinition(
26 + "WixDependency",
27 + new[]
28 + {
29 + new ColumnDefinition("WixDependency", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The non-localized primary key for the table.", modularizeType: ColumnModularizeType.Column),
30 + new ColumnDefinition("ProviderKey", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Text, description: "The name of the registry key that holds the provider identity."),
31 + new ColumnDefinition("MinVersion", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Version, description: "The minimum version of the provider supported."),
32 + new ColumnDefinition("MaxVersion", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Version, description: "The maximum version of the provider supported."),
33 + new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied."),
34 + },
35 + tupleDefinitionName: DependencyTupleDefinitions.WixDependency.Name,
36 + tupleIdIsPrimaryKey: true
37 + );
38 +
39 + public static readonly TableDefinition WixDependencyRef = new TableDefinition(
40 + "WixDependencyRef",
41 + new[]
42 + {
43 + new ColumnDefinition("WixDependencyProvider_", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, keyTable: "WixDependencyProvider", keyColumn: 1, description: "Foreign key into the Component table.", modularizeType: ColumnModularizeType.Column),
44 + new ColumnDefinition("WixDependency_", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, keyTable: "WixDependency", keyColumn: 1, description: "Foreign key into the WixDependency table.", modularizeType: ColumnModularizeType.Column),
45 + },
46 + tupleDefinitionName: DependencyTupleDefinitions.WixDependencyRef.Name,
47 + tupleIdIsPrimaryKey: false
48 + );
49 +
50 + public static readonly TableDefinition[] All = new[]
51 + {
52 + WixDependencyProvider,
53 + WixDependency,
54 + WixDependencyRef,
55 + };
56 + }
57 +}
src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs
+2 -16
@@ -3,28 +3,14 @@
3 namespace WixToolset.Dependency
4 {
5 using System.Collections.Generic;
6 - using System.Linq;
7 - using System.Xml;
6 using WixToolset.Data.WindowsInstaller;
7 using WixToolset.Extensibility;
8
9 public class DependencyWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension
10 {
13 - private static readonly TableDefinition[] Tables = LoadTables();
11 + public override IEnumerable<TableDefinition> TableDefinitions => DependencyTableDefinitions.All;
12
15 - public override IEnumerable<TableDefinition> TableDefinitions => Tables;
16 -
17 - private static TableDefinition[] LoadTables()
18 - {
19 - using (var resourceStream = typeof(DependencyWindowsInstallerBackendBinderExtension).Assembly.GetManifestResourceStream("WixToolset.Dependency.tables.xml"))
20 - using (var reader = XmlReader.Create(resourceStream))
21 - {
22 - var tables = TableDefinitionCollection.Load(reader);
23 - return tables.ToArray();
24 - }
25 - }
26 -
27 -#if TODO_TAG_BINDER_EXTENSION
13 +#if TODO_DEPENDENCY_BINDER_EXTENSION
14 private Output output;
15
16 /// <summary>
src/wixext/Tuples/DependencyTupleDefinitions.cs
-4
@@ -8,7 +8,6 @@ namespace WixToolset.Dependency
8 public enum DependencyTupleDefinitionType
9 {
10 WixDependency,
11 - WixDependencyProvider,
11 WixDependencyRef,
12 }
13
@@ -33,9 +32,6 @@ namespace WixToolset.Dependency
32 case DependencyTupleDefinitionType.WixDependency:
33 return DependencyTupleDefinitions.WixDependency;
34
36 - case DependencyTupleDefinitionType.WixDependencyProvider:
37 - return DependencyTupleDefinitions.WixDependencyProvider;
38 -
35 case DependencyTupleDefinitionType.WixDependencyRef:
36 return DependencyTupleDefinitions.WixDependencyRef;
37
src/wixext/Tuples/WixDependencyProviderTuple.cs deleted
-87
@@ -1,87 +0,0 @@
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
src/wixext/Tuples/WixDependencyRefTuple.cs
+10 -10
@@ -11,8 +11,8 @@ namespace WixToolset.Dependency
11 DependencyTupleDefinitionType.WixDependencyRef.ToString(),
12 new[]
13 {
14 - new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependencyProvider_), IntermediateFieldType.String),
15 - new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependency_), IntermediateFieldType.String),
14 + new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependencyProviderRef), IntermediateFieldType.String),
15 + new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependencyRef), IntermediateFieldType.String),
16 },
17 typeof(WixDependencyRefTuple));
18 }
@@ -24,8 +24,8 @@ namespace WixToolset.Dependency.Tuples
24
25 public enum WixDependencyRefTupleFields
26 {
27 - WixDependencyProvider_,
28 - WixDependency_,
27 + WixDependencyProviderRef,
28 + WixDependencyRef,
29 }
30
31 public class WixDependencyRefTuple : IntermediateTuple
@@ -40,16 +40,16 @@ namespace WixToolset.Dependency.Tuples
40
41 public IntermediateField this[WixDependencyRefTupleFields index] => this.Fields[(int)index];
42
43 - public string WixDependencyProvider_
43 + public string WixDependencyProviderRef
44 {
45 - get => this.Fields[(int)WixDependencyRefTupleFields.WixDependencyProvider_].AsString();
46 - set => this.Set((int)WixDependencyRefTupleFields.WixDependencyProvider_, value);
45 + get => this.Fields[(int)WixDependencyRefTupleFields.WixDependencyProviderRef].AsString();
46 + set => this.Set((int)WixDependencyRefTupleFields.WixDependencyProviderRef, value);
47 }
48
49 - public string WixDependency_
49 + public string WixDependencyRef
50 {
51 - get => this.Fields[(int)WixDependencyRefTupleFields.WixDependency_].AsString();
52 - set => this.Set((int)WixDependencyRefTupleFields.WixDependency_, value);
51 + get => this.Fields[(int)WixDependencyRefTupleFields.WixDependencyRef].AsString();
52 + set => this.Set((int)WixDependencyRefTupleFields.WixDependencyRef, value);
53 }
54 }
55 }
\ No newline at end of file
src/wixext/Tuples/WixDependencyTuple.cs
-8
@@ -11,7 +11,6 @@ namespace WixToolset.Dependency
11 DependencyTupleDefinitionType.WixDependency.ToString(),
12 new[]
13 {
14 - new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.WixDependency), IntermediateFieldType.String),
14 new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.ProviderKey), IntermediateFieldType.String),
15 new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.MinVersion), IntermediateFieldType.String),
16 new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.MaxVersion), IntermediateFieldType.String),
@@ -27,7 +26,6 @@ namespace WixToolset.Dependency.Tuples
26
27 public enum WixDependencyTupleFields
28 {
30 - WixDependency,
29 ProviderKey,
30 MinVersion,
31 MaxVersion,
@@ -46,12 +44,6 @@ namespace WixToolset.Dependency.Tuples
44
45 public IntermediateField this[WixDependencyTupleFields index] => this.Fields[(int)index];
46
49 - public string WixDependency
50 - {
51 - get => this.Fields[(int)WixDependencyTupleFields.WixDependency].AsString();
52 - set => this.Set((int)WixDependencyTupleFields.WixDependency, value);
53 - }
54 -
47 public string ProviderKey
48 {
49 get => this.Fields[(int)WixDependencyTupleFields.ProviderKey].AsString();
src/wixext/WixToolset.Dependency.wixext.csproj
-1
@@ -14,7 +14,6 @@
14 <ItemGroup>
15 <Content Include="$(MSBuildThisFileName).targets" />
16 <Content Include="dependency.xsd" PackagePath="tools" />
17 - <EmbeddedResource Include="tables.xml" />
17 <EmbeddedResource Include="$(OutputPath)..\dependency.wixlib" />
18 </ItemGroup>
19
src/wixext/tables.xml deleted
-38
@@ -1,38 +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 -<tableDefinitions xmlns="http://wixtoolset.org/schemas/v4/wi/tables">
6 - <tableDefinition name="WixDependencyProvider" createSymbols="yes">
7 - <columnDefinition name="WixDependencyProvider" type="string" length="72" primaryKey="yes" modularize="column"
8 - category="identifier" description="The non-localized primary key for the table."/>
9 - <columnDefinition name="Component_" type="string" length="72" keyTable="Component" keyColumn="1" modularize="column"
10 - category="identifier" description="The foreign key into the Component table used to determine install state."/>
11 - <columnDefinition name="ProviderKey" type="string" length="255"
12 - category="text" description="The name of the registry key that holds the provider identity."/>
13 - <columnDefinition name="Version" type="string" length="72" nullable="yes"
14 - category="version" description="The version of the package."/>
15 - <columnDefinition name="DisplayName" type="string" length="255" nullable="yes"
16 - category="text" description="The display name of the package."/>
17 - <columnDefinition name="Attributes" type="number" length="4" nullable="yes"
18 - minValue="0" maxValue="2147483647" description="A 32-bit word that specifies the attribute flags to be applied."/>
19 - </tableDefinition>
20 - <tableDefinition name="WixDependency" createSymbols="yes">
21 - <columnDefinition name="WixDependency" type="string" length="72" primaryKey="yes" modularize="column"
22 - category="identifier" description="The non-localized primary key for the table."/>
23 - <columnDefinition name="ProviderKey" type="string" length="255"
24 - category="text" description="The name of the registry key that holds the provider identity."/>
25 - <columnDefinition name="MinVersion" type="string" length="72" nullable="yes"
26 - category="version" description="The minimum version of the provider supported."/>
27 - <columnDefinition name="MaxVersion" type="string" length="72" nullable="yes"
28 - category="version" description="The maximum version of the provider supported."/>
29 - <columnDefinition name="Attributes" type="number" length="4" nullable="yes"
30 - minValue="0" maxValue="2147483647" description="A 32-bit word that specifies the attribute flags to be applied."/>
31 - </tableDefinition>
32 - <tableDefinition name="WixDependencyRef" createSymbols="yes">
33 - <columnDefinition name="WixDependencyProvider_" type="string" length="72" primaryKey="yes" keyTable="WixDependencyProvider" keyColumn="1" modularize="column"
34 - category="identifier" description="Foreign key into the Component table." />
35 - <columnDefinition name="WixDependency_" type="string" length="72" primaryKey="yes" keyTable="WixDependency" keyColumn="1" modularize="column"
36 - category="identifier" description="Foreign key into the WixDependency table." />
37 - </tableDefinition>
38 -</tableDefinitions>