Skip to content

Add DocC to SwiftSyntax #468

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

Merged
merged 1 commit into from
Aug 3, 2022
Merged

Add DocC to SwiftSyntax #468

merged 1 commit into from
Aug 3, 2022

Conversation

kimdv
Copy link
Contributor

@kimdv kimdv commented Jun 18, 2022

I've been looking into moving the documentation gh-pages, so we can use DocC.

An example can be found here: https://kimdv.github.io/swift-syntax/documentation/swiftsyntax/

I've also been considering to adding Swift Package Index documentaion.

Let me hear what you think. 👍

@ahoppen
Copy link
Member

ahoppen commented Jun 20, 2022

I like the idea of publishing the documentation as GitHub pages. There are a few organizational questions that need to be answered first, like:

  • I don’t think we provide GitHub pages for any other repo in the apple organization, so we need to figure out if there are any implications if we start doing so for SwiftSyntax.
  • This adds a dependency from SwiftSyntax on swift-docc-plugin which makes it more difficult if that plugin wanted to start using SwiftSyntax in the future because that would create a dependency cycle
  • We would need to ensure that the documentation is up-to-date, either by creating a CI job or by requiring every commit to re-generate the docs, similar to what we do with the gyb-generated files

I think all of this is doable but requires some coordination. I’m looking into it but it might take a while.

@kimdv
Copy link
Contributor Author

kimdv commented Jun 20, 2022

I like the idea of publishing the documentation as GitHub pages. There are a few organizational questions that need to be answered first, like:

  • I don’t think we provide GitHub pages for any other repo in the apple organization, so we need to figure out if there are any implications if we start doing so for SwiftSyntax.

Swift-NIO does: https://github.com/apple/swift-nio
https://apple.github.io/swift-nio/docs/current/NIOCore/index.html . They use right now jazzy.

  • This adds a dependency from SwiftSyntax on swift-docc-plugin which makes it more difficult if that plugin wanted to start using SwiftSyntax in the future because that would create a dependency cycle

It will yes. And the plugin depends on swift-docc, so we need to think carefully here.
Or we can make a branch, what we rebase on main, and generate from that, so it's not part of the official release.
That branch is only used for docs generation.

  • We would need to ensure that the documentation is up-to-date, either by creating a CI job or by requiring every commit to re-generate the docs, similar to what we do with the gyb-generated files

Yes. Docc don't support versions either right now, but there is an issue open on swift-docc, so it's tracked.

I think all of this is doable but requires some coordination. I’m looking into it but it might take a while.

@kimdv
Copy link
Contributor Author

kimdv commented Jun 21, 2022

One thing that just hit, was that we must improve the generated docs.
See if we can add missing descriptions python nodes etc.

What it is, what it is used for etc. maybe some inline examples

@kimdv kimdv force-pushed the kimdv/add-docc branch 2 times, most recently from 1dbfd9e to 18d9cb8 Compare August 3, 2022 07:07
@kimdv kimdv force-pushed the kimdv/add-docc branch 2 times, most recently from 9867ada to 112ce13 Compare August 3, 2022 07:30
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Some improvement suggestions for the landing pages.

@kimdv kimdv marked this pull request as ready for review August 3, 2022 07:46
@kimdv kimdv force-pushed the kimdv/add-docc branch 3 times, most recently from 16cc925 to 18a669d Compare August 3, 2022 08:25
@kimdv kimdv requested a review from ahoppen August 3, 2022 08:26
@kimdv
Copy link
Contributor Author

kimdv commented Aug 3, 2022

@swift-ci please test

@ahoppen
Copy link
Member

ahoppen commented Aug 3, 2022

@swift-ci Please test

@ahoppen
Copy link
Member

ahoppen commented Aug 3, 2022

I think the commit in this PR has the wrong commit message ;-)

@kimdv
Copy link
Contributor Author

kimdv commented Aug 3, 2022

I think the commit in this PR has the wrong commit message ;-)

Whoops 🤦‍♂️

Changed

@kimdv
Copy link
Contributor Author

kimdv commented Aug 3, 2022

@swift-ci Please test

@kimdv
Copy link
Contributor Author

kimdv commented Aug 3, 2022

