In following up on enabling traits deeper into the swift ecosystem, I dug into how to enable a feature request to add the traits support for generating documentation.
What I found was that the docc-plugin code uses the getSymbolGraphs API from the PackagePlugin interface that Package Manager exposes - but there’s currently no path to request either specific or all traits for a package. I think the correct path is to expand this API surface to support some indicator of traits with the getSymbolGraphs API - most likely the options.
I opened an issue/feature-request on SwiftPM for this feature, but before I start hacking on prototypes or solutions, I wanted to inquire here to see if I’m on the right path - or if there’s another API or alternate path that I was missing for getting symbol graphs back to the docc-plugin from SwiftPM that allowed me to specify package traits.
I also haven’t (yet) dug through all the package plugin code paths to really understand how or where the code currently does the work - so for anyone that’s been down that path before, are there any gotchas to look out for, or constraints that a solution would need to reside within? My initial thought was to expand the “options” struct that the API accepts to allow for specifying traits, and then passing that through and using it within the package manager to either retrieve the relevant symbols or invoke a build to create them in order to pass them back.