Closed cmcgee1024 closed 1 week ago
IIUC it would generate the Swift API documentation for C/ObjC/(Obj)C++ APIs and not the documentation for the underlying APIs, i.e. it does not resolve https://github.com/swiftlang/swift-docc-plugin/issues/47?
@daniel-grumberg in my experience it will display the Swift view of the documentation, so yes this doesn't resolve #47. I don't understand enough about DocC internals to enable the language toggle on the top-right so that someone can switch between C/Swift/etc. Does the plugin control that somehow?
This change would be a prerequisite but we would need an associated change in SwiftPM itself to generate SGFs with clang in the implementation of https://github.com/swiftlang/swift-package-manager/blob/d31cf0539de2590f54e11e5bae4771d7ee5a77e6/Sources/PackagePlugin/PackageManagerProxy.swift#L229
@swift-ci please test
Thanks @daniel-grumberg. I don't have the power to merge this PR, so I'll leave that to someone who does. I plan to look at making the SwiftPM side capable of generating the clang symbol graph.
I would like for @d-ronnqvist to have a look but lgtm
This could be the piece that is missing from the SwiftPM side. https://github.com/swiftlang/swift-package-manager/pull/5639
That looks mostly like it but it's pretty old and would need revisiting.
@swift-ci please test
@d-ronnqvist I've updated this PR and ran the CI, but I don't have permission to merge this. Anything else needed here, or can this be merged?
@d-ronnqvist I've updated this PR and ran the CI, but I don't have permission to merge this. Anything else needed here, or can this be merged?
This can be merged. Let me do that right now.
Summary
With this change you can now treat C/C++ targets through clang in the same way as Swift. They can be included in generated doccarchive and previewed in the same way.
Update the uses of SwiftSourceModuleTarget to use the more general SourceModuleTarget.
Dependencies
No dependencies on this change. DocC itself can generate documentation for C/C++ symbol graphs.
Testing
Git clone a package that has a C target, such as the SwiftPM enabled version of libarchive here and run the docc plugin to generate a preview of its documentation.
Steps:
git clone -b vendor-libarchive https://github.com/cmcgee1024/swiftly.git
cd swiftly/libarchive
CArchive
targetswift package --disable-sandbox preview-documentation --target CArchive
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded