diff options
author | Rob Mensching <rob@firegiant.com> | 2022-03-19 11:09:40 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2022-03-19 11:54:45 -0700 |
commit | dc634c5c0fa8d6c646d75be144cc546abc4b72c7 (patch) | |
tree | cf4026f25b9f7cae091c4c2dbfba39693c2f412c | |
parent | fbc1a73743368211d5d8c7fc0625adf6eb9ca50c (diff) | |
download | wix-dc634c5c0fa8d6c646d75be144cc546abc4b72c7.tar.gz wix-dc634c5c0fa8d6c646d75be144cc546abc4b72c7.tar.bz2 wix-dc634c5c0fa8d6c646d75be144cc546abc4b72c7.zip |
Make ModuleSignature a standard table and no refs with EnsureTable
ModuleSignature was missing from the standard tables, that part is
easy. The breaking change is EnsureTable no longer tries to create
refs to custom tables when it doesn't recognize the table name as
standard or coming from an extension. Use CustomTableRef to create
custom table references.
Fixes 6424
-rw-r--r-- | src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs | 1 | ||||
-rw-r--r-- | src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs | 11 | ||||
-rw-r--r-- | src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | 17 | ||||
-rw-r--r-- | src/wix/test/Example.Extension/ExampleExtensionData.cs | 2 | ||||
-rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs | 8 | ||||
-rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs | 38 | ||||
-rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureExtensionTable.wxs (renamed from src/wix/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureTable.wxs) | 0 | ||||
-rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureModuleSignature.wxs | 10 |
8 files changed, 60 insertions, 27 deletions
diff --git a/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs b/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs index ad7646a7..21ca1b6d 100644 --- a/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs +++ b/src/api/wix/WixToolset.Data/Symbols/SymbolDefinitions.cs | |||
@@ -57,6 +57,7 @@ namespace WixToolset.Data | |||
57 | ModuleExclusion, | 57 | ModuleExclusion, |
58 | ModuleIgnoreTable, | 58 | ModuleIgnoreTable, |
59 | WixModule, | 59 | WixModule, |
60 | ModuleSignature, | ||
60 | ModuleSubstitution, | 61 | ModuleSubstitution, |
61 | MoveFile, | 62 | MoveFile, |
62 | Assembly, | 63 | Assembly, |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs index b1805e69..a4f6200e 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs | |||
@@ -1224,8 +1224,15 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
1224 | 1224 | ||
1225 | private void AddWixEnsureTableSymbol(WixEnsureTableSymbol symbol) | 1225 | private void AddWixEnsureTableSymbol(WixEnsureTableSymbol symbol) |
1226 | { | 1226 | { |
1227 | var tableDefinition = this.TableDefinitions[symbol.Table]; | 1227 | try |
1228 | this.Data.EnsureTable(tableDefinition); | 1228 | { |
1229 | var tableDefinition = this.TableDefinitions[symbol.Table]; | ||
1230 | this.Data.EnsureTable(tableDefinition); | ||
1231 | } | ||
1232 | catch (WixMissingTableDefinitionException e) | ||
1233 | { | ||
1234 | this.Messaging.Write(e.Error); | ||
1235 | } | ||
1229 | } | 1236 | } |
1230 | 1237 | ||
1231 | private void AddWixPackageSymbol(WixPackageSymbol symbol) | 1238 | private void AddWixPackageSymbol(WixPackageSymbol symbol) |
diff --git a/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs index 2d5c5b2e..654b56dc 100644 --- a/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs +++ b/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | |||
@@ -306,9 +306,6 @@ namespace WixToolset.Core.ExtensibilityServices | |||
306 | { | 306 | { |
307 | Table = tableDefinition.Name, | 307 | Table = tableDefinition.Name, |
308 | }); | 308 | }); |
309 | |||
310 | // TODO: Check if the given table definition is a custom table. For now we have to assume that it isn't. | ||
311 | //this.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixCustomTable, tableDefinition.Name); | ||
312 | } | 309 | } |
313 | 310 | ||
314 | public void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName) | 311 | public void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName) |
@@ -317,20 +314,6 @@ namespace WixToolset.Core.ExtensibilityServices | |||
317 | { | 314 | { |
318 | Table = tableName, | 315 | Table = tableName, |
319 | }); | 316 | }); |
320 | |||
321 | if (this.Creator == null) | ||
322 | { | ||
323 | this.CreateSymbolDefinitionCreator(); | ||
324 | } | ||
325 | |||
326 | // TODO: The tableName may not be the same as the symbolName. For now, we have to assume that it is. | ||
327 | // We don't add custom table definitions to the tableDefinitions collection, | ||
328 | // so if it's not in there, it better be a custom table. If the Id is just wrong, | ||
329 | // instead of a custom table, we get an unresolved reference at link time. | ||
330 | if (!this.Creator.TryGetSymbolDefinitionByName(tableName, out var _)) | ||
331 | { | ||
332 | this.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixCustomTable, tableName); | ||
333 | } | ||
334 | } | 317 | } |
335 | 318 | ||
336 | public string GetAttributeGuidValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool generatable = false, bool canBeEmpty = false) | 319 | public string GetAttributeGuidValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool generatable = false, bool canBeEmpty = false) |
diff --git a/src/wix/test/Example.Extension/ExampleExtensionData.cs b/src/wix/test/Example.Extension/ExampleExtensionData.cs index 91d60eb9..e8ae0cca 100644 --- a/src/wix/test/Example.Extension/ExampleExtensionData.cs +++ b/src/wix/test/Example.Extension/ExampleExtensionData.cs | |||
@@ -20,4 +20,4 @@ namespace Example.Extension | |||
20 | return symbolDefinition != null; | 20 | return symbolDefinition != null; |
21 | } | 21 | } |
22 | } | 22 | } |
23 | } \ No newline at end of file | 23 | } |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs index 67a5f132..cb1ecb04 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs | |||
@@ -846,8 +846,8 @@ namespace WixToolsetTest.CoreIntegration | |||
846 | } | 846 | } |
847 | } | 847 | } |
848 | 848 | ||
849 | [Fact(Skip = "Test demonstrates failure")] | 849 | [Fact] |
850 | public void FailsBuildAtLinkTimeForMissingEnsureTable() | 850 | public void FailsBuildAtBindTimeForMissingEnsureTable() |
851 | { | 851 | { |
852 | var folder = TestData.Get(@"TestData"); | 852 | var folder = TestData.Get(@"TestData"); |
853 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); | 853 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); |
@@ -873,7 +873,7 @@ namespace WixToolsetTest.CoreIntegration | |||
873 | first => | 873 | first => |
874 | { | 874 | { |
875 | Assert.Equal(MessageLevel.Error, first.Level); | 875 | Assert.Equal(MessageLevel.Error, first.Level); |
876 | Assert.Equal("The identifier 'WixCustomTable:TableDefinitionNotExposedByExtension' could not be found. Ensure you have typed the reference correctly and that all the necessary inputs are provided to the linker.", first.ToString()); | 876 | Assert.Equal("Cannot find the table definitions for the 'TableDefinitionNotExposedByExtension' table. This is likely due to a typing error or missing extension. Please ensure all the necessary extensions are supplied on the command line with the -ext parameter.", first.ToString()); |
877 | }); | 877 | }); |
878 | 878 | ||
879 | Assert.False(File.Exists(msiPath)); | 879 | Assert.False(File.Exists(msiPath)); |
@@ -884,7 +884,7 @@ namespace WixToolsetTest.CoreIntegration | |||
884 | { | 884 | { |
885 | return table.Rows.Select(r => JoinFields(r.Fields)).ToArray(); | 885 | return table.Rows.Select(r => JoinFields(r.Fields)).ToArray(); |
886 | 886 | ||
887 | string JoinFields(Field[] fields) | 887 | static string JoinFields(Field[] fields) |
888 | { | 888 | { |
889 | return String.Join('\t', fields.Select(f => f.ToString())); | 889 | return String.Join('\t', fields.Select(f => f.ToString())); |
890 | } | 890 | } |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs index f361a274..e94114bb 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs | |||
@@ -334,8 +334,40 @@ namespace WixToolsetTest.CoreIntegration | |||
334 | } | 334 | } |
335 | } | 335 | } |
336 | 336 | ||
337 | [Fact(Skip = "Test demonstrates failure")] | 337 | [Fact] |
338 | public void PopulatesExampleTableBecauseOfEnsureTable() | 338 | public void CanBuildMsiWithEmptyStandardTableBecauseOfEnsureTable() |
339 | { | ||
340 | var folder = TestData.Get(@"TestData"); | ||
341 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); | ||
342 | |||
343 | using (var fs = new DisposableFileSystem()) | ||
344 | { | ||
345 | var baseFolder = fs.GetFolder(); | ||
346 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
347 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
348 | |||
349 | var result = WixRunner.Execute(new[] | ||
350 | { | ||
351 | "build", | ||
352 | Path.Combine(folder, "EnsureTable", "EnsureModuleSignature.wxs"), | ||
353 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | ||
354 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
355 | "-ext", extensionPath, | ||
356 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
357 | "-intermediateFolder", intermediateFolder, | ||
358 | "-o", msiPath | ||
359 | }); | ||
360 | |||
361 | result.AssertSuccess(); | ||
362 | |||
363 | Assert.True(File.Exists(msiPath)); | ||
364 | var results = Query.QueryDatabaseByTable(msiPath, new[] { "ModuleSignature" }); | ||
365 | WixAssert.StringCollectionEmpty(results["ModuleSignature"]); | ||
366 | } | ||
367 | } | ||
368 | |||
369 | [Fact] | ||
370 | public void CanBuildMsiWithEmptyTableFromExtensionBecauseOfEnsureTable() | ||
339 | { | 371 | { |
340 | var folder = TestData.Get(@"TestData"); | 372 | var folder = TestData.Get(@"TestData"); |
341 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); | 373 | var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); |
@@ -349,7 +381,7 @@ namespace WixToolsetTest.CoreIntegration | |||
349 | var result = WixRunner.Execute(new[] | 381 | var result = WixRunner.Execute(new[] |
350 | { | 382 | { |
351 | "build", | 383 | "build", |
352 | Path.Combine(folder, "EnsureTable", "EnsureTable.wxs"), | 384 | Path.Combine(folder, "EnsureTable", "EnsureExtensionTable.wxs"), |
353 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), | 385 | Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), |
354 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | 386 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), |
355 | "-ext", extensionPath, | 387 | "-ext", extensionPath, |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureTable.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureExtensionTable.wxs index 01767abb..01767abb 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureTable.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureExtensionTable.wxs | |||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureModuleSignature.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureModuleSignature.wxs new file mode 100644 index 00000000..a7bc1ff2 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureModuleSignature.wxs | |||
@@ -0,0 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <ComponentGroupRef Id="MinimalComponentGroup" /> | ||
6 | </ComponentGroup> | ||
7 | |||
8 | <EnsureTable Id="ModuleSignature" /> | ||
9 | </Fragment> | ||
10 | </Wix> | ||