Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added Documentation/Empty/Empty.swift
Empty file.
27 changes: 27 additions & 0 deletions Documentation/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// swift-tools-version:5.6
/*
This source file is part of the Swift.org open source project
Copyright (c) 2023 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license information
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
*/

import PackageDescription

let package = Package(
name: "Documentation",
dependencies: [
.package(name: "SymbolKit", path: "../."),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
],
targets: [
.target(
name: "Empty",
dependencies: [
.product(name: "SymbolKit", package: "SymbolKit"),
],
path: "Empty"
)
]
)
36 changes: 7 additions & 29 deletions bin/update-gh-pages-documentation-site
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2022 Apple Inc. and the Swift project authors
# Copyright (c) 2022-2023 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
Expand All @@ -24,33 +24,10 @@ filepath() {
}

SWIFT_DOCC_SYMBOLKIT_ROOT="$(dirname $(dirname $(filepath $0)))"
SYMBOL_GRAPH_OUTPUT_DIR="$SWIFT_DOCC_SYMBOLKIT_ROOT/.build/swift-docc/symbol-graphs"

mkdir -p "$SYMBOL_GRAPH_OUTPUT_DIR"
rm -f "$SYMBOL_GRAPH_OUTPUT_DIR/*.*"

# Set current directory to the repository root
cd "$SWIFT_DOCC_SYMBOLKIT_ROOT"

# On non-Darwin systems we expect the 'docc' command-line tool to be in the current path.
# On Darwin, we expect 'docc' to be available via Xcode's 'xcrun'.
DOCC_CMD=""
if command -v xcrun &> /dev/null
then
DOCC_CMD="xcrun docc"
elif command -v docc &> /dev/null
then
DOCC_CMD="docc"
else
echo "Failed to find 'docc' or 'xcrun' in the current path."
exit 1
fi

# Generate symbol graph files for SymbolKit
swift build --target SymbolKit \
-Xswiftc -emit-symbol-graph \
-Xswiftc -emit-symbol-graph-dir -Xswiftc "$SYMBOL_GRAPH_OUTPUT_DIR"

# Use git worktree to checkout the gh-pages branch of this repository in a gh-pages sub-directory
git fetch
git worktree add --checkout gh-pages origin/gh-pages
Expand All @@ -60,13 +37,14 @@ export DOCC_JSON_PRETTYPRINT="YES"

# Generate documentation for the 'SymbolKit' target and output it
# to the /docs subdirectory in the gh-pages worktree directory.
$DOCC_CMD convert "$SWIFT_DOCC_SYMBOLKIT_ROOT/Sources/SymbolKit/SymbolKit.docc" \
--fallback-display-name SymbolKit \
--fallback-bundle-identifier org.swift.SymbolKit \
--fallback-bundle-version 1.0.0 \
swift package \
--package-path Documentation \
--allow-writing-to-directory "$SWIFT_DOCC_SYMBOLKIT_ROOT/gh-pages/docs" \
generate-documentation \
--target SymbolKit \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path swift-docc-symbolkit \
--additional-symbol-graph-dir "$SYMBOL_GRAPH_OUTPUT_DIR" \
--output-path "$SWIFT_DOCC_SYMBOLKIT_ROOT/gh-pages/docs"

# Save the current commit we've just built documentation from in a variable
Expand Down