Skip to content
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

Merged
merged 19 commits into from
Mar 19, 2022
Merged

Snippets #7

merged 19 commits into from
Mar 19, 2022

Conversation

bitjammer
Copy link
Contributor

@bitjammer bitjammer commented Mar 14, 2022

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.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

@bitjammer
Copy link
Contributor Author

Going ahead and opening this for referencing in an upcoming SE.

@ethan-kusters ethan-kusters self-requested a review March 17, 2022 00:48
Package.swift Outdated Show resolved Hide resolved
Package.swift Outdated Show resolved Hide resolved
@bitjammer bitjammer changed the title [WIP] Snippets Snippets Mar 17, 2022
bitjammer and others added 14 commits March 18, 2022 15:50
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.
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.
@bitjammer bitjammer force-pushed the acgarland/snippets branch from f8660e8 to 2d8a7ee Compare March 18, 2022 22:50
@bitjammer
Copy link
Contributor Author

@swift-ci Please test

It's enough to check the total number of snippets rather than
checking the groups top-down.
bitjammer and others added 2 commits March 18, 2022 16:18
When trimming leading and trailing newlines, use the existing
`trimmingCharacters(in:)` API. NFC.
@ethan-kusters
Copy link
Contributor

@swift-ci please test

1 similar comment
@ethan-kusters
Copy link
Contributor

@swift-ci please test

@ethan-kusters
Copy link
Contributor

@swift-ci please test

@bitjammer bitjammer merged commit 859caac into swiftlang:main Mar 19, 2022
@bitjammer bitjammer deleted the acgarland/snippets branch March 19, 2022 02:10
@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Mar 22, 2022

@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

@bitjammer
Copy link
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants