13
13
import sys
14
14
import requests
15
15
import json
16
+ import time
16
17
17
18
# Automatically watch the following extra directories when --serve is used.
18
19
EXTRA_WATCH_DIRS = ["exts" , "themes" ]
19
20
20
21
SPEC_CHECKSUM_URL = "https://spec.ferrocene.dev/paragraph-ids.json"
21
22
SPEC_LOCKFILE = "spec.lock"
22
23
23
- def build_docs (root , builder , clear , serve , debug , offline , spec_lock_consistency_check ):
24
+ def build_docs (
25
+ root : Path ,
26
+ builder : str ,
27
+ clear : bool ,
28
+ serve : bool ,
29
+ debug : bool ,
30
+ offline : bool ,
31
+ spec_lock_consistency_check : bool
32
+ ) -> Path :
33
+ """
34
+ Builds the Sphinx documentation with the specified options.
35
+
36
+ Args:
37
+ root: The root directory of the documentation.
38
+ builder: The builder to use (e.g., 'html', 'xml').
39
+ clear: Whether to disable incremental builds.
40
+ serve: Whether to start a local server with live reload.
41
+ debug: Whether to enable debug mode.
42
+ offline: Whether to build in offline mode.
43
+ spec_lock_consistency_check: Whether to check spec lock consistency.
44
+
45
+ Returns:
46
+ Path: The path to the generated documentation.
47
+ """
48
+
24
49
dest = root / "build"
25
50
26
51
args = ["-b" , builder , "-d" , dest / "doctrees" ]
@@ -61,6 +86,9 @@ def build_docs(root, builder, clear, serve, debug, offline, spec_lock_consistenc
61
86
args += ["-W" , "--keep-going" ]
62
87
63
88
try :
89
+
90
+ # Tracking build time
91
+ timer_start = time .perf_counter ()
64
92
subprocess .run (
65
93
[
66
94
"sphinx-autobuild" if serve else "sphinx-build" ,
@@ -76,6 +104,8 @@ def build_docs(root, builder, clear, serve, debug, offline, spec_lock_consistenc
76
104
print ("\n hint: if you see an exception, pass --debug to see the full traceback" )
77
105
exit (1 )
78
106
107
+ timer_end = time .perf_counter ()
108
+ print (f"\n Build finished in { timer_end - timer_start :.2f} seconds." )
79
109
return dest / builder
80
110
81
111
def update_spec_lockfile (spec_checksum_location , lockfile_location ):
0 commit comments