xref: /aosp_15_r20/external/pigweed/docs/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2024 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load("@pigweed//pw_build:compatibility.bzl", "incompatible_with_mcu")
16load("@rules_python//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs")
17load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
18
19package(default_visibility = ["//visibility:public"])
20
21licenses(["notice"])
22
23exports_files([
24    "module_metadata.json",
25    "module_metadata_schema.json",
26])
27
28sphinx_docs_library(
29    # TODO: https://pwbug.dev/377679855 - Rename this to "docs" after merging.
30    name = "not_prefixed",
31    srcs = [
32        "automated_analysis.rst",
33        "bazel_compatibility.rst",
34        "build_system.rst",
35        "changelog.rst",
36        "index.rst",
37        "layout/layout.html",
38        "module_metadata.json",
39        "module_metadata_schema.json",
40        "modules.rst",
41        "python_build.rst",
42        "targets.rst",
43        "third_party_support.rst",
44    ],
45    strip_prefix = "docs/",
46    target_compatible_with = incompatible_with_mcu(),
47)
48
49# TODO: https://pwbug.dev/377679855 - Merge this into "not_prefixed"
50# (which will be renamed to "docs" after the merge).
51sphinx_docs_library(
52    name = "prefixed",
53    srcs = [
54        "_static/css/pigweed.css",
55        "_static/js/changelog.js",
56        "_static/js/pigweed.js",
57        "_static/pw_logo.ico",
58        "_static/pw_logo.svg",
59        "3p/index.rst",
60        "blog/01-kudzu.rst",
61        "blog/02-bazel-feature-flags.rst",
62        "blog/03-pigweed-sdk.rst",
63        "blog/04-fixed-point.rst",
64        "blog/05-coroutines.rst",
65        "blog/index.rst",
66        "blog/rss.xml",
67        "code_of_conduct.rst",
68        "code_reviews.rst",
69        "community/index.rst",
70        "concepts/index.rst",
71        "contributing/index.rst",
72        "contributing/docs/changelog.rst",
73        "contributing/docs/guides.rst",
74        "contributing/docs/index.rst",
75        "contributing/docs/modules.rst",
76        "embedded_cpp_guide.rst",
77        "facades.rst",
78        "faq.rst",
79        "get_started/bazel_integration.rst",
80        "get_started/bazel.rst",
81        "get_started/first_time_setup.rst",
82        "get_started/github_actions.rst",
83        "get_started/index.rst",
84        "get_started/install_bazel.rst",
85        "get_started/upstream.rst",
86        "get_started/zephyr.rst",
87        "glossary.rst",
88        "infra/ci_cq_intro.rst",
89        "infra/index.rst",
90        "infra/rollers.rst",
91        "mission.rst",
92        "module_structure.rst",
93        "os/index.rst",
94        "os/zephyr/index.rst",
95        # TODO: https://pwbug.dev/377683258 - Enable this file after
96        # https://pwrev.dev/248014 merges.
97        # "os/zephyr/kconfig.rst",
98        "overview.rst",
99        "showcases/sense/index.rst",
100        "showcases/sense/tutorial/automate.rst",
101        "showcases/sense/tutorial/bazel_cloud.rst",
102        "showcases/sense/tutorial/build.rst",
103        "showcases/sense/tutorial/code_intelligence.rst",
104        "showcases/sense/tutorial/crash_handler.rst",
105        "showcases/sense/tutorial/device_tests.rst",
106        "showcases/sense/tutorial/explore.rst",
107        "showcases/sense/tutorial/factory.rst",
108        "showcases/sense/tutorial/flash.rst",
109        "showcases/sense/tutorial/host_sim.rst",
110        "showcases/sense/tutorial/host_tests.rst",
111        "showcases/sense/tutorial/index.rst",
112        "showcases/sense/tutorial/outro.rst",
113        "showcases/sense/tutorial/production.rst",
114        "showcases/sense/tutorial/rpc.rst",
115        "showcases/sense/tutorial/setup.rst",
116        "showcases/sense/tutorial/web.rst",
117        "size_optimizations.rst",
118        "style/cli.rst",
119        "style/commit_message.rst",
120        "style/cpp.rst",
121        "style/doxygen.rst",
122        "style/protobuf.rst",
123        "style/rest.rst",
124        "style/writing.rst",
125        "style_guide.rst",
126    ],
127    # TODO: https://pwbug.dev/377679855 - Remove this URL prefix.
128    prefix = "docs/",
129    target_compatible_with = incompatible_with_mcu(),
130)
131
132sphinx_docs(
133    name = "docs",
134    config = "conf.py",
135    formats = [
136        "html",
137    ],
138    sphinx = ":sphinx-build",
139    strip_prefix = "docs/",
140    target_compatible_with = incompatible_with_mcu(),
141    deps = [
142        ":not_prefixed",
143        ":prefixed",
144        "//pw_async2:docs",
145        "//pw_boot:docs",
146        "//seed:docs",
147        "//targets:docs",
148    ],
149)
150
151sphinx_build_binary(
152    name = "sphinx-build",
153    target_compatible_with = incompatible_with_mcu(),
154    deps = [
155        "//pw_console/py:pw_console",
156        "//pw_docgen/py:pw_docgen",
157        "@python_packages//breathe",
158        "@python_packages//pydata_sphinx_theme",
159        "@python_packages//sphinx",
160        "@python_packages//sphinx_argparse",
161        "@python_packages//sphinx_copybutton",
162        "@python_packages//sphinx_design",
163        "@python_packages//sphinx_reredirects",
164        "@python_packages//sphinx_sitemap",
165        "@python_packages//sphinxcontrib_mermaid",
166    ],
167)
168
169filegroup(
170    name = "doxygen",
171    srcs = [
172        "//pw_alignment:doxygen",
173        "//pw_allocator:doxygen",
174        "//pw_analog:doxygen",
175        "//pw_async:doxygen",
176        "//pw_async2:doxygen",
177        "//pw_async2_basic:doxygen",
178        "//pw_async_basic:doxygen",
179        "//pw_base64:doxygen",
180        "//pw_bluetooth:doxygen",
181        "//pw_bluetooth_proxy:doxygen",
182        "//pw_build:doxygen",
183        "//pw_bytes:doxygen",
184        "//pw_channel:doxygen",
185        "//pw_chre:doxygen",
186        "//pw_chrono:doxygen",
187        "//pw_clock_tree:doxygen",
188        "//pw_clock_tree_mcuxpresso:doxygen",
189        "//pw_containers:doxygen",
190        "//pw_crypto:doxygen",
191        "//pw_digital_io:doxygen",
192        "//pw_display:doxygen",
193        "//pw_elf:doxygen",
194        "//pw_function:doxygen",
195        "//pw_hdlc:doxygen",
196        "//pw_hex_dump:doxygen",
197        "//pw_i2c:doxygen",
198        "//pw_i2c_linux:doxygen",
199        "//pw_interrupt:doxygen",
200        "//pw_json:doxygen",
201        "//pw_kvs:doxygen",
202        "//pw_log:doxygen",
203        "//pw_log_string:doxygen",
204        "//pw_log_tokenized:doxygen",
205        "//pw_malloc:doxygen",
206        "//pw_multibuf:doxygen",
207        "//pw_numeric:doxygen",
208        "//pw_perf_test:doxygen",
209        "//pw_polyfill:doxygen",
210        "//pw_preprocessor:doxygen",
211        "//pw_protobuf:doxygen",
212        "//pw_random:doxygen",
213        "//pw_rpc:doxygen",
214        "//pw_span:doxygen",
215        "//pw_spi:doxygen",
216        "//pw_status:doxygen",
217        "//pw_stream:doxygen",
218        "//pw_stream_uart_linux:doxygen",
219        "//pw_string:doxygen",
220        "//pw_sync:doxygen",
221        "//pw_sys_io:doxygen",
222        "//pw_system:doxygen",
223        "//pw_thread:doxygen",
224        "//pw_tokenizer:doxygen",
225        "//pw_toolchain:doxygen",
226        "//pw_transfer:doxygen",
227        "//pw_uart:doxygen",
228        "//pw_unit_test:doxygen",
229        "//pw_varint:doxygen",
230        "//pw_work_queue:doxygen",
231    ],
232)
233