diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-03-26 12:59:03 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-04-02 14:58:00 -0700 |
| commit | 9cca339473d77c7036035f949239f5231c325968 (patch) | |
| tree | 342399ad52d1eb8102be17c71a12242c566fca25 /src/WixToolset.Core | |
| parent | 67bcf306aa020c5480b6dd28eab5db3d49264585 (diff) | |
| download | wix-9cca339473d77c7036035f949239f5231c325968.tar.gz wix-9cca339473d77c7036035f949239f5231c325968.tar.bz2 wix-9cca339473d77c7036035f949239f5231c325968.zip | |
Integrate the IntermediateSection and IntermediateSymbol mutable changes
Diffstat (limited to 'src/WixToolset.Core')
| -rw-r--r-- | src/WixToolset.Core/CompilerCore.cs | 3 | ||||
| -rw-r--r-- | src/WixToolset.Core/Librarian.cs | 2 | ||||
| -rw-r--r-- | src/WixToolset.Core/Link/WixGroupingOrdering.cs | 66 | ||||
| -rw-r--r-- | src/WixToolset.Core/Linker.cs | 13 |
4 files changed, 40 insertions, 44 deletions
diff --git a/src/WixToolset.Core/CompilerCore.cs b/src/WixToolset.Core/CompilerCore.cs index d737b359..0bc63d79 100644 --- a/src/WixToolset.Core/CompilerCore.cs +++ b/src/WixToolset.Core/CompilerCore.cs | |||
| @@ -1059,8 +1059,7 @@ namespace WixToolset.Core | |||
| 1059 | /// <returns>New section.</returns> | 1059 | /// <returns>New section.</returns> |
| 1060 | internal IntermediateSection CreateSection(string id, SectionType type, int codepage, string compilationId) | 1060 | internal IntermediateSection CreateSection(string id, SectionType type, int codepage, string compilationId) |
| 1061 | { | 1061 | { |
| 1062 | var section = new IntermediateSection(id, type, codepage); | 1062 | var section = new IntermediateSection(id, type, codepage, compilationId); |
| 1063 | section.CompilationId = compilationId; | ||
| 1064 | 1063 | ||
| 1065 | this.intermediate.Sections.Add(section); | 1064 | this.intermediate.Sections.Add(section); |
| 1066 | 1065 | ||
diff --git a/src/WixToolset.Core/Librarian.cs b/src/WixToolset.Core/Librarian.cs index 059a478b..1dd1b44d 100644 --- a/src/WixToolset.Core/Librarian.cs +++ b/src/WixToolset.Core/Librarian.cs | |||
| @@ -60,7 +60,7 @@ namespace WixToolset.Core | |||
| 60 | 60 | ||
| 61 | foreach (var section in sections) | 61 | foreach (var section in sections) |
| 62 | { | 62 | { |
| 63 | section.LibraryId = context.LibraryId; | 63 | section.AssignToLibrary(context.LibraryId); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | library = new Intermediate(context.LibraryId, IntermediateLevels.Compiled, sections, localizationsByCulture); | 66 | library = new Intermediate(context.LibraryId, IntermediateLevels.Compiled, sections, localizationsByCulture); |
diff --git a/src/WixToolset.Core/Link/WixGroupingOrdering.cs b/src/WixToolset.Core/Link/WixGroupingOrdering.cs index a8044a0c..99220900 100644 --- a/src/WixToolset.Core/Link/WixGroupingOrdering.cs +++ b/src/WixToolset.Core/Link/WixGroupingOrdering.cs | |||
| @@ -23,7 +23,7 @@ namespace WixToolset.Core.Link | |||
| 23 | private List<string> groupTypes; | 23 | private List<string> groupTypes; |
| 24 | private List<string> itemTypes; | 24 | private List<string> itemTypes; |
| 25 | private ItemCollection items; | 25 | private ItemCollection items; |
| 26 | private readonly List<int> rowsUsed; | 26 | private readonly List<IntermediateSymbol> symbolsUsed; |
| 27 | private bool loaded; | 27 | private bool loaded; |
| 28 | 28 | ||
| 29 | /// <summary> | 29 | /// <summary> |
| @@ -36,7 +36,7 @@ namespace WixToolset.Core.Link | |||
| 36 | this.EntrySection = entrySections; | 36 | this.EntrySection = entrySections; |
| 37 | this.Messaging = messageHandler; | 37 | this.Messaging = messageHandler; |
| 38 | 38 | ||
| 39 | this.rowsUsed = new List<int>(); | 39 | this.symbolsUsed = new List<IntermediateSymbol>(); |
| 40 | this.loaded = false; | 40 | this.loaded = false; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| @@ -144,16 +144,9 @@ namespace WixToolset.Core.Link | |||
| 144 | /// </summary> | 144 | /// </summary> |
| 145 | public void RemoveUsedGroupRows() | 145 | public void RemoveUsedGroupRows() |
| 146 | { | 146 | { |
| 147 | var sortedIndexes = this.rowsUsed.Distinct().OrderByDescending(i => i).ToList(); | 147 | foreach (var symbol in this.symbolsUsed) |
| 148 | |||
| 149 | //Table wixGroupTable = this.output.Tables["WixGroup"]; | ||
| 150 | //Debug.Assert(null != wixGroupTable); | ||
| 151 | //Debug.Assert(sortedIndexes[0] < wixGroupTable.Rows.Count); | ||
| 152 | |||
| 153 | foreach (int rowIndex in sortedIndexes) | ||
| 154 | { | 148 | { |
| 155 | //wixGroupTable.Rows.RemoveAt(rowIndex); | 149 | this.EntrySection.RemoveSymbol(symbol); |
| 156 | this.EntrySection.Symbols.RemoveAt(rowIndex); | ||
| 157 | } | 150 | } |
| 158 | } | 151 | } |
| 159 | 152 | ||
| @@ -236,39 +229,36 @@ namespace WixToolset.Core.Link | |||
| 236 | //} | 229 | //} |
| 237 | 230 | ||
| 238 | // Collect all of the groups | 231 | // Collect all of the groups |
| 239 | for (int rowIndex = 0; rowIndex < this.EntrySection.Symbols.Count; ++rowIndex) | 232 | foreach (var symbol in this.EntrySection.Symbols.OfType<WixGroupSymbol>()) |
| 240 | { | 233 | { |
| 241 | if (this.EntrySection.Symbols[rowIndex] is WixGroupSymbol row) | 234 | var rowParentName = symbol.ParentId; |
| 235 | var rowParentType = symbol.ParentType.ToString(); | ||
| 236 | var rowChildName = symbol.ChildId; | ||
| 237 | var rowChildType = symbol.ChildType.ToString(); | ||
| 238 | |||
| 239 | // If this row specifies a parent or child type that's not in our | ||
| 240 | // lists, we assume it's not a row that we're concerned about. | ||
| 241 | if (!this.groupTypes.Contains(rowParentType) || | ||
| 242 | !this.itemTypes.Contains(rowChildType)) | ||
| 242 | { | 243 | { |
| 243 | var rowParentName = row.ParentId; | 244 | continue; |
| 244 | var rowParentType = row.ParentType.ToString(); | 245 | } |
| 245 | var rowChildName = row.ChildId; | ||
| 246 | var rowChildType = row.ChildType.ToString(); | ||
| 247 | |||
| 248 | // If this row specifies a parent or child type that's not in our | ||
| 249 | // lists, we assume it's not a row that we're concerned about. | ||
| 250 | if (!this.groupTypes.Contains(rowParentType) || | ||
| 251 | !this.itemTypes.Contains(rowChildType)) | ||
| 252 | { | ||
| 253 | continue; | ||
| 254 | } | ||
| 255 | 246 | ||
| 256 | this.rowsUsed.Add(rowIndex); | 247 | this.symbolsUsed.Add(symbol); |
| 257 | 248 | ||
| 258 | if (!this.items.TryGetValue(rowParentType, rowParentName, out var parentItem)) | 249 | if (!this.items.TryGetValue(rowParentType, rowParentName, out var parentItem)) |
| 259 | { | 250 | { |
| 260 | parentItem = new Item(row, rowParentType, rowParentName); | 251 | parentItem = new Item(symbol, rowParentType, rowParentName); |
| 261 | this.items.Add(parentItem); | 252 | this.items.Add(parentItem); |
| 262 | } | 253 | } |
| 263 | |||
| 264 | if (!this.items.TryGetValue(rowChildType, rowChildName, out var childItem)) | ||
| 265 | { | ||
| 266 | childItem = new Item(row, rowChildType, rowChildName); | ||
| 267 | this.items.Add(childItem); | ||
| 268 | } | ||
| 269 | 254 | ||
| 270 | parentItem.ChildItems.Add(childItem); | 255 | if (!this.items.TryGetValue(rowChildType, rowChildName, out var childItem)) |
| 256 | { | ||
| 257 | childItem = new Item(symbol, rowChildType, rowChildName); | ||
| 258 | this.items.Add(childItem); | ||
| 271 | } | 259 | } |
| 260 | |||
| 261 | parentItem.ChildItems.Add(childItem); | ||
| 272 | } | 262 | } |
| 273 | } | 263 | } |
| 274 | 264 | ||
diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs index a6d43715..320f7d1f 100644 --- a/src/WixToolset.Core/Linker.cs +++ b/src/WixToolset.Core/Linker.cs | |||
| @@ -585,13 +585,15 @@ namespace WixToolset.Core | |||
| 585 | // now and after processing added back in Step 3 below. | 585 | // now and after processing added back in Step 3 below. |
| 586 | foreach (var section in sections) | 586 | foreach (var section in sections) |
| 587 | { | 587 | { |
| 588 | var removeSymbols = new List<IntermediateSymbol>(); | ||
| 589 | |||
| 588 | // Count down because we'll sometimes remove items from the list. | 590 | // Count down because we'll sometimes remove items from the list. |
| 589 | for (var i = section.Symbols.Count - 1; i >= 0; --i) | 591 | foreach (var symbol in section.Symbols) |
| 590 | { | 592 | { |
| 591 | // Only process the "grouping parents" such as FeatureGroup, ComponentGroup, Feature, | 593 | // Only process the "grouping parents" such as FeatureGroup, ComponentGroup, Feature, |
| 592 | // and Module. Non-grouping complex references are simple and | 594 | // and Module. Non-grouping complex references are simple and |
| 593 | // resolved during normal complex reference resolutions. | 595 | // resolved during normal complex reference resolutions. |
| 594 | if (section.Symbols[i] is WixComplexReferenceSymbol wixComplexReferenceRow && | 596 | if (symbol is WixComplexReferenceSymbol wixComplexReferenceRow && |
| 595 | (ComplexReferenceParentType.FeatureGroup == wixComplexReferenceRow.ParentType || | 597 | (ComplexReferenceParentType.FeatureGroup == wixComplexReferenceRow.ParentType || |
| 596 | ComplexReferenceParentType.ComponentGroup == wixComplexReferenceRow.ParentType || | 598 | ComplexReferenceParentType.ComponentGroup == wixComplexReferenceRow.ParentType || |
| 597 | ComplexReferenceParentType.Feature == wixComplexReferenceRow.ParentType || | 599 | ComplexReferenceParentType.Feature == wixComplexReferenceRow.ParentType || |
| @@ -611,7 +613,7 @@ namespace WixToolset.Core | |||
| 611 | } | 613 | } |
| 612 | 614 | ||
| 613 | childrenComplexRefs.Add(wixComplexReferenceRow); | 615 | childrenComplexRefs.Add(wixComplexReferenceRow); |
| 614 | section.Symbols.RemoveAt(i); | 616 | removeSymbols.Add(wixComplexReferenceRow); |
| 615 | 617 | ||
| 616 | // Remember the mapping from set of complex references with a common | 618 | // Remember the mapping from set of complex references with a common |
| 617 | // parent to their section. We'll need this to add them back to the | 619 | // parent to their section. We'll need this to add them back to the |
| @@ -635,6 +637,11 @@ namespace WixToolset.Core | |||
| 635 | } | 637 | } |
| 636 | } | 638 | } |
| 637 | } | 639 | } |
| 640 | |||
| 641 | foreach (var removeSymbol in removeSymbols) | ||
| 642 | { | ||
| 643 | section.RemoveSymbol(removeSymbol); | ||
| 644 | } | ||
| 638 | } | 645 | } |
| 639 | 646 | ||
| 640 | Debug.Assert(parentGroups.Count == parentGroupsSections.Count); | 647 | Debug.Assert(parentGroups.Count == parentGroupsSections.Count); |
