Skip to content

Commit

Permalink
Remove custom documentation generate script
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Sep 25, 2023
1 parent 1d5aba8 commit 70fceee
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# See https://swift.org/CONTRIBUTORS.txt for Swift project authors

.DS_Store
/.build
.build
/Packages
/*.xcodeproj
xcuserdata/
Expand Down
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"
)
]
)
38 changes: 8 additions & 30 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 All @@ -87,4 +65,4 @@ fi

# Delete the git worktree we created
cd ..
git worktree remove gh-pages
git worktree remove gh-pages

0 comments on commit 70fceee

Please sign in to comment.