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

Publish Swift SymbolKit's documentation to GitHub pages #19

Merged
merged 8 commits into from
Mar 23, 2022

Conversation

Kyle-Ye
Copy link
Contributor

@Kyle-Ye Kyle-Ye commented Mar 20, 2022

Summary

This sets the foundation for deploying Swift SymbolKit's documentation to GitHub pages.

  • Adds the Swift-DocC Plugin as a dependency of Swift-SymbolKit.
  • Adds a script to simplify deployment of documentation to GitHub pages.
  • Adds check-source and test script and fix missing headers.
  • Update README docs (Remove some duplication and add a link to the github page).
  • Adds pull request template file as other swift-docc related repo.

After merging this PR, we should be able to prepare a gh-pages branch on the main swift-docc-symbolkit repo with no content on it, run the bin/update-gh-pages-documentation-site script and have docs available.

Dependencies

None.

Testing

With Swift 5.6, run:

swift package --disable-sandbox preview-documentation --target SymbolKit

and confirm the Swift-DocC preview works as expected.

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

Most of the content of this PR comes from @ethan-kusters. This is just a port for swift-docc-symbolkit repo.
See more info here swiftlang/swift-markdown#32

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 20, 2022

@swift-ci please test

Copy link
Contributor

@ethan-kusters ethan-kusters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks so much for putting this together @Kyle-Ye.

I went ahead and used the script you included to deploy to my fork and it looks like everything is working as expected: https://ethan-kusters.github.io/swift-docc-symbolkit/documentation/symbolkit/.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
bin/test Outdated Show resolved Hide resolved
bin/test Outdated Show resolved Hide resolved
bin/check-source Outdated Show resolved Hide resolved
@Kyle-Ye Kyle-Ye force-pushed the adopt-swift-docc-plugin branch from 0028e33 to acf0876 Compare March 21, 2022 17:13
@Kyle-Ye Kyle-Ye requested a review from ethan-kusters March 21, 2022 17:15
@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 21, 2022

@swift-ci please test

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 21, 2022

By the way, swift-docc-plugin has a dependency on main branch of swift-docc-symbolkit. Would it consider to be a circle reference?

@Kyle-Ye Kyle-Ye force-pushed the adopt-swift-docc-plugin branch from acf0876 to 99c820e Compare March 21, 2022 17:22
@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 21, 2022

@swift-ci please test

@ethan-kusters
Copy link
Contributor

By the way, swift-docc-plugin has a dependency on main branch of swift-docc-symbolkit. Would it consider to be a circle reference?

That is a great question... Let me check.

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 21, 2022

@swift-ci please test macOS

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 21, 2022

The macOS Platform CI just exits directly🤔. Could you help confirm with it? @ethan-kusters

@ethan-kusters

This comment was marked as outdated.

@ethan-kusters
Copy link
Contributor

@swift-ci please test

@ethan-kusters
Copy link
Contributor

By the way, swift-docc-plugin has a dependency on main branch of swift-docc-symbolkit. Would it consider to be a circle reference?

That is a great question... Let me check.

It looks like it does:

% swift build
Fetching https://github.com/apple/swift-docc-plugin from cache
Fetched https://github.com/apple/swift-docc-plugin (0.42s)
Creating working copy for https://github.com/apple/swift-docc-plugin
Working copy of https://github.com/apple/swift-docc-plugin resolved at main
error: cyclic dependency declaration found: SymbolKit -> SwiftDocCPlugin -> SymbolKit

Hm. I think we'll need to figure out a workaround here... It might be we just need to add a custom script for building documentation instead of using the plugin. I'm intentionally trying to keep the number of dependencies the plugin has a to a minimum for this exact reason but SymbolKit is unavoidable at the moment.

Copy link
Contributor

@ethan-kusters ethan-kusters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I don't think we can land this as-is since it will introduce a cyclic dependency with the Swift-DocC Plugin.

@Kyle-Ye Kyle-Ye mentioned this pull request Mar 22, 2022
3 tasks
@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 22, 2022

Unfortunately I don't think we can land this as-is since it will introduce a cyclic dependency with the Swift-DocC Plugin.

Got it, seems like the dependency was introduced 3 days ago by swiftlang/swift-docc-plugin#7.

So there is 2 ways to solve this:

  1. Remove SymbolKit dependency on Swift-Docc Plugin. (I think "Swift-Docc Plugin" is a basic plugin and should not depends on "SymbolKit")
  2. Change the PR to use a new script instead of using Swift-Docc Plugin which causes a duplication and potential inconsistency.

Personally I prefer way 1, but way 2 is acceptable for me. Can I get your suggestion on this? @ethan-kusters cc @bitjammer

@ethan-kusters
Copy link
Contributor

Unfortunately I don't think we can land this as-is since it will introduce a cyclic dependency with the Swift-DocC Plugin.

Got it, seems like the dependency was introduced 3 days ago by apple/swift-docc-plugin#7.

So there is 2 ways to solve this:

  1. Remove SymbolKit dependency on Swift-Docc Plugin. (I think "Swift-Docc Plugin" is a basic plugin and should not depends on "SymbolKit")
  2. Change the PR to use a new script instead of using Swift-Docc Plugin which causes a duplication and potential inconsistency.

Personally I prefer way 1, but way 2 is acceptable for me. Can I get your suggestion on this? @ethan-kusters cc @bitjammer

@bitjammer can speak to this more but my understanding is in the longer-term we'd like to move the new snippet-build executable to a separate repository so it can be used by more projects than just the swift-docc-plugin but, for now, the plugin is the place where it makes the most sense.

So I think we should plan on using a custom script instead of the Swift-DocC Plugin for now but plan on removing it and adopting the Plugin as soon as it becomes possible.

I've written a couple of similar scripts before, so I'm happy to open a PR against your branch later today to add the basis for something and we can iterate on it there.

@bitjammer
Copy link
Contributor

So unfortunately, moving the tool to a new repo will not solve the dependency problem as SwiftPM plugins share their dependency graph with their clients. This is not an intentional limitation and ought to be fixed but I don't see it happening very soon. We can't remove the dependency on SymbolKit because we use the Symbol Graph model to communicate snippet information to DocC. I'm seeing what my options are for deploying the tool elsewhere but if we can have this one exception in the meantime, I would appreciate it!

@ethan-kusters
Copy link
Contributor

ethan-kusters commented Mar 23, 2022

@Kyle-Ye I've opened a PR against your branch here with a script as a temporary workaround until we resolve these issues with the plugin:

Feel free to merge it directly into this PR if it looks good to you.

Temporarily removes the Swift-DocC Plugin since we have a depenency cycle issue.
@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 23, 2022

@swift-ci please test

@Kyle-Ye Kyle-Ye requested a review from ethan-kusters March 23, 2022 12:51
Copy link
Contributor

@ethan-kusters ethan-kusters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for all your work on this @Kyle-Ye.

@Kyle-Ye Kyle-Ye merged commit 99a8121 into swiftlang:main Mar 23, 2022
@Kyle-Ye Kyle-Ye deleted the adopt-swift-docc-plugin branch March 23, 2022 16:54
@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 23, 2022

The doc page is currently unavailable https://apple.github.io/swift-docc-symbolkit/documentation/symbolkit/

Seems that we need to create/enable the some environment like the following.
截屏2022-03-24 00 56 27

cc @franklinsch

@franklinsch
Copy link
Contributor

It's live now: https://apple.github.io/swift-docc-symbolkit/documentation/symbolkit. Thanks for the amazing work here once again @Kyle-Ye 🚀

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.

4 participants