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

swift-docc-plugin generate-documentation results in empty docc catalog - no symbols - when using a local binary target/XCFramework #50

Open
2 tasks done
heckj opened this issue Feb 16, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@heckj
Copy link
Member

heckj commented Feb 16, 2023

Swift-docc-plugin is failing to generate documentation for a swift package that is using a binaryTarget with a local reference to an XCFramework, which is provided to include a local static binary library (compiled from another language: Rust in this case)

possibly related, depending on the underlying logic used to get the symbol graphs - I found an issue with swift package dump-symbol-graph with the same package + local binary target setup, opened as swiftlang/swift-package-manager#6162. If swift-docc-plugin relies on that functionality, that might be the underlying issue. I wasn't sure however, so I wanted to open this as well.

The command in question:

$(xcrun --find swift) package \
      --allow-writing-to-directory ./docs \
      generate-documentation \
      --fallback-bundle-identifier com.github.y-crdt.Yniffi \
      --fallback-bundle-version 0.16.1 \
      --target Yniffi \
      --output-path ./docs \
      --emit-digest \
      --disable-indexing \
      --transform-for-static-hosting \
      --hosting-base-path 'Yniffi'

Note that manually generating the symbol graphs and then invoking docc directly does work:

rm -rf .build .symbol-graphs
mkdir -p .symbol-graphs

$(xcrun --find swift) build --target Yniffi \
    -Xswiftc -emit-symbol-graph \
    -Xswiftc -emit-symbol-graph-dir -Xswiftc .symbol-graphs

$(xcrun --find docc) convert swift/scaffold/Documentation.docc \
    --fallback-display-name Yniffi \
    --fallback-bundle-identifier com.github.y-crdt.Yniffi \
    --fallback-bundle-version 0.16.1 \
    --additional-symbol-graph-dir .symbol-graphs \
    --emit-digest \
    --transform-for-static-hosting \
    --output-path ./docs \
    --hosting-base-path 'Yniffi'

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue.

Expected behavior

  • Documentation catalog generated with symbols

Actual behavior

  • Documentation catalog is generated, but there are no linked symbols

./docs/linkable-entities.json contains only []
./docs/indexing-records.json contains only []

Steps to Reproduce

Note: full reproduction requires building the XCFramework locally - which currently requires Rust to be installed locally.

  1. git clone https://github.com/heckj/y-uniffi.git
  2. cd y-uniffi
  3. git checkout yrs_16_2
  4. cd lib
  5. ./build-xcframework.sh
  6. swift build # works correctly, no issues
  7. run command to generate empty docs:
$(xcrun --find swift) package \
      --allow-writing-to-directory ./docs \
      generate-documentation \
      --fallback-bundle-identifier com.github.y-crdt.Yniffi \
      --fallback-bundle-version 0.16.1 \
      --target Yniffi \
      --output-path ./docs \
      --emit-digest \
      --disable-indexing \
      --transform-for-static-hosting \
      --hosting-base-path 'Yniffi'

Swift-DocC Plugin Version Information

Swift-DocC plugin version: 1.1.0
Swift Compiler version:

swift-driver version: 1.75.1 Apple Swift version 5.8 (swiftlang-5.8.0.117.11 clang-1403.0.22.8.60)
Target: arm64-apple-macosx13.0

(Issue was also happening identically with swift 5.7 release)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant