-
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
The docc-plugin preview-documentation sometimes fails to preview content with snippets #99
Comments
I just thought to try |
I reproduced the issue with the main branch of docc-plugin as well. And iterated through a few commits. The issue appears to be happening when there's a snippet added, but no curation or reference to the symbols added into the catalog. Once some curation and reference is added, that extends to the primary documentation page for the catalog, the content renders correctly. If there is no |
I switched back and forth between 1.4.3 and Working when there's a git commit with snippet curated into cataloggit checkout c7dcaf514abc318c1ab7aded31b3a4b4ebb35023
swift package update
rm -rf .build # clean the build
swift package --disable-sandbox preview-documentation --target Voxels -->
Prior commit with only the snippetgit checkout 6089364a89cfa1360c26a85d6ad005994274833e
rm -rf .build # clean the build
swift package --disable-sandbox preview-documentation --target Voxels -->
5 iterations of this same command:
And a variation I didn't expectI moved back forward to verify - the commit that previously worked - and used this same sequence of commands, and the contents didn't resolve git checkout c7dcaf514abc318c1ab7aded31b3a4b4ebb35023
swift package update
rm -rf .build # clean the build
swift package --disable-sandbox preview-documentation --target Voxels -->
Running the following steps repeatedly (5 iterations)git checkout c7dcaf514abc318c1ab7aded31b3a4b4ebb35023
rm -rf .build # clean the build
swift package update
swift package --disable-sandbox preview-documentation --target Voxels
Since this seems to be more of a race-condition issue, I jumped back to a commit before I added snippets to see if that's a factor: git checkout 0.2.4
rm -rf .build # clean the build
swift package --disable-sandbox preview-documentation --target Voxels 5 iterations:
From this, I'm hypothesizing that there's a race condition in there somewhere, acerbated by Snippets existing that doesn't otherwise normally show up. |
Double checking with
Repeating just the preview command (without clearing the build):
Based on this, trying to alleviate things by clearing the I snapshotted the
And indeed, voxels.json is missing from the non-functioning version, but this content appears to be regenerated on every iteration of the |
I broke this down and started down the path of debugging the plugin, only to realize the issue is upstream in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/docc preview /Users/heckj/src/Voxels/Sources/Voxels/Documentation.docc --emit-lmdb-index --fallback-display-name Voxels --fallback-bundle-identifier Voxels --additional-symbol-graph-dir /Users/heckj/src/Voxels/.build/plugins/Swift-DocC\ Preview/outputs/.build/symbol-graphs/unified-symbol-graphs/Voxels-7 --output-path /Users/heckj/src/Voxels/.build/plugins/Swift-DocC\ Preview/outputs/Voxels.doccarchive Is what appears to have the race condition.
So the issue appears to be in the underlying |
detail migrated to swiftlang/swift-docc#1084 and closing this, since it's not docc-plugin specific. |
The docc-plugin preview-documentation command appears to be failing to generate a module index page when snippets are added to the project.
This is with Swift 6.0.2 and swift-docc-plugin
1.4.3
(Xcode 16.1 release).When I run the command to preview my documentation:
I see the (mostly) normal output:
A difference from what I expected is that there's no
documentation/voxels
on the URL presented, which happens on other projects.When I opened a browser, going to
http://localhost:8080/documentation/voxels
, the JS browser error reports a missing filevoxels.json
.Looking at the .build directory, I see
.build/plugins/Swift-DocC Preview/outputs/Voxels.doccarchive/data/documentation
, the directory of whichvoxels
within it and a collection of all the symbols in JSON format. However, there isn't avoxels.json
file in that directory.Checklist
main
branch of this package.Expected behavior
Describe what you expected to happen.
Actual behavior
Describe or copy/paste the behavior you observe.
Steps to Reproduce
(URL for the above shows
http://localhost:8080/documentation/voxels
and resolves correctly)(URL for the next commit shows
http://localhost:8080/
and fails to resolve)The only difference between these two commits is adding the file
Snippets/example-snippet.swift
to the project.Swift-DocC Plugin Version Information
Swift-DocC plugin version:
1.4.2
for example, or a commit hash.Swift Compiler version: Output from
swiftc --version
:The text was updated successfully, but these errors were encountered: