Swift-DocC plugin for SwiftPM

Hi all! Quick update here.

The Swift-DocC Plugin has just been updated for the latest API changes in the SwiftPM command plugin infrastructure. I think a few of you noticed that the Swift-DocC plugin broke with the latest Xcode beta (CC: @Joseph_Heck), so if you update to the latest version on main, you should find things working again.


The SwiftPM command plugin UX has been updated so that options like --target and --product are passed directly to the plugin instead of to the package manager itself.

This means that instead of invoking the Swift-DocC plugin with something like:

swift package --target SwiftMarkdown generate-documentation

you would now do:

swift package generate-documentation --target SwiftMarkdown

Besides being (in my opinion) a generally more user-friendly command-line experience, this allows plugins to be a little smarter about choosing which targets to build. For example, now when a user invokes the basic

swift package generate-documentation

the plugin will generate documentation for all targets used in your package, including those defined by dependencies.

This also allows users of the plugin to specify products and targets of dependencies which makes doing something like

swift package --disable-sandbox preview-documetnation --product ArgumentParser

possible for packages that import ArgumentParser.

I think this will be great for improving the experience of learning about a new package you're depending on.

Please let me know if you run into any issues! As we approach the release of Swift 5.6, we're also working towards the 1.0 release of the Swift-DocC plugin so any and all feedback is very much appreciated.

- Ethan

7 Likes