Looks like something timed out

Fetching https://github.com/apple/swift-docc-plugin
warning: skipping cache due to an error: Failed to clone repository https://github.com/apple/swift-docc-plugin:
    Cloning into bare repository '/home/build-user/.cache/org.swift.swiftpm/repositories/swift-docc-plugin-a84d795b'...
    fatal: unable to access 'https://github.com/apple/swift-docc-plugin/': Failed to connect to github.com port 443: Connection timed out
Fetching https://github.com/apple/swift-docc-plugin
warning: skipping cache due to an error: Failed to clone repository https://github.com/apple/swift-docc-plugin:
    Cloning into bare repository '/home/build-user/.cache/org.swift.swiftpm/repositories/swift-docc-plugin-a84d795b'...
    fatal: unable to access 'https://github.com/apple/swift-docc-plugin/': Failed to connect to github.com port 443: Connection timed out
Fetching https://github.com/apple/swift-docc-plugin
warning: skipping cache due to an error: Failed to clone repository https://github.com/apple/swift-docc-plugin:
    Cloning into bare repository '/home/build-user/.cache/org.swift.swiftpm/repositories/swift-docc-plugin-a84d795b'...
    fatal: unable to access 'https://github.com/apple/swift-docc-plugin/': Failed to connect to github.com port 443: Connection timed out
error: Failed to clone repository https://github.com/apple/swift-docc-plugin:
    Cloning into bare repository '/home/build-user/build/buildbot_incremental/unified-swiftpm-build-linux-x86_64/repositories/swift-docc-plugin-a84d795b'...
    fatal: unable to access 'https://github.com/apple/swift-docc-plugin/': Failed to connect to github.com port 443: Connection timed out

@swift-ci please test linux

@kimdv
Copy link
Contributor Author

kimdv commented Aug 3, 2022

@swift-ci please test linux

@kimdv
Copy link
Contributor Author

kimdv commented Aug 3, 2022

Failed again so rebased on main and tried again 🤷‍♂️

** Done Generating gyb Files **
** Running code generation **
/home/build-user/build/buildbot_incremental/toolchain-linux-x86_64/usr/bin/swift run --package-path /home/build-user/swift-syntax --enable-test-discovery --configuration release --build-path /home/build-user/build/buildbot_incremental/unified-swiftpm-build-linux-x86_64 --multiroot-data-file /home/build-user/swift/utils/build_swift/resources/SwiftPM-Unified-Build.xcworkspace SwiftSyntaxBuilderGeneration /tmp/tmpxw0zvdn5 --verbose
FAIL: Source generation using SwiftSyntaxBuilder failed
Executing: /home/build-user/build/buildbot_incremental/toolchain-linux-x86_64/usr/bin/swift run --package-path /home/build-user/swift-syntax --enable-test-discovery --configuration release --build-path /home/build-user/build/buildbot_incremental/unified-swiftpm-build-linux-x86_64 --multiroot-data-file /home/build-user/swift/utils/build_swift/resources/SwiftPM-Unified-Build.xcworkspace SwiftSyntaxBuilderGeneration /tmp/tmpxw0zvdn5 --verbose
None
ERROR: command terminated with a non-zero exit status 1, aborting

@ahoppen
Copy link
Member

ahoppen commented Aug 3, 2022

I think the issue is that CI is not allowed to access the internet during the CI run. We might need to disable docc if the SWIFT_BUILD_SCRIPT_ENVIRONMENT environment variable is present, similar to https://github.com/apple/swift-syntax/blob/3e5751ec9b3f829aa380ab2db9169150f93b1ce6/Package.swift#L9

@kimdv
Copy link
Contributor Author

kimdv commented Aug 3, 2022

Something line this @ahoppen ?

@ahoppen
Copy link
Member

ahoppen commented Aug 3, 2022

Yes, that’s what I had in mind.

@kimdv
Copy link
Contributor Author

kimdv commented Aug 3, 2022

@swift-ci please test

@kimdv kimdv merged commit 8875897 into swiftlang:main Aug 3, 2022
@kimdv kimdv deleted the kimdv/add-docc branch December 14, 2022 14:26
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.

2 participants