22#
33# This source file is part of the Swift.org open source project
44#
5- # Copyright (c) 2022 Apple Inc. and the Swift project authors
5+ # Copyright (c) 2022-2023 Apple Inc. and the Swift project authors
66# Licensed under Apache License v2.0 with Runtime Library Exception
77#
88# See https://swift.org/LICENSE.txt for license information
@@ -24,33 +24,10 @@ filepath() {
2424}
2525
2626SWIFT_DOCC_SYMBOLKIT_ROOT=" $( dirname $( dirname $( filepath $0 ) ) ) "
27- SYMBOL_GRAPH_OUTPUT_DIR=" $SWIFT_DOCC_SYMBOLKIT_ROOT /.build/swift-docc/symbol-graphs"
28-
29- mkdir -p " $SYMBOL_GRAPH_OUTPUT_DIR "
30- rm -f " $SYMBOL_GRAPH_OUTPUT_DIR /*.*"
3127
3228# Set current directory to the repository root
3329cd " $SWIFT_DOCC_SYMBOLKIT_ROOT "
3430
35- # On non-Darwin systems we expect the 'docc' command-line tool to be in the current path.
36- # On Darwin, we expect 'docc' to be available via Xcode's 'xcrun'.
37- DOCC_CMD=" "
38- if command -v xcrun & > /dev/null
39- then
40- DOCC_CMD=" xcrun docc"
41- elif command -v docc & > /dev/null
42- then
43- DOCC_CMD=" docc"
44- else
45- echo " Failed to find 'docc' or 'xcrun' in the current path."
46- exit 1
47- fi
48-
49- # Generate symbol graph files for SymbolKit
50- swift build --target SymbolKit \
51- -Xswiftc -emit-symbol-graph \
52- -Xswiftc -emit-symbol-graph-dir -Xswiftc " $SYMBOL_GRAPH_OUTPUT_DIR "
53-
5431# Use git worktree to checkout the gh-pages branch of this repository in a gh-pages sub-directory
5532git fetch
5633git worktree add --checkout gh-pages origin/gh-pages
@@ -60,13 +37,14 @@ export DOCC_JSON_PRETTYPRINT="YES"
6037
6138# Generate documentation for the 'SymbolKit' target and output it
6239# to the /docs subdirectory in the gh-pages worktree directory.
63- $DOCC_CMD convert " $SWIFT_DOCC_SYMBOLKIT_ROOT /Sources/SymbolKit/SymbolKit.docc" \
64- --fallback-display-name SymbolKit \
65- --fallback-bundle-identifier org.swift.SymbolKit \
66- --fallback-bundle-version 1.0.0 \
40+ swift package \
41+ --package-path Documentation \
42+ --allow-writing-to-directory " $SWIFT_DOCC_SYMBOLKIT_ROOT /gh-pages/docs" \
43+ generate-documentation \
44+ --target SymbolKit \
45+ --disable-indexing \
6746 --transform-for-static-hosting \
6847 --hosting-base-path swift-docc-symbolkit \
69- --additional-symbol-graph-dir " $SYMBOL_GRAPH_OUTPUT_DIR " \
7048 --output-path " $SWIFT_DOCC_SYMBOLKIT_ROOT /gh-pages/docs"
7149
7250# Save the current commit we've just built documentation from in a variable
8765
8866# Delete the git worktree we created
8967cd ..
90- git worktree remove gh-pages
68+ git worktree remove gh-pages
0 commit comments