Fix "Add emit extension block symbols option to dump-symbol-graph and SymbolGraphOptions" #5985
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.
This PR reintroduces support for emitting extension block symbols for the
dump-symbol-graph
command originally introduced by #5892 and reverted by #5975.Reversion
The original PR #5892 was reverted because it caused a CMake build failure on Windows that hadn't been reported in the GitHub CI overview for the PR. This was fixed with 1de306b. #5978, which contains the exact same changes as this PR, already landed on main. However, due to an unrelated build failure in the toolchain (see comments on #5978), merging #5978 was delayed until after the Swift 5.8 branch off.
The following sections are taken from #5892 and should provide a good overview over the scope of this change and its impact on the Swift 5.8 release.
Motivation:
Extension block symbols with the respective command line flags
-emit-extension-block-symbols
and-omit-extension-block-symbols
were introduced in swiftlang/swift#59047 and swiftlang/swift#61637 as part of an ongoing effort to solve apple/swift-docc#210. These flags should be exposed in higher-level commands such asswift package dump-symbol-graph
as well as the package plugin API, so that users and package manager plugins such as apple/swift-docc-plugin can access them more easily. This PR is the last step before we can provide extension support in the DocC Package Plugin.Modifications:
This PR adds the flag-pair
--emit-extension-block-symbols
/--omit-extension-block-symbols
to theDumpSymbolGraph
command and exposes theemitExtensionBlocks
option inPluginToHostMessage.SymbolGraphOptions
.SymbolGraphExtract
was also extended by anemitExtensionBlockSymbols
option and itsextractSymbolGraph
function adds the respective compiler command line flag accordingly.Result:
swift package dump-symbol-graph --emit-extension-block-symbols
dumps symbol graph files that extension block symbol format. The default behavior does not change. The--omit-extension-block-symbols
flag will be used to explicitly disable the feature once the default behavior has been changed to--emit-extension-block-symbols
in the future.Package Plugins can specify the
emitExtensionBlocks
property requesting symbol graphs, e.g.:The default behavior for package plugins also does not change.