Skip to content

Commit 2dc3995

Browse files
add preview-stdlib-docs command to spin up DocC's preview server
1 parent b83c91a commit 2dc3995

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ def _apply_default_arguments(args):
6060
if args.build_linux_static and args.build_libcxx is None:
6161
args.build_libcxx = True
6262

63+
# Previewing the stdlib docs requires building them.
64+
if args.preview_stdlib_docs:
65+
args.build_stdlib_docs = True
66+
6367
# Set the default CMake generator.
6468
if args.cmake_generator is None:
6569
args.cmake_generator = 'Ninja'
@@ -1163,7 +1167,11 @@ def create_argument_parser():
11631167
option('--build-stdlib-docs', toggle_true,
11641168
default=False,
11651169
help='Build documentation for the standard library.'
1166-
'Note: this builds SwiftDocC to perform the docs build.')
1170+
'Note: this builds Swift-DocC to perform the docs build.')
1171+
option('--preview-stdlib-docs', toggle_true,
1172+
default=False,
1173+
help='Build and preview standard library documentation with Swift-DocC.'
1174+
'Note: this builds Swift-DocC to perform the docs build.')
11671175

11681176
option('--build-swift-clang-overlays', toggle_true,
11691177
default=True,

utils/swift_build_support/swift_build_support/products/stdlib_docs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ def build(self, host_target):
4545
symbol_graph_dir = os.path.join(swift_build_dir, "lib", "symbol-graph")
4646
output_path = os.path.join(swift_build_dir, "Swift.doccarchive")
4747

48+
docc_action = 'preview' if self.args.preview_stdlib_docs else 'convert'
49+
4850
docc_cmd = [
4951
docc_path,
50-
"convert", # TODO: give people the option to preview instead
52+
docc_action,
5153
"--additional-symbol-graph-dir",
5254
symbol_graph_dir,
5355
"--output-path",

0 commit comments

Comments
 (0)