diff options
Diffstat (limited to 'src/WixToolset.Core/Linker.cs')
| -rw-r--r-- | src/WixToolset.Core/Linker.cs | 79 |
1 files changed, 33 insertions, 46 deletions
diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs index bc4f5774..4c4c6063 100644 --- a/src/WixToolset.Core/Linker.cs +++ b/src/WixToolset.Core/Linker.cs | |||
| @@ -211,9 +211,6 @@ namespace WixToolset.Core | |||
| 211 | // resolve the feature to feature connects | 211 | // resolve the feature to feature connects |
| 212 | this.ResolveFeatureToFeatureConnects(featuresToFeatures, find.Symbols); | 212 | this.ResolveFeatureToFeatureConnects(featuresToFeatures, find.Symbols); |
| 213 | 213 | ||
| 214 | // start generating OutputTables and OutputRows for all the sections in the output | ||
| 215 | var ensureTableRows = new List<IntermediateTuple>(); | ||
| 216 | |||
| 217 | // Create the section to hold the linked content. | 214 | // Create the section to hold the linked content. |
| 218 | var resolvedSection = new IntermediateSection(find.EntrySection.Id, find.EntrySection.Type, find.EntrySection.Codepage); | 215 | var resolvedSection = new IntermediateSection(find.EntrySection.Id, find.EntrySection.Type, find.EntrySection.Codepage); |
| 219 | 216 | ||
| @@ -239,7 +236,7 @@ namespace WixToolset.Core | |||
| 239 | case TupleDefinitionType.Class: | 236 | case TupleDefinitionType.Class: |
| 240 | if (SectionType.Product == resolvedSection.Type) | 237 | if (SectionType.Product == resolvedSection.Type) |
| 241 | { | 238 | { |
| 242 | this.ResolveFeatures(tuple, 2, 11, componentsToFeatures, multipleFeatureComponents); | 239 | this.ResolveFeatures(tuple, (int)ClassTupleFields.ComponentRef, (int)ClassTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents); |
| 243 | } | 240 | } |
| 244 | break; | 241 | break; |
| 245 | 242 | ||
| @@ -294,7 +291,7 @@ namespace WixToolset.Core | |||
| 294 | case TupleDefinitionType.Extension: | 291 | case TupleDefinitionType.Extension: |
| 295 | if (SectionType.Product == resolvedSection.Type) | 292 | if (SectionType.Product == resolvedSection.Type) |
| 296 | { | 293 | { |
| 297 | this.ResolveFeatures(tuple, 1, 4, componentsToFeatures, multipleFeatureComponents); | 294 | this.ResolveFeatures(tuple, (int)ExtensionTupleFields.ComponentRef, (int)ExtensionTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents); |
| 298 | } | 295 | } |
| 299 | break; | 296 | break; |
| 300 | 297 | ||
| @@ -311,35 +308,31 @@ namespace WixToolset.Core | |||
| 311 | case TupleDefinitionType.Assembly: | 308 | case TupleDefinitionType.Assembly: |
| 312 | if (SectionType.Product == resolvedSection.Type) | 309 | if (SectionType.Product == resolvedSection.Type) |
| 313 | { | 310 | { |
| 314 | this.ResolveFeatures(tuple, 0, 1, componentsToFeatures, multipleFeatureComponents); | 311 | this.ResolveFeatures(tuple, (int)AssemblyTupleFields.ComponentRef, (int)AssemblyTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents); |
| 315 | } | 312 | } |
| 316 | break; | 313 | break; |
| 317 | 314 | ||
| 318 | case TupleDefinitionType.PublishComponent: | 315 | case TupleDefinitionType.PublishComponent: |
| 319 | if (SectionType.Product == resolvedSection.Type) | 316 | if (SectionType.Product == resolvedSection.Type) |
| 320 | { | 317 | { |
| 321 | this.ResolveFeatures(tuple, 2, 4, componentsToFeatures, multipleFeatureComponents); | 318 | this.ResolveFeatures(tuple, (int)PublishComponentTupleFields.ComponentRef, (int)PublishComponentTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents); |
| 322 | } | 319 | } |
| 323 | break; | 320 | break; |
| 324 | 321 | ||
| 325 | case TupleDefinitionType.Shortcut: | 322 | case TupleDefinitionType.Shortcut: |
| 326 | if (SectionType.Product == resolvedSection.Type) | 323 | if (SectionType.Product == resolvedSection.Type) |
| 327 | { | 324 | { |
| 328 | this.ResolveFeatures(tuple, 3, 4, componentsToFeatures, multipleFeatureComponents); | 325 | this.ResolveFeatures(tuple, (int)ShortcutTupleFields.ComponentRef, (int)ShortcutTupleFields.Target, componentsToFeatures, multipleFeatureComponents); |
| 329 | } | 326 | } |
| 330 | break; | 327 | break; |
| 331 | 328 | ||
| 332 | case TupleDefinitionType.TypeLib: | 329 | case TupleDefinitionType.TypeLib: |
| 333 | if (SectionType.Product == resolvedSection.Type) | 330 | if (SectionType.Product == resolvedSection.Type) |
| 334 | { | 331 | { |
| 335 | this.ResolveFeatures(tuple, 2, 6, componentsToFeatures, multipleFeatureComponents); | 332 | this.ResolveFeatures(tuple, (int)TypeLibTupleFields.ComponentRef, (int)TypeLibTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents); |
| 336 | } | 333 | } |
| 337 | break; | 334 | break; |
| 338 | 335 | ||
| 339 | case TupleDefinitionType.WixEnsureTable: | ||
| 340 | ensureTableRows.Add(tuple); | ||
| 341 | break; | ||
| 342 | |||
| 343 | #if MOVE_TO_BACKEND | 336 | #if MOVE_TO_BACKEND |
| 344 | case "WixFile": | 337 | case "WixFile": |
| 345 | foreach (Row row in table.Rows) | 338 | foreach (Row row in table.Rows) |
| @@ -404,7 +397,7 @@ namespace WixToolset.Core | |||
| 404 | 397 | ||
| 405 | if (copyTuple) | 398 | if (copyTuple) |
| 406 | { | 399 | { |
| 407 | resolvedSection.Tuples.Add(tuple); | 400 | resolvedSection.AddTuple(tuple); |
| 408 | } | 401 | } |
| 409 | } | 402 | } |
| 410 | } | 403 | } |
| @@ -414,13 +407,11 @@ namespace WixToolset.Core | |||
| 414 | { | 407 | { |
| 415 | foreach (var feature in connectToFeature.ConnectFeatures) | 408 | foreach (var feature in connectToFeature.ConnectFeatures) |
| 416 | { | 409 | { |
| 417 | var row = new WixFeatureModulesTuple | 410 | resolvedSection.AddTuple(new WixFeatureModulesTuple |
| 418 | { | 411 | { |
| 419 | FeatureRef = feature, | 412 | FeatureRef = feature, |
| 420 | WixMergeRef = connectToFeature.ChildId | 413 | WixMergeRef = connectToFeature.ChildId |
| 421 | }; | 414 | }); |
| 422 | |||
| 423 | resolvedSection.Tuples.Add(row); | ||
| 424 | } | 415 | } |
| 425 | } | 416 | } |
| 426 | 417 | ||
| @@ -554,9 +545,9 @@ namespace WixToolset.Core | |||
| 554 | #endif | 545 | #endif |
| 555 | 546 | ||
| 556 | // copy the wix variable rows to the output after all overriding has been accounted for. | 547 | // copy the wix variable rows to the output after all overriding has been accounted for. |
| 557 | foreach (var row in wixVariables.Values) | 548 | foreach (var tuple in wixVariables.Values) |
| 558 | { | 549 | { |
| 559 | resolvedSection.Tuples.Add(row); | 550 | resolvedSection.AddTuple(tuple); |
| 560 | } | 551 | } |
| 561 | 552 | ||
| 562 | // Bundles have groups of data that must be flattened in a way different from other types. | 553 | // Bundles have groups of data that must be flattened in a way different from other types. |
| @@ -774,9 +765,8 @@ namespace WixToolset.Core | |||
| 774 | 765 | ||
| 775 | foreach (var section in sections) | 766 | foreach (var section in sections) |
| 776 | { | 767 | { |
| 777 | var featureComponents = new List<FeatureComponentsTuple>(); | 768 | // Need ToList since we might want to add tuples while processing. |
| 778 | 769 | foreach (var wixComplexReferenceRow in section.Tuples.OfType<WixComplexReferenceTuple>().ToList()) | |
| 779 | foreach (var wixComplexReferenceRow in section.Tuples.OfType<WixComplexReferenceTuple>()) | ||
| 780 | { | 770 | { |
| 781 | ConnectToFeature connection; | 771 | ConnectToFeature connection; |
| 782 | switch (wixComplexReferenceRow.ParentType) | 772 | switch (wixComplexReferenceRow.ParentType) |
| @@ -810,11 +800,11 @@ namespace WixToolset.Core | |||
| 810 | } | 800 | } |
| 811 | 801 | ||
| 812 | // add a row to the FeatureComponents table | 802 | // add a row to the FeatureComponents table |
| 813 | var featureComponent = new FeatureComponentsTuple(); | 803 | section.AddTuple(new FeatureComponentsTuple |
| 814 | featureComponent.FeatureRef = wixComplexReferenceRow.Parent; | 804 | { |
| 815 | featureComponent.ComponentRef = wixComplexReferenceRow.Child; | 805 | FeatureRef = wixComplexReferenceRow.Parent, |
| 816 | 806 | ComponentRef = wixComplexReferenceRow.Child, | |
| 817 | featureComponents.Add(featureComponent); | 807 | }); |
| 818 | 808 | ||
| 819 | // index the component for finding orphaned records | 809 | // index the component for finding orphaned records |
| 820 | var symbolName = String.Concat("Component:", wixComplexReferenceRow.Child); | 810 | var symbolName = String.Concat("Component:", wixComplexReferenceRow.Child); |
| @@ -878,10 +868,12 @@ namespace WixToolset.Core | |||
| 878 | componentsToModules.Add(wixComplexReferenceRow.Child, wixComplexReferenceRow); // should always be new | 868 | componentsToModules.Add(wixComplexReferenceRow.Child, wixComplexReferenceRow); // should always be new |
| 879 | 869 | ||
| 880 | // add a row to the ModuleComponents table | 870 | // add a row to the ModuleComponents table |
| 881 | var moduleComponent = new ModuleComponentsTuple(); | 871 | section.AddTuple(new ModuleComponentsTuple |
| 882 | moduleComponent.Component = wixComplexReferenceRow.Child; | 872 | { |
| 883 | moduleComponent.ModuleID = wixComplexReferenceRow.Parent; | 873 | Component = wixComplexReferenceRow.Child, |
| 884 | moduleComponent.Language = Convert.ToInt32(wixComplexReferenceRow.ParentLanguage); | 874 | ModuleID = wixComplexReferenceRow.Parent, |
| 875 | Language = Convert.ToInt32(wixComplexReferenceRow.ParentLanguage), | ||
| 876 | }); | ||
| 885 | } | 877 | } |
| 886 | 878 | ||
| 887 | // index the component for finding orphaned records | 879 | // index the component for finding orphaned records |
| @@ -931,11 +923,6 @@ namespace WixToolset.Core | |||
| 931 | throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceParentType), wixComplexReferenceRow.ParentType))); | 923 | throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceParentType), wixComplexReferenceRow.ParentType))); |
| 932 | } | 924 | } |
| 933 | } | 925 | } |
| 934 | |||
| 935 | foreach (var featureComponent in featureComponents) | ||
| 936 | { | ||
| 937 | section.Tuples.Add(featureComponent); | ||
| 938 | } | ||
| 939 | } | 926 | } |
| 940 | } | 927 | } |
| 941 | 928 | ||
| @@ -1048,7 +1035,7 @@ namespace WixToolset.Core | |||
| 1048 | (ComplexReferenceParentType.ComponentGroup != wixComplexReferenceRow.ParentType) && | 1035 | (ComplexReferenceParentType.ComponentGroup != wixComplexReferenceRow.ParentType) && |
| 1049 | (ComplexReferenceParentType.PatchFamilyGroup != wixComplexReferenceRow.ParentType)) | 1036 | (ComplexReferenceParentType.PatchFamilyGroup != wixComplexReferenceRow.ParentType)) |
| 1050 | { | 1037 | { |
| 1051 | section.Tuples.Add(wixComplexReferenceRow); | 1038 | section.AddTuple(wixComplexReferenceRow); |
| 1052 | } | 1039 | } |
| 1053 | } | 1040 | } |
| 1054 | } | 1041 | } |
| @@ -1322,15 +1309,15 @@ namespace WixToolset.Core | |||
| 1322 | /// <summary> | 1309 | /// <summary> |
| 1323 | /// Resolve features for columns that have null guid placeholders. | 1310 | /// Resolve features for columns that have null guid placeholders. |
| 1324 | /// </summary> | 1311 | /// </summary> |
| 1325 | /// <param name="rows">Rows to resolve.</param> | 1312 | /// <param name="tuple">Tuple to resolve.</param> |
| 1326 | /// <param name="connectionColumn">Number of the column containing the connection identifier.</param> | 1313 | /// <param name="connectionColumn">Number of the column containing the connection identifier.</param> |
| 1327 | /// <param name="featureColumn">Number of the column containing the feature.</param> | 1314 | /// <param name="featureColumn">Number of the column containing the feature.</param> |
| 1328 | /// <param name="connectToFeatures">Connect to feature complex references.</param> | 1315 | /// <param name="connectToFeatures">Connect to feature complex references.</param> |
| 1329 | /// <param name="multipleFeatureComponents">Hashtable of known components under multiple features.</param> | 1316 | /// <param name="multipleFeatureComponents">Hashtable of known components under multiple features.</param> |
| 1330 | private void ResolveFeatures(IntermediateTuple row, int connectionColumn, int featureColumn, ConnectToFeatureCollection connectToFeatures, Hashtable multipleFeatureComponents) | 1317 | private void ResolveFeatures(IntermediateTuple tuple, int connectionColumn, int featureColumn, ConnectToFeatureCollection connectToFeatures, Hashtable multipleFeatureComponents) |
| 1331 | { | 1318 | { |
| 1332 | var connectionId = row.AsString(connectionColumn); | 1319 | var connectionId = tuple.AsString(connectionColumn); |
| 1333 | var featureId = row.AsString(featureColumn); | 1320 | var featureId = tuple.AsString(featureColumn); |
| 1334 | 1321 | ||
| 1335 | if (EmptyGuid == featureId) | 1322 | if (EmptyGuid == featureId) |
| 1336 | { | 1323 | { |
| @@ -1338,14 +1325,14 @@ namespace WixToolset.Core | |||
| 1338 | 1325 | ||
| 1339 | if (null == connection) | 1326 | if (null == connection) |
| 1340 | { | 1327 | { |
| 1341 | // display an error for the component or merge module as approrpriate | 1328 | // display an error for the component or merge module as appropriate |
| 1342 | if (null != multipleFeatureComponents) | 1329 | if (null != multipleFeatureComponents) |
| 1343 | { | 1330 | { |
| 1344 | this.Messaging.Write(ErrorMessages.ComponentExpectedFeature(row.SourceLineNumbers, connectionId, row.Definition.Name, row.Id.Id)); | 1331 | this.Messaging.Write(ErrorMessages.ComponentExpectedFeature(tuple.SourceLineNumbers, connectionId, tuple.Definition.Name, tuple.Id.Id)); |
| 1345 | } | 1332 | } |
| 1346 | else | 1333 | else |
| 1347 | { | 1334 | { |
| 1348 | this.Messaging.Write(ErrorMessages.MergeModuleExpectedFeature(row.SourceLineNumbers, connectionId)); | 1335 | this.Messaging.Write(ErrorMessages.MergeModuleExpectedFeature(tuple.SourceLineNumbers, connectionId)); |
| 1349 | } | 1336 | } |
| 1350 | } | 1337 | } |
| 1351 | else | 1338 | else |
| @@ -1373,7 +1360,7 @@ namespace WixToolset.Core | |||
| 1373 | } | 1360 | } |
| 1374 | 1361 | ||
| 1375 | // set the feature | 1362 | // set the feature |
| 1376 | row.Set(featureColumn, connection.PrimaryFeature); | 1363 | tuple.Set(featureColumn, connection.PrimaryFeature); |
| 1377 | } | 1364 | } |
| 1378 | } | 1365 | } |
| 1379 | } | 1366 | } |
