Store the name of the extended module in the SymbolGraph. #86057
+16
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The extended module's name is typically extracted from the filename of the symbolgraph. This approach is problematic for modules with long names, because the filename "ModuleA@ModuleB" can exceed the limits for filepath segments on common file systems, e.g. there's a limit of 255 on macOS. This root problem has an opt-in workaround now, with the changes in #83782 to support a new option "symbol-graph-shorten-output-names". But that approach alone leaves swift-docc-symbolkit in a tough spot to handle the alternative naming convention.
It would be nice to also support the symbolgraph files of modules with long names in swift-docc-symbolkit. That library extracts the name of the symbolgraph's module to use for merging declarations in the same module. In some modes, extensions are merged with declarations from the extended module instead of the declaring module. When generating symbolgraphs with
-symbol-graph-shorten-output-names, swift-docc-symbolkit cannot determine the extended module name. There appears to be 2 options to solve this: (A) propagate the rename map file throughout symbolkit and its callers to lookup the extended module's name as needed, or (B) store the extended module in the symbolgraph JSON representation.This change enables option B. This option reduces the complexity of changes in swift-docc-symbolkit, while allowing simple backwards compatibility by defaulting to the current "Module@Extended" naming scheme.
I will also share draft PRs for corresponding changes to swift-docc-symbolkit and swift-docc.
Dependencies