From 905af697d68e4a87d037a721b385f4d26f8ba848 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Thu, 15 Aug 2024 02:14:12 -0700 Subject: [PATCH] docs: move Sphinx object inventory for Bazel under sphinxdocs (#2117) This moves the inventory file for Bazel objects under the sphinxdocs directory. Inventory files are the manifest of things that can be cross referenced from some external source. They're moved under sphinxdocs since these are about Bazel in general and aren't specific to rules_python. --- docs/sphinx/BUILD.bazel | 10 ++------- sphinxdocs/inventories/BUILD.bazel | 22 +++++++++++++++++++ .../inventories}/bazel_inventory.txt | 2 +- sphinxdocs/tests/sphinx_stardoc/BUILD.bazel | 2 +- 4 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 sphinxdocs/inventories/BUILD.bazel rename {docs/sphinx => sphinxdocs/inventories}/bazel_inventory.txt (97%) diff --git a/docs/sphinx/BUILD.bazel b/docs/sphinx/BUILD.bazel index fe0da1f3bd..b582606ab6 100644 --- a/docs/sphinx/BUILD.bazel +++ b/docs/sphinx/BUILD.bazel @@ -17,7 +17,7 @@ load("//python:pip.bzl", "compile_pip_requirements") load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility load("//python/private:util.bzl", "IS_BAZEL_7_OR_HIGHER") # buildifier: disable=bzl-visibility load("//sphinxdocs:readthedocs.bzl", "readthedocs_install") -load("//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs", "sphinx_inventory") +load("//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs") load("//sphinxdocs:sphinx_stardoc.bzl", "sphinx_stardocs") # We only build for Linux and Mac because: @@ -38,7 +38,6 @@ _TARGET_COMPATIBLE_WITH = select({ sphinx_docs( name = "docs", srcs = [ - ":bazel_inventory", ":bzl_api_docs", ] + glob( include = [ @@ -60,6 +59,7 @@ sphinx_docs( renamed_srcs = { "//:CHANGELOG.md": "changelog.md", "//:CONTRIBUTING.md": "contributing.md", + "//sphinxdocs/inventories:bazel_inventory": "bazel_inventory.inv", }, sphinx = ":sphinx-build", strip_prefix = package_name() + "/", @@ -67,12 +67,6 @@ sphinx_docs( target_compatible_with = _TARGET_COMPATIBLE_WITH, ) -sphinx_inventory( - name = "bazel_inventory", - src = "bazel_inventory.txt", - visibility = ["//:__subpackages__"], -) - sphinx_stardocs( name = "bzl_api_docs", docs = { diff --git a/sphinxdocs/inventories/BUILD.bazel b/sphinxdocs/inventories/BUILD.bazel new file mode 100644 index 0000000000..9ed7698cdf --- /dev/null +++ b/sphinxdocs/inventories/BUILD.bazel @@ -0,0 +1,22 @@ +# Copyright 2024 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("//sphinxdocs:sphinx.bzl", "sphinx_inventory") + +# Inventory for the current Bazel version +sphinx_inventory( + name = "bazel_inventory", + src = "bazel_inventory.txt", + visibility = ["//visibility:public"], +) diff --git a/docs/sphinx/bazel_inventory.txt b/sphinxdocs/inventories/bazel_inventory.txt similarity index 97% rename from docs/sphinx/bazel_inventory.txt rename to sphinxdocs/inventories/bazel_inventory.txt index c4aaabc074..a7f0222324 100644 --- a/docs/sphinx/bazel_inventory.txt +++ b/sphinxdocs/inventories/bazel_inventory.txt @@ -10,7 +10,7 @@ bool bzl:type 1 rules/lib/bool - int bzl:type 1 rules/lib/int - depset bzl:type 1 rules/lib/depset - dict bzl:type 1 rules/lib/dict - -label bzl:type 1 concepts/labels - +label bzl:doc 1 concepts/labels - attr.bool bzl:type 1 rules/lib/toplevel/attr#bool - attr.int bzl:type 1 rules/lib/toplevel/attr#int - attr.label bzl:type 1 rules/lib/toplevel/attr#label - diff --git a/sphinxdocs/tests/sphinx_stardoc/BUILD.bazel b/sphinxdocs/tests/sphinx_stardoc/BUILD.bazel index b03561b9ba..b141e5f0fc 100644 --- a/sphinxdocs/tests/sphinx_stardoc/BUILD.bazel +++ b/sphinxdocs/tests/sphinx_stardoc/BUILD.bazel @@ -15,7 +15,7 @@ sphinx_docs( "html", ], renamed_srcs = { - "//docs/sphinx:bazel_inventory": "bazel_inventory.inv", + "//sphinxdocs/inventories:bazel_inventory": "bazel_inventory.inv", }, sphinx = ":sphinx-build", strip_prefix = package_name() + "/",