Skip to content

Commit 2395da9

Browse files
authored
Build executorch Sphinx docs internally and link to static docs
Differential Revision: D58986545 Pull Request resolved: #7481
1 parent 443ba3b commit 2395da9

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

docs/TARGETS

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
load("@fbcode_macros//build_defs:native_rules.bzl", "buck_filegroup", "buck_sh_test")
2+
load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary")
3+
4+
oncall("pytorch_r2p")
5+
6+
python_binary(
7+
name = "sphinx",
8+
main_module = "sphinx.cmd.build",
9+
par_style = "xar",
10+
deps = [
11+
"//caffe2:torch",
12+
"//executorch/exir:lib",
13+
"//executorch/devtools:lib",
14+
"//executorch/exir/backend/test:backend_with_compiler_demo",
15+
"//executorch/exir/backend/test:op_partitioner_demo",
16+
"//executorch/devtools/bundled_program/serialize:lib",
17+
"fbsource//third-party/pypi/ipykernel:ipykernel",
18+
"fbsource//third-party/pypi/jupyter-client:jupyter-client",
19+
"fbsource//third-party/pypi/jupytext:jupytext",
20+
"fbsource//third-party/pypi/nbsphinx:nbsphinx",
21+
"fbsource//third-party/pypi/pytorch-sphinx-theme:pytorch-sphinx-theme",
22+
"fbsource//third-party/pypi/sphinx:sphinx",
23+
"fbsource//third-party/pypi/breathe:breathe",
24+
"fbsource//third-party/pypi/sphinx-copybutton:sphinx-copybutton",
25+
"fbsource//third-party/pypi/sphinx-design:sphinx-design",
26+
"fbsource//third-party/pypi/sphinx-gallery:sphinx-gallery",
27+
"fbsource//third-party/pypi/matplotlib:matplotlib",
28+
"fbsource//third-party/pypi/myst-parser:myst-parser",
29+
],
30+
)
31+
32+
buck_filegroup(
33+
name = "source",
34+
srcs = glob(["source/**/*"]),
35+
)
36+
37+
buck_sh_test(
38+
name = "doctest",
39+
args = [
40+
"-M",
41+
"doctest",
42+
"$(location :source)/source/",
43+
"/tmp/sphinxbuild",
44+
],
45+
test = ":sphinx",
46+
)

docs/source/conf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
import os
4545
import sys
4646

47+
FBCODE = "fbcode" in os.getcwd()
48+
4749
extensions = [
4850
"breathe",
4951
"sphinx.ext.autodoc",
@@ -60,9 +62,13 @@
6062
"myst_parser",
6163
"sphinx_design",
6264
"sphinx_gallery.gen_gallery",
63-
"executorch_custom_versions",
6465
]
6566

67+
if not FBCODE:
68+
extensions += [
69+
"executorch_custom_versions",
70+
]
71+
6672
this_file_dir = os.path.abspath(os.path.dirname(__file__))
6773
doxygen_xml_dir = os.path.join(
6874
os.path.dirname(this_file_dir), # {repo_root}/docs/

0 commit comments

Comments
 (0)