-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathbuild-docs
executable file
·40 lines (33 loc) · 1.2 KB
/
build-docs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
#
# 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
set -o errexit
SCRIPT_DIR=$(dirname "$0")
ROOT_DIR=$(dirname $SCRIPT_DIR)
TMP_DIR="$ROOT_DIR/tmp"
OUTPUT_DIR="$ROOT_DIR/docs"
SGF="$TMP_DIR/SwiftDocCRender.symbols.json"
CATALOG="$ROOT_DIR/SwiftDocCRender.docc"
echo "Building docs for $CATALOG"
# Generate a symbol graph for the app as JSON and store it in a tmp directory
rm -rf $SGF
mkdir -p $TMP_DIR
$SCRIPT_DIR/generate-symbol-graph > $SGF
echo "Generated symbol graph: $SGF"
# Build the doc catalog for the app with the symbol graph using DocC and store
# the static output in a docs directory
rm -rf $OUTPUT_DIR
mkdir -p $OUTPUT_DIR
$SCRIPT_DIR/rundocc convert $CATALOG \
--fallback-display-name SwiftDocCRender \
--fallback-bundle-identifier org.swift.SwiftDocCRender \
--fallback-bundle-version 1.0.0 \
--additional-symbol-graph-dir $TMP_DIR \
--output-path $OUTPUT_DIR
echo "Generated docs at $OUTPUT_DIR"