xref: /aosp_15_r20/external/bazelbuild-rules_python/sphinxdocs/docs/BUILD.bazel (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1*60517a1eSAndroid Build Coastguard Workerload("//python/private:util.bzl", "IS_BAZEL_7_OR_HIGHER")  # buildifier: disable=bzl-visibility
2*60517a1eSAndroid Build Coastguard Workerload("//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
3*60517a1eSAndroid Build Coastguard Workerload("//sphinxdocs:sphinx_stardoc.bzl", "sphinx_stardocs")
4*60517a1eSAndroid Build Coastguard Worker
5*60517a1eSAndroid Build Coastguard Workerpackage(default_visibility = ["//:__subpackages__"])
6*60517a1eSAndroid Build Coastguard Worker
7*60517a1eSAndroid Build Coastguard Worker# We only build for Linux and Mac because:
8*60517a1eSAndroid Build Coastguard Worker# 1. The actual doc process only runs on Linux
9*60517a1eSAndroid Build Coastguard Worker# 2. Mac is a common development platform, and is close enough to Linux
10*60517a1eSAndroid Build Coastguard Worker#    it's feasible to make work.
11*60517a1eSAndroid Build Coastguard Worker# Making CI happy under Windows is too much of a headache, though, so we don't
12*60517a1eSAndroid Build Coastguard Worker# bother with that.
13*60517a1eSAndroid Build Coastguard Worker_TARGET_COMPATIBLE_WITH = select({
14*60517a1eSAndroid Build Coastguard Worker    "@platforms//os:linux": [],
15*60517a1eSAndroid Build Coastguard Worker    "@platforms//os:macos": [],
16*60517a1eSAndroid Build Coastguard Worker    "//conditions:default": ["@platforms//:incompatible"],
17*60517a1eSAndroid Build Coastguard Worker}) if IS_BAZEL_7_OR_HIGHER else ["@platforms//:incompatible"]
18*60517a1eSAndroid Build Coastguard Worker
19*60517a1eSAndroid Build Coastguard Workersphinx_docs_library(
20*60517a1eSAndroid Build Coastguard Worker    name = "docs_lib",
21*60517a1eSAndroid Build Coastguard Worker    deps = [
22*60517a1eSAndroid Build Coastguard Worker        ":artisian_api_docs",
23*60517a1eSAndroid Build Coastguard Worker        ":bzl_docs",
24*60517a1eSAndroid Build Coastguard Worker        ":py_api_srcs",
25*60517a1eSAndroid Build Coastguard Worker        ":regular_docs",
26*60517a1eSAndroid Build Coastguard Worker    ],
27*60517a1eSAndroid Build Coastguard Worker)
28*60517a1eSAndroid Build Coastguard Worker
29*60517a1eSAndroid Build Coastguard Workersphinx_docs_library(
30*60517a1eSAndroid Build Coastguard Worker    name = "regular_docs",
31*60517a1eSAndroid Build Coastguard Worker    srcs = glob(
32*60517a1eSAndroid Build Coastguard Worker        ["**/*.md"],
33*60517a1eSAndroid Build Coastguard Worker        exclude = ["api/**"],
34*60517a1eSAndroid Build Coastguard Worker    ),
35*60517a1eSAndroid Build Coastguard Worker    prefix = "sphinxdocs/",
36*60517a1eSAndroid Build Coastguard Worker)
37*60517a1eSAndroid Build Coastguard Worker
38*60517a1eSAndroid Build Coastguard Workersphinx_docs_library(
39*60517a1eSAndroid Build Coastguard Worker    name = "artisian_api_docs",
40*60517a1eSAndroid Build Coastguard Worker    srcs = glob(
41*60517a1eSAndroid Build Coastguard Worker        ["api/**/*.md"],
42*60517a1eSAndroid Build Coastguard Worker    ),
43*60517a1eSAndroid Build Coastguard Worker    prefix = "api/sphinxdocs/",
44*60517a1eSAndroid Build Coastguard Worker    strip_prefix = "sphinxdocs/docs/api/",
45*60517a1eSAndroid Build Coastguard Worker)
46*60517a1eSAndroid Build Coastguard Worker
47*60517a1eSAndroid Build Coastguard Workersphinx_stardocs(
48*60517a1eSAndroid Build Coastguard Worker    name = "bzl_docs",
49*60517a1eSAndroid Build Coastguard Worker    srcs = [
50*60517a1eSAndroid Build Coastguard Worker        "//sphinxdocs:readthedocs_bzl",
51*60517a1eSAndroid Build Coastguard Worker        "//sphinxdocs:sphinx_bzl",
52*60517a1eSAndroid Build Coastguard Worker        "//sphinxdocs:sphinx_docs_library_bzl",
53*60517a1eSAndroid Build Coastguard Worker        "//sphinxdocs:sphinx_stardoc_bzl",
54*60517a1eSAndroid Build Coastguard Worker        "//sphinxdocs/private:sphinx_docs_library_bzl",
55*60517a1eSAndroid Build Coastguard Worker    ],
56*60517a1eSAndroid Build Coastguard Worker    prefix = "api/sphinxdocs/",
57*60517a1eSAndroid Build Coastguard Worker    target_compatible_with = _TARGET_COMPATIBLE_WITH,
58*60517a1eSAndroid Build Coastguard Worker)
59*60517a1eSAndroid Build Coastguard Worker
60*60517a1eSAndroid Build Coastguard Workersphinx_docs_library(
61*60517a1eSAndroid Build Coastguard Worker    name = "py_api_srcs",
62*60517a1eSAndroid Build Coastguard Worker    srcs = ["//sphinxdocs/src/sphinx_bzl"],
63*60517a1eSAndroid Build Coastguard Worker    strip_prefix = "sphinxdocs/src/",
64*60517a1eSAndroid Build Coastguard Worker)
65