diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-04-03 11:38:20 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-04-03 13:51:31 +1000 |
| commit | 11112ebcdf97d4fa53e34d9dfe48410ff2378435 (patch) | |
| tree | d995b68bb319a052c2259c8a4b6dbdf665926fca | |
| parent | 37356647817b72a336eeedaa7472e268a04054c8 (diff) | |
| download | wix-11112ebcdf97d4fa53e34d9dfe48410ff2378435.tar.gz wix-11112ebcdf97d4fa53e34d9dfe48410ff2378435.tar.bz2 wix-11112ebcdf97d4fa53e34d9dfe48410ff2378435.zip | |
Use TupleIdIsPrimaryKey.
7 files changed, 13 insertions, 41 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs index 3a165582..79b7b67b 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateOutputFromIRCommand.cs | |||
| @@ -64,10 +64,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 64 | this.AddAssemblyTuple((AssemblyTuple)tuple); | 64 | this.AddAssemblyTuple((AssemblyTuple)tuple); |
| 65 | break; | 65 | break; |
| 66 | 66 | ||
| 67 | case TupleDefinitionType.Binary: | ||
| 68 | this.AddTupleDefaultly(tuple, idIsPrimaryKey: true); | ||
| 69 | break; | ||
| 70 | |||
| 71 | case TupleDefinitionType.BBControl: | 67 | case TupleDefinitionType.BBControl: |
| 72 | this.AddBBControlTuple((BBControlTuple)tuple); | 68 | this.AddBBControlTuple((BBControlTuple)tuple); |
| 73 | break; | 69 | break; |
| @@ -112,10 +108,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 112 | this.AddFileTuple((FileTuple)tuple); | 108 | this.AddFileTuple((FileTuple)tuple); |
| 113 | break; | 109 | break; |
| 114 | 110 | ||
| 115 | case TupleDefinitionType.Icon: | ||
| 116 | this.AddTupleDefaultly(tuple, idIsPrimaryKey: true); | ||
| 117 | break; | ||
| 118 | |||
| 119 | case TupleDefinitionType.IniFile: | 111 | case TupleDefinitionType.IniFile: |
| 120 | this.AddIniFileTuple((IniFileTuple)tuple); | 112 | this.AddIniFileTuple((IniFileTuple)tuple); |
| 121 | break; | 113 | break; |
| @@ -144,10 +136,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 144 | this.AddMsiServiceConfigFailureActionsTuple((MsiServiceConfigFailureActionsTuple)tuple); | 136 | this.AddMsiServiceConfigFailureActionsTuple((MsiServiceConfigFailureActionsTuple)tuple); |
| 145 | break; | 137 | break; |
| 146 | 138 | ||
| 147 | case TupleDefinitionType.MsiShortcutProperty: | ||
| 148 | this.AddTupleDefaultly(tuple, idIsPrimaryKey: true); | ||
| 149 | break; | ||
| 150 | |||
| 151 | case TupleDefinitionType.MoveFile: | 139 | case TupleDefinitionType.MoveFile: |
| 152 | this.AddMoveFileTuple((MoveFileTuple)tuple); | 140 | this.AddMoveFileTuple((MoveFileTuple)tuple); |
| 153 | break; | 141 | break; |
| @@ -177,10 +165,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 177 | this.AddRemoveRegistryTuple((RemoveRegistryTuple)tuple); | 165 | this.AddRemoveRegistryTuple((RemoveRegistryTuple)tuple); |
| 178 | break; | 166 | break; |
| 179 | 167 | ||
| 180 | case TupleDefinitionType.ReserveCost: | ||
| 181 | this.AddTupleDefaultly(tuple, idIsPrimaryKey: true); | ||
| 182 | break; | ||
| 183 | |||
| 184 | case TupleDefinitionType.ServiceControl: | 168 | case TupleDefinitionType.ServiceControl: |
| 185 | this.AddServiceControlTuple((ServiceControlTuple)tuple); | 169 | this.AddServiceControlTuple((ServiceControlTuple)tuple); |
| 186 | break; | 170 | break; |
| @@ -192,10 +176,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 192 | case TupleDefinitionType.Shortcut: | 176 | case TupleDefinitionType.Shortcut: |
| 193 | this.AddShortcutTuple((ShortcutTuple)tuple); | 177 | this.AddShortcutTuple((ShortcutTuple)tuple); |
| 194 | break; | 178 | break; |
| 195 | |||
| 196 | case TupleDefinitionType.Signature: | ||
| 197 | this.AddTupleDefaultly(tuple, idIsPrimaryKey: true); | ||
| 198 | break; | ||
| 199 | 179 | ||
| 200 | case TupleDefinitionType.SummaryInformation: | 180 | case TupleDefinitionType.SummaryInformation: |
| 201 | this.AddTupleDefaultly(tuple, tableName: "_SummaryInformation"); | 181 | this.AddTupleDefaultly(tuple, tableName: "_SummaryInformation"); |
| @@ -1070,7 +1050,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 1070 | } | 1050 | } |
| 1071 | } | 1051 | } |
| 1072 | 1052 | ||
| 1073 | private void AddTupleDefaultly(IntermediateTuple tuple, bool idIsPrimaryKey = false, string tableName = null) | 1053 | private void AddTupleDefaultly(IntermediateTuple tuple, string tableName = null) |
| 1074 | { | 1054 | { |
| 1075 | if (!this.TableDefinitions.TryGet(tableName ?? tuple.Definition.Name, out var tableDefinition)) | 1055 | if (!this.TableDefinitions.TryGet(tableName ?? tuple.Definition.Name, out var tableDefinition)) |
| 1076 | { | 1056 | { |
| @@ -1080,7 +1060,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 1080 | var row = this.CreateRow(tuple, tableDefinition); | 1060 | var row = this.CreateRow(tuple, tableDefinition); |
| 1081 | var rowOffset = 0; | 1061 | var rowOffset = 0; |
| 1082 | 1062 | ||
| 1083 | if (idIsPrimaryKey) | 1063 | if (tableDefinition.TupleIdIsPrimaryKey) |
| 1084 | { | 1064 | { |
| 1085 | row[0] = tuple.Id.Id; | 1065 | row[0] = tuple.Id.Id; |
| 1086 | rowOffset = 1; | 1066 | rowOffset = 1; |
diff --git a/src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs b/src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs index 34efe8e3..80179d1c 100644 --- a/src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/WindowsInstallerBackendHelper.cs | |||
| @@ -10,9 +10,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 10 | 10 | ||
| 11 | internal class WindowsInstallerBackendHelper : IWindowsInstallerBackendHelper | 11 | internal class WindowsInstallerBackendHelper : IWindowsInstallerBackendHelper |
| 12 | { | 12 | { |
| 13 | public bool TryAddTupleToOutputMatchingTableDefinitions(IntermediateTuple tuple, WindowsInstallerData output, IEnumerable<TableDefinition> tableDefinitions) => this.TryAddTupleToOutputMatchingTableDefinitions(tuple, output, tableDefinitions, false); | 13 | public bool TryAddTupleToOutputMatchingTableDefinitions(IntermediateTuple tuple, WindowsInstallerData output, IEnumerable<TableDefinition> tableDefinitions) |
| 14 | |||
| 15 | public bool TryAddTupleToOutputMatchingTableDefinitions(IntermediateTuple tuple, WindowsInstallerData output, IEnumerable<TableDefinition> tableDefinitions, bool columnZeroIsId) | ||
| 16 | { | 14 | { |
| 17 | var tableDefinition = tableDefinitions.FirstOrDefault(t => t.TupleDefinitionName == tuple.Definition.Name); | 15 | var tableDefinition = tableDefinitions.FirstOrDefault(t => t.TupleDefinitionName == tuple.Definition.Name); |
| 18 | 16 | ||
| @@ -25,7 +23,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 25 | var row = table.CreateRow(tuple.SourceLineNumbers); | 23 | var row = table.CreateRow(tuple.SourceLineNumbers); |
| 26 | var rowOffset = 0; | 24 | var rowOffset = 0; |
| 27 | 25 | ||
| 28 | if (columnZeroIsId) | 26 | if (tableDefinition.TupleIdIsPrimaryKey) |
| 29 | { | 27 | { |
| 30 | row[0] = tuple.Id.Id; | 28 | row[0] = tuple.Id.Id; |
| 31 | rowOffset = 1; | 29 | rowOffset = 1; |
diff --git a/src/test/Example.Extension/ExampleCompilerExtension.cs b/src/test/Example.Extension/ExampleCompilerExtension.cs index 52168adc..e821b7b6 100644 --- a/src/test/Example.Extension/ExampleCompilerExtension.cs +++ b/src/test/Example.Extension/ExampleCompilerExtension.cs | |||
| @@ -88,9 +88,8 @@ namespace Example.Extension | |||
| 88 | 88 | ||
| 89 | if (!this.Messaging.EncounteredError) | 89 | if (!this.Messaging.EncounteredError) |
| 90 | { | 90 | { |
| 91 | var tuple = this.ParseHelper.CreateTuple(section, sourceLineNumbers, "Example"); | 91 | var tuple = this.ParseHelper.CreateTuple(section, sourceLineNumbers, "Example", id); |
| 92 | tuple.Set(0, id.Id); | 92 | tuple.Set(0, value); |
| 93 | tuple.Set(1, value); | ||
| 94 | } | 93 | } |
| 95 | } | 94 | } |
| 96 | 95 | ||
diff --git a/src/test/Example.Extension/ExampleTuple.cs b/src/test/Example.Extension/ExampleTuple.cs index 0fc0d82c..f2bcb925 100644 --- a/src/test/Example.Extension/ExampleTuple.cs +++ b/src/test/Example.Extension/ExampleTuple.cs | |||
| @@ -1,4 +1,4 @@ | |||
| 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 Example.Extension | 3 | namespace Example.Extension |
| 4 | { | 4 | { |
| @@ -6,7 +6,6 @@ namespace Example.Extension | |||
| 6 | 6 | ||
| 7 | public enum ExampleTupleFields | 7 | public enum ExampleTupleFields |
| 8 | { | 8 | { |
| 9 | Example, | ||
| 10 | Value, | 9 | Value, |
| 11 | } | 10 | } |
| 12 | 11 | ||
diff --git a/src/test/Example.Extension/ExampleTupleDefinitions.cs b/src/test/Example.Extension/ExampleTupleDefinitions.cs index a9771509..dd8b5bbf 100644 --- a/src/test/Example.Extension/ExampleTupleDefinitions.cs +++ b/src/test/Example.Extension/ExampleTupleDefinitions.cs | |||
| @@ -13,7 +13,6 @@ namespace Example.Extension | |||
| 13 | ExampleName, | 13 | ExampleName, |
| 14 | new[] | 14 | new[] |
| 15 | { | 15 | { |
| 16 | new IntermediateFieldDefinition(nameof(ExampleTupleFields.Example), IntermediateFieldType.String), | ||
| 17 | new IntermediateFieldDefinition(nameof(ExampleTupleFields.Value), IntermediateFieldType.String), | 16 | new IntermediateFieldDefinition(nameof(ExampleTupleFields.Value), IntermediateFieldType.String), |
| 18 | }, | 17 | }, |
| 19 | typeof(ExampleTuple)); | 18 | typeof(ExampleTuple)); |
diff --git a/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs index b75e8ad9..3103f94f 100644 --- a/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs | |||
| @@ -63,9 +63,8 @@ namespace WixToolsetTest.CoreIntegration | |||
| 63 | Assert.Equal(@"example.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); | 63 | Assert.Equal(@"example.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); |
| 64 | 64 | ||
| 65 | var example = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).Single(); | 65 | var example = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).Single(); |
| 66 | Assert.Null(example.Id?.Id); | 66 | Assert.Equal("Foo", example.Id?.Id); |
| 67 | Assert.Equal("Foo", example[0].AsString()); | 67 | Assert.Equal("Bar", example[0].AsString()); |
| 68 | Assert.Equal("Bar", example[1].AsString()); | ||
| 69 | } | 68 | } |
| 70 | } | 69 | } |
| 71 | 70 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs index c7af6439..0e740554 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs | |||
| @@ -168,9 +168,8 @@ namespace WixToolsetTest.CoreIntegration | |||
| 168 | Assert.Equal(@"example.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); | 168 | Assert.Equal(@"example.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); |
| 169 | 169 | ||
| 170 | var example = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).Single(); | 170 | var example = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).Single(); |
| 171 | Assert.Null(example.Id?.Id); | 171 | Assert.Equal("Foo", example.Id?.Id); |
| 172 | Assert.Equal("Foo", example[0].AsString()); | 172 | Assert.Equal("Bar", example[0].AsString()); |
| 173 | Assert.Equal("Bar", example[1].AsString()); | ||
| 174 | } | 173 | } |
| 175 | } | 174 | } |
| 176 | 175 | ||
| @@ -232,9 +231,8 @@ namespace WixToolsetTest.CoreIntegration | |||
| 232 | Assert.Equal(@"other.txt", fileTuples[1][FileTupleFields.Source].PreviousValue.AsPath().Path); | 231 | Assert.Equal(@"other.txt", fileTuples[1][FileTupleFields.Source].PreviousValue.AsPath().Path); |
| 233 | 232 | ||
| 234 | var examples = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).ToArray(); | 233 | var examples = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).ToArray(); |
| 235 | Assert.Equal(new string[] { null, null }, examples.Select(t => t.Id?.Id).ToArray()); | 234 | Assert.Equal(new string[] { "Foo", "Other" }, examples.Select(t => t.Id?.Id).ToArray()); |
| 236 | Assert.Equal(new[] { "Foo", "Other" }, examples.Select(t => t.AsString(0)).ToArray()); | 235 | Assert.Equal(new[] { "Bar", "Value" }, examples.Select(t => t[0].AsString()).ToArray()); |
| 237 | Assert.Equal(new[] { "Bar", "Value" }, examples.Select(t => t[1].AsString()).ToArray()); | ||
| 238 | } | 236 | } |
| 239 | } | 237 | } |
| 240 | } | 238 | } |
