• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2022 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("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
16load("@rules_rust//rust:defs.bzl", "rust_docs")
17load("//pw_build:compatibility.bzl", "incompatible_with_mcu")
18
19rust_docs(
20    name = "docs",
21
22    # These need to be kept in dependency order for inter-crate linking to
23    # work.
24    #
25    # TODO: b/295227522 - Add support to `rust_docs` to automatically processs
26    # crates in topological order.
27    crates = [
28        "//pw_bytes/rust:pw_bytes",
29        "//pw_format/rust:pw_format_core",
30        "//pw_format/rust:pw_format",
31        "//pw_status/rust:pw_status",
32        "//pw_stream/rust:pw_stream",
33        "//pw_varint/rust:pw_varint",
34        "//pw_tokenizer/rust:pw_tokenizer_core",
35        "//pw_tokenizer/rust:pw_tokenizer",
36        "//pw_log/rust:pw_log_backend_println",
37        "//pw_log/rust:pw_log_backend_printf_docs",
38        "//pw_log/rust:pw_log_backend_api",
39        "//pw_log/rust:pw_log",
40        "//pw_base64/rust:pw_base64",
41    ],
42    rustdoc_flags = [
43        "-Z",
44        "unstable-options",
45        "--enable-index-page",
46    ],
47    target_compatible_with = incompatible_with_mcu(),
48)
49
50# Intermediary target that enables us to provide rustdoc files
51# as an input to rules_python/sphinx_docs_library.
52filegroup(
53    name = "docs_dir",
54    srcs = [":docs"],
55    output_group = "rustdoc_dir",
56    target_compatible_with = incompatible_with_mcu(),
57    visibility = ["//visibility:public"],
58)
59
60sphinx_docs_library(
61    name = "sphinx",
62    srcs = [
63        "docs.rst",
64    ],
65    prefix = "pw_rust/",
66    target_compatible_with = incompatible_with_mcu(),
67    visibility = ["//visibility:public"],
68)
69