skiptools / skiptools/skip

DocC support for transpiled libraries

Open
#580 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
3.2k
Forks
106
Avg merge
6d 13h
Merged PRs (30d)
1

Description

It occurred to me that it'd be nifty to generate DocC documentation for https://github.com/skiptools/skip-applovin but it did not work very well.

First, I tried the https://github.com/swiftlang/swift-docc-plugin which allows you to run swift package generate-documentation. The problem is, swift assumes you're building for macOS; as far as I know, there's no way to pass in a -destination like you can for xcodebuild.

The entire library is either wrapped in #if SKIP or wrapped in #if canImport(AppLovinSDK), and AppLovinSDK can't be imported on macOS; its binary blob is only available for iOS. So swift build has nothing to do, and swift package generate-documentation generates an empty doccarchive with no documentation!

So, then I opened the package in Xcode and used Product --> Build Documentation. That created an xcworkspace in .swiftpm/xcode/package.xcworkspace, so I could generate the same documentation from the command line with xcodebuild -workspace .swiftpm/xcode/package.xcworkspace -scheme "skip-applovin" docbuild -destination 'generic/platform=iOS' -derivedDataPath /tmp/docbuild.

That was better, but still not great, because it didn't document anything in #if SKIP blocks… it only documented native iOS code, i.e. just SkipAppLovin, SkipAppLovinAdView, and SkipAppLovinFlexibleBannerAdView.

There was no documentation for any of the models or protocols, because those are transpiled Android-only reimplementations of the AppLovinSDK API. (It's particularly galling that AppLovinSDK has no DocC documentation for its own headers.)

It would be nifty if Skip could generate some kinda docc output of its own, something that I could pass to xcrun docc to get the entire API.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the swift-docc-plugin workflow with the xcodebuild docbuild command described in the issue, including the iOS destination and the .swiftpm/xcode/package.xcworkspace. Investigate how Skip's #if SKIP code and transpiled models and protocols are excluded. Done means Skip can produce docc output covering the complete API for consumption by xcrun docc.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.