-
Notifications
You must be signed in to change notification settings - Fork 54
Description
Description
swift-docc-plugin currently cannot include symbols from @_exported import declarations in generated documentation, even though the underlying symbolgraph-extract tool supports this via the --experimental-allowed-reexported-modules flag (implemented in swiftlang/swift#73080).
This creates an inconsistency with Xcode's documentation building, which does include @_exported symbols.
Current Limitation
The swift-docc-plugin uses symbolgraph-extract but has no mechanism to pass the --experimental-allowed-reexported-modules flag that would enable inclusion of @_exported symbols. This means packages that use @_exported imports to provide a unified API surface cannot generate complete documentation using swift-docc-plugin.
Example Impact
For a package that uses @_exported imports:
// DemoKit target
@_exported import _DemoKit // C module
@_exported import DemoKitCore // Swift module- Current behavior: Documentation only includes symbols directly defined in DemoKit
- Expected behavior: Documentation includes symbols from DemoKit, _DemoKit, and DemoKitCore
Related Work
- SwiftPM Issue: Add PackagePlugin API to pass experimental flags to symbol graph extraction for @_exported imports swift-package-manager#9101 - Tracking the need for PackagePlugin API support
- Swift PR: [SymbolGraphGen] Correctly handle exported imports in swift-symbolgraph-extract swift#73080 - Implementation of the experimental flag in symbolgraph-extract
- Forum Discussion: https://forums.swift.org/t/filtering-out-exported-import-symbols-from-symbol-graphs/57022/5
Next Steps
This issue depends on SwiftPM providing the necessary PackagePlugin API to pass experimental flags. Once that API is available, swift-docc-plugin can be updated to:
- Accept configuration for including @_exported symbols
- Pass the appropriate flags to symbolgraph-extract
- Generate documentation that matches the expected module interface
Workaround
Currently, there is no workaround available within swift-docc-plugin to include @_exported symbols in documentation.