realm / jazzy

Soulful docs for Swift & Objective-C
https://realm.io
MIT License
7.35k stars 413 forks source link

How to include files in my dependent frameworks. #1276

Closed onato closed 3 years ago

onato commented 3 years ago

I have my modules organized in frameworks that are linked into the App Target, similar to this example project.

DemoAppWithFramework.zip

Screen Shot 2021-09-16 at 10 37 28 AM

When I run…

❯ jazzy --version
jazzy version: 0.14.0

❯ jazzy --min-acl private
Running xcodebuild
Checking xcodebuild -showBuildSettings
Assuming New Build System is used.
Parsing AppDelegate.swift (1/3)
Parsing SceneDelegate.swift (2/3)
Parsing ViewController.swift (3/3)
0% documentation coverage with 14 undocumented symbols
included 14 private, fileprivate, internal, public, or open symbols
building site
building search index
jam out ♪♫ to your fresh new docs in `docs`

I get documentation generated for the files in the main App target, but not for those in the framework.

Screen Shot 2021-09-16 at 10 27 00 AM

I expected jazzy to generate docs for files in the app target's dependencies as well.

Do I need to generate the docs for frameworks in a separate step using https://github.com/realm/jazzy#docs-from-swiftmodules-or-frameworks or is there something else I am missing?

johnfairh commented 3 years ago

Running jazzy this way generates documentation for one module - see Usage in the readme for tips on how to pick the right module.

If you want to try putting multiple modules into the same docset then see #1194, #564 for the workaround -- things should mostly work as long as your structure is not too complex and there are no name clashes.

onato commented 3 years ago

Worked like a charm.

#!/bin/sh
set -euo pipefail
IFS=$'\n\t'

modules=(
    "App"
    "Authentication"
    "Utils"
  )

cleanup() {
    for module in ${modules[@]}; do
        rm "$module.json" || true
    done
}
trap cleanup 0

FILENAMES=""
for module in ${modules[@]}; do
    filename="$module.json"
    if [ ! -f $filename ]; then
        echo "Processing $module"
        sourcekitten doc -- -workspace MyApp.xcworkspace -scheme "$module" > "$filename"
    fi
    FILENAMES="$FILENAMES,$filename"
done

jazzy \
  --clean \
  --author Acme \
  --author_url https://example.com \
  --source-host github \
  --source-host-url https://github.com/example/my-app \
  --build-tool-arguments -scheme,MyApp \
  --root-url https://github.com/example/my-app/ \
  --output docs/reference \
  --min-acl private \
  --sourcekitten-sourcefile "${FILENAMES:1}"