-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snippets #7
Snippets #7
Conversation
Going ahead and opening this for referencing in an upcoming SE. |
The `snippet-build` tool crawls the `Snippets` subdirectory of a Swift Package if present, parses the `.swift` files within, and creates snippets and snippet groups. If there are any snippets, they are serialized into a Symbol Graph JSON file into an output directory. rdar://89650557
Group names with spaces cause problems with path components / URLs.
Instead of expecting a particular directory name, just in case. Add some logging to the tool.
Forward generated Symbol Graph JSON to the docc invocation.
Just in case.
Plugins can't have their own dependencies because they currently share the same dependency graph as the clients opting into the plugin. rdar://89789701
Co-authored-by: Ethan Kusters <[email protected]>
Not necessary for swift-docc-plugin builds at this time.
f8660e8
to
2d8a7ee
Compare
@swift-ci Please test |
It's enough to check the total number of snippets rather than checking the groups top-down.
When trimming leading and trailing newlines, use the existing `trimmingCharacters(in:)` API. NFC.
@swift-ci please test |
1 similar comment
@swift-ci please test |
@swift-ci please test |
@bitjammer Sorry to bother after this is merged. Could we remove SymbolKit dependence on swift-docc-plugin since it is a basic plugin. Once it depends on SymbolKit, it stops SymbolKit itself to use swift-docc-plugin. See swiftlang/swift-docc-symbolkit#19 |
@Kyle-Ye I think it is not really possible to remove the SymbolKit dependency since that is how we will communicate snippet information to DocC, and we shouldn't manually generate JSON in this tool. I am investigating some other options in light of the dependency problem with SwiftPM plugins in general but the tool is already foregoing some useful dependencies. |
Summary
Add snippets support to the Swift DocC Plugin.
Dependencies
No outstanding PR dependencies, although this does add a new dependency on SymbolKit, which should match DocC's version.
Testing
New unit and integration tests added. Run tests as usual.
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded