diff --git a/.bazelignore b/.bazelignore index 0384d0746e..89e06444a4 100644 --- a/.bazelignore +++ b/.bazelignore @@ -29,6 +29,7 @@ gazelle/examples/bzlmod_build_file_generation/bazel-bin gazelle/examples/bzlmod_build_file_generation/bazel-bzlmod_build_file_generation gazelle/examples/bzlmod_build_file_generation/bazel-out gazelle/examples/bzlmod_build_file_generation/bazel-testlog +sphinxdocs tests/integration/compile_pip_requirements/bazel-compile_pip_requirements tests/integration/local_toolchains/bazel-local_toolchains tests/integration/py_cc_toolchain_registered/bazel-py_cc_toolchain_registered diff --git a/.bcr/config.yml b/.bcr/config.yml index f103e35bf7..038761b6df 100644 --- a/.bcr/config.yml +++ b/.bcr/config.yml @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -moduleRoots: [".", "gazelle"] +moduleRoots: [".", "gazelle", "sphinxdocs"] diff --git a/.bcr/sphinxdocs/metadata.template.json b/.bcr/sphinxdocs/metadata.template.json new file mode 100644 index 0000000000..017f9d3774 --- /dev/null +++ b/.bcr/sphinxdocs/metadata.template.json @@ -0,0 +1,21 @@ +{ + "homepage": "https://github.com/bazel-contrib/rules_python", + "maintainers": [ + { + "name": "Richard Levasseur", + "email": "richardlev@gmail.com", + "github": "rickeylev" + }, + { + "name": "Ignas Anikevicius", + "email": "bcr-ignas@use.startmail.com", + "github": "aignas" + } + ], + "repository": [ + "github:bazelbuild/rules_python", + "github:bazel-contrib/rules_python" + ], + "versions": [], + "yanked_versions": {} +} diff --git a/.bcr/sphinxdocs/presubmit.yml b/.bcr/sphinxdocs/presubmit.yml new file mode 100644 index 0000000000..542f65a142 --- /dev/null +++ b/.bcr/sphinxdocs/presubmit.yml @@ -0,0 +1,37 @@ +# Copyright 2023 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. + +bcr_test_module: + module_path: "integration_tests/bcr" + matrix: + platform: ["debian11", "macos", "ubuntu2204"] + bazel: [7.*, 8.*, 9.*] + tasks: + run_tests: + name: "Run test module" + platform: ${{ platform }} + bazel: ${{ bazel }} + shell_commands: + - "echo 'common --override_module=rules_python=' >> .bazelrc" + batch_commands: + - "echo common --override_module=rules_python= >> .bazelrc" + test_flags: + # Minimum bazel supported C++ + - "--keep_going" + - '--cxxopt=-std=c++17' + - '--host_cxxopt=-std=c++17' + build_targets: + - "//..." + test_targets: + - "//..." diff --git a/.bcr/sphinxdocs/source.template.json b/.bcr/sphinxdocs/source.template.json new file mode 100644 index 0000000000..b2a2d1ef23 --- /dev/null +++ b/.bcr/sphinxdocs/source.template.json @@ -0,0 +1,5 @@ +{ + "integrity": "", + "strip_prefix": "{REPO}-{VERSION}/sphinxdocs", + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_python-{TAG}.tar.gz" +} diff --git a/MODULE.bazel b/MODULE.bazel index 157258a1ba..cb90b43f72 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -211,10 +211,13 @@ pip.parse( ) use_repo(pip, "rules_python_publish_deps") -# Not a dev dependency to allow usage of //sphinxdocs code, which refers to stardoc repos. -bazel_dep(name = "stardoc", version = "0.7.2", repo_name = "io_bazel_stardoc") - # ===== DEV ONLY DEPS AND SETUP BELOW HERE ===== +bazel_dep(name = "sphinxdocs", version = "0.0.0", dev_dependency = True) +local_path_override( + module_name = "sphinxdocs", + path = "sphinxdocs", +) + bazel_dep(name = "rules_bazel_integration_test", version = "0.27.0", dev_dependency = True) bazel_dep(name = "rules_testing", version = "0.6.0", dev_dependency = True) bazel_dep(name = "rules_shell", version = "0.3.0", dev_dependency = True) diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 656c06b6e1..1c31a47d56 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -14,13 +14,13 @@ load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@dev_pip//:requirements.bzl", "requirement") +load("@sphinxdocs//sphinxdocs:readthedocs.bzl", "readthedocs_install") +load("@sphinxdocs//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs") +load("@sphinxdocs//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") +load("@sphinxdocs//sphinxdocs:sphinx_stardoc.bzl", "sphinx_stardoc", "sphinx_stardocs") load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility load("//python/private:common_labels.bzl", "labels") # buildifier: disable=bzl-visibility load("//python/uv:lock.bzl", "lock") # buildifier: disable=bzl-visibility -load("//sphinxdocs:readthedocs.bzl", "readthedocs_install") -load("//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs") -load("//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") -load("//sphinxdocs:sphinx_stardoc.bzl", "sphinx_stardoc", "sphinx_stardocs") package(default_visibility = ["//:__subpackages__"]) @@ -63,7 +63,7 @@ sphinx_docs( renamed_srcs = { "//:CHANGELOG.md": "changelog.md", "//:CONTRIBUTING.md": "contributing.md", - "//sphinxdocs/inventories:bazel_inventory": "bazel_inventory.inv", + "@sphinxdocs//sphinxdocs/inventories:bazel_inventory": "bazel_inventory.inv", }, sphinx = ":sphinx-build", strip_prefix = package_name() + "/", @@ -73,7 +73,7 @@ sphinx_docs( ":bzl_api_docs", ":py_api_srcs", ":py_runtime_pair", - "//sphinxdocs/docs:docs_lib", + "@sphinxdocs//sphinxdocs/docs:docs_lib", ], ) @@ -182,7 +182,7 @@ sphinx_build_binary( requirement("typing_extensions"), requirement("sphinx_autodoc2"), requirement("sphinx_reredirects"), - "//sphinxdocs/src/sphinx_bzl", + "@sphinxdocs//sphinxdocs/src/sphinx_bzl", ], ) diff --git a/docs/conf.py b/docs/conf.py index 6a7cfe178f..541d99ef7a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -7,7 +7,7 @@ copyright = "2023, The Bazel Authors" author = "Bazel" -# NOTE: These are overriden by -D flags via --//sphinxdocs:extra_defines +# NOTE: These are overriden by -D flags via --@sphinxdocs//sphinxdocs:extra_defines version = "0.0.0" release = version @@ -139,7 +139,10 @@ # --- Extlinks configuration extlinks = { - "gh-issue": (f"https://github.com/bazel-contrib/rules_python/issues/%s", "#%s issue"), + "gh-issue": ( + f"https://github.com/bazel-contrib/rules_python/issues/%s", + "#%s issue", + ), "gh-path": (f"https://github.com/bazel-contrib/rules_python/tree/main/%s", "%s"), "gh-pr": (f"https://github.com/bazel-contrib/rules_python/pull/%s", "#%s PR"), } diff --git a/docs/readthedocs_build.sh b/docs/readthedocs_build.sh index 06ac7698d2..6762ffd630 100755 --- a/docs/readthedocs_build.sh +++ b/docs/readthedocs_build.sh @@ -5,12 +5,12 @@ set -eou pipefail declare -a extra_env while IFS='=' read -r -d '' name value; do if [[ "$name" == READTHEDOCS* ]]; then - extra_env+=("--//sphinxdocs:extra_env=$name=$value") + extra_env+=("--@sphinxdocs//sphinxdocs:extra_env=$name=$value") fi done < <(env -0) # In order to get the build number, we extract it from the host name -extra_env+=("--//sphinxdocs:extra_env=HOSTNAME=$HOSTNAME") +extra_env+=("--@sphinxdocs//sphinxdocs:extra_env=HOSTNAME=$HOSTNAME") export RULES_PYTHON_ENABLE_PIPSTAR=1 @@ -18,6 +18,6 @@ set -x export RULES_PYTHON_ENABLE_PIPSTAR=1 bazel run \ --config=rtd \ - "--//sphinxdocs:extra_defines=version=$READTHEDOCS_VERSION" \ + "--@sphinxdocs//sphinxdocs:extra_defines=version=$READTHEDOCS_VERSION" \ "${extra_env[@]}" \ //docs:readthedocs_install diff --git a/python/private/BUILD.bazel b/python/private/BUILD.bazel index 70f7f86413..db96957724 100644 --- a/python/private/BUILD.bazel +++ b/python/private/BUILD.bazel @@ -24,7 +24,9 @@ load(":stamp.bzl", "stamp_build_setting") load(":uncachable_version_file.bzl", "define_uncachable_version_file") package( - default_visibility = ["//:__subpackages__"], + default_visibility = [ + "//:__subpackages__", + ], ) licenses(["notice"]) @@ -689,9 +691,6 @@ bzl_library( bzl_library( name = "util_bzl", srcs = ["util.bzl"], - visibility = [ - "//:__subpackages__", - ], deps = [ ":py_internal_bzl", "@bazel_skylib//lib:types", diff --git a/sphinxdocs/.bazelrc b/sphinxdocs/.bazelrc new file mode 100644 index 0000000000..caefd0af53 --- /dev/null +++ b/sphinxdocs/.bazelrc @@ -0,0 +1,22 @@ +import %workspace%/.bazelrc.deleted_packages + +test --test_output=errors + +build --incompatible_default_to_explicit_init_py +build --@rules_python//python/config_settings:incompatible_default_to_explicit_init_py=True + +# Ensure ongoing compatibility with this flag. +common --incompatible_disallow_struct_provider_syntax +# Makes Bazel 7 act more like Bazel 8 +common --incompatible_use_plus_in_repo_names + +# Explicitly enable for Windows +build --enable_runfiles + +# Local disk cache greatly speeds up builds if the regular cache is lost +common --disk_cache=~/.cache/bazel/bazel-disk-cache + +common --incompatible_python_disallow_native_rules +common --incompatible_no_implicit_file_export + +build --lockfile_mode=update diff --git a/sphinxdocs/.bazelrc.deleted_packages b/sphinxdocs/.bazelrc.deleted_packages new file mode 100644 index 0000000000..fd6d39d64f --- /dev/null +++ b/sphinxdocs/.bazelrc.deleted_packages @@ -0,0 +1 @@ +common --deleted_packages=sphinxdocs/integration_tests/bcr diff --git a/sphinxdocs/.bazelversion b/sphinxdocs/.bazelversion new file mode 100644 index 0000000000..c6b7980b68 --- /dev/null +++ b/sphinxdocs/.bazelversion @@ -0,0 +1 @@ +8.x diff --git a/sphinxdocs/MODULE.bazel b/sphinxdocs/MODULE.bazel new file mode 100644 index 0000000000..bbb9d7a688 --- /dev/null +++ b/sphinxdocs/MODULE.bazel @@ -0,0 +1,27 @@ +module( + name = "sphinxdocs", + version = "0.0.0", + compatibility_level = 1, +) + +bazel_dep(name = "bazel_skylib", version = "1.8.2") +bazel_dep(name = "stardoc", version = "0.7.2", repo_name = "io_bazel_stardoc") +bazel_dep(name = "platforms", version = "0.0.11") +bazel_dep(name = "protobuf", version = "29.0-rc2", repo_name = "com_google_protobuf") +bazel_dep(name = "rules_python", version = "0.0.0") +local_path_override( + module_name = "rules_python", + path = "..", +) + +dev_pip = use_extension( + "@rules_python//python/extensions:pip.bzl", + "pip", + dev_dependency = True, +) +dev_pip.parse( + hub_name = "dev_pip", + python_version = "3.11", + requirements_lock = "@rules_python//docs:requirements.txt", +) +use_repo(dev_pip, "dev_pip") diff --git a/sphinxdocs/BUILD.bazel b/sphinxdocs/sphinxdocs/BUILD.bazel similarity index 97% rename from sphinxdocs/BUILD.bazel rename to sphinxdocs/sphinxdocs/BUILD.bazel index 9ad1e1eef9..893db8214a 100644 --- a/sphinxdocs/BUILD.bazel +++ b/sphinxdocs/sphinxdocs/BUILD.bazel @@ -17,7 +17,7 @@ load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") load("//sphinxdocs/private:sphinx.bzl", "repeated_string_list_flag") package( - default_visibility = ["//:__subpackages__"], + default_visibility = ["//sphinxdocs:__subpackages__"], ) # Additional -D values to add to every Sphinx build. diff --git a/sphinxdocs/docs/BUILD.bazel b/sphinxdocs/sphinxdocs/docs/BUILD.bazel similarity index 89% rename from sphinxdocs/docs/BUILD.bazel rename to sphinxdocs/sphinxdocs/docs/BUILD.bazel index 070e0485d7..87771f14f1 100644 --- a/sphinxdocs/docs/BUILD.bazel +++ b/sphinxdocs/sphinxdocs/docs/BUILD.bazel @@ -1,8 +1,8 @@ -load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility load("//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") load("//sphinxdocs:sphinx_stardoc.bzl", "sphinx_stardocs") +load("//sphinxdocs/private:util.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility -package(default_visibility = ["//:__subpackages__"]) +package(default_visibility = ["//sphinxdocs:__subpackages__"]) # We only build for Linux and Mac because: # 1. The actual doc process only runs on Linux @@ -18,6 +18,7 @@ _TARGET_COMPATIBLE_WITH = select({ sphinx_docs_library( name = "docs_lib", + visibility = ["//visibility:public"], deps = [ ":artisian_api_docs", ":bzl_docs", diff --git a/sphinxdocs/docs/api/index.md b/sphinxdocs/sphinxdocs/docs/api/index.md similarity index 100% rename from sphinxdocs/docs/api/index.md rename to sphinxdocs/sphinxdocs/docs/api/index.md diff --git a/sphinxdocs/docs/api/sphinxdocs/index.md b/sphinxdocs/sphinxdocs/docs/api/sphinxdocs/index.md similarity index 91% rename from sphinxdocs/docs/api/sphinxdocs/index.md rename to sphinxdocs/sphinxdocs/docs/api/sphinxdocs/index.md index bd4e9b6eec..a59edb2b65 100644 --- a/sphinxdocs/docs/api/sphinxdocs/index.md +++ b/sphinxdocs/sphinxdocs/docs/api/sphinxdocs/index.md @@ -1,7 +1,7 @@ -:::{bzl:currentfile} //sphinxdocs:BUILD.bazel +:::{bzl:currentfile} //:BUILD.bazel ::: -# //sphinxdocs +# // :::{bzl:flag} extra_defines Additional `-D` values to add to every Sphinx build. diff --git a/sphinxdocs/docs/api/sphinxdocs/inventories/index.md b/sphinxdocs/sphinxdocs/docs/api/sphinxdocs/inventories/index.md similarity index 71% rename from sphinxdocs/docs/api/sphinxdocs/inventories/index.md rename to sphinxdocs/sphinxdocs/docs/api/sphinxdocs/inventories/index.md index a03645ed44..d0b983fe7f 100644 --- a/sphinxdocs/docs/api/sphinxdocs/inventories/index.md +++ b/sphinxdocs/sphinxdocs/docs/api/sphinxdocs/inventories/index.md @@ -1,7 +1,7 @@ -:::{bzl:currentfile} //sphinxdocs/inventories:BUILD.bazel +:::{bzl:currentfile} //inventories:BUILD.bazel ::: -# //sphinxdocs/inventories +# //inventories :::{bzl:target} bazel_inventory A Sphinx inventory of Bazel objects. diff --git a/sphinxdocs/docs/index.md b/sphinxdocs/sphinxdocs/docs/index.md similarity index 100% rename from sphinxdocs/docs/index.md rename to sphinxdocs/sphinxdocs/docs/index.md diff --git a/sphinxdocs/docs/readthedocs.md b/sphinxdocs/sphinxdocs/docs/readthedocs.md similarity index 92% rename from sphinxdocs/docs/readthedocs.md rename to sphinxdocs/sphinxdocs/docs/readthedocs.md index c347d19850..bcdae833d9 100644 --- a/sphinxdocs/docs/readthedocs.md +++ b/sphinxdocs/sphinxdocs/docs/readthedocs.md @@ -26,8 +26,8 @@ In the example below, `npm` is used to install Bazelisk and a helper shell script, `readthedocs_build.sh` is used to construct the Bazel invocation. The key purpose of the shell script it to set the -`--@rules_python//sphinxdocs:extra_env` and -`--@rules_python//sphinxdocs:extra_defines` flags. These are used to communicate +`@sphinxdocs//sphinxdocs::extra_env` and +`@sphinxdocs//sphinxdocs::extra_defines` flags. These are used to communicate `READTHEDOCS*` environment variables and settings to the Bazel invocation. ## BUILD config @@ -73,7 +73,7 @@ build: ``` # File: docs/BUILD -load("@rules_python//sphinxdocs:readthedocs.bzl.bzl", "readthedocs_install") +load("//:readthedocs.bzl", "readthedocs_install") readthedocs_install( name = "readthedocs_install", docs = [":docs"], @@ -90,17 +90,17 @@ set -eou pipefail declare -a extra_env while IFS='=' read -r -d '' name value; do if [[ "$name" == READTHEDOCS* ]]; then - extra_env+=("--@rules_python//sphinxdocs:extra_env=$name=$value") + extra_env+=("--@sphinxdocs//sphinxdocs:extra_env=$name=$value") fi done < <(env -0) # In order to get the build number, we extract it from the host name -extra_env+=("--@rules_python//sphinxdocs:extra_env=HOSTNAME=$HOSTNAME") +extra_env+=("--@sphinxdocs//sphinxdocs:extra_env=HOSTNAME=$HOSTNAME") set -x bazel run \ --stamp \ - "--@rules_python//sphinxdocs:extra_defines=version=$READTHEDOCS_VERSION" \ + "--@sphinxdocs//sphinxdocs:extra_defines=version=$READTHEDOCS_VERSION" \ "${extra_env[@]}" \ //docs:readthedocs_install ``` diff --git a/sphinxdocs/docs/sphinx-bzl.md b/sphinxdocs/sphinxdocs/docs/sphinx-bzl.md similarity index 99% rename from sphinxdocs/docs/sphinx-bzl.md rename to sphinxdocs/sphinxdocs/docs/sphinx-bzl.md index da4cd9f293..c96061b984 100644 --- a/sphinxdocs/docs/sphinx-bzl.md +++ b/sphinxdocs/sphinxdocs/docs/sphinx-bzl.md @@ -11,7 +11,7 @@ a well known target. ## Configuring Sphinx To enable the plugin in Sphinx, depend on -`@rules_python//sphinxdocs/src/sphinx_bzl` and enable it in `conf.py`: +`//sphinxdocs/src/sphinx_bzl` and enable it in `conf.py`: ``` extensions = [ diff --git a/sphinxdocs/docs/starlark-docgen.md b/sphinxdocs/sphinxdocs/docs/starlark-docgen.md similarity index 96% rename from sphinxdocs/docs/starlark-docgen.md rename to sphinxdocs/sphinxdocs/docs/starlark-docgen.md index b9181ee347..0b89393ced 100644 --- a/sphinxdocs/docs/starlark-docgen.md +++ b/sphinxdocs/sphinxdocs/docs/starlark-docgen.md @@ -13,7 +13,7 @@ While the `sphinx_stardoc` rule doesn't require Sphinx itself, the source it generates requires some additional Sphinx plugins and config settings. When defining the `sphinx_build_binary` target, also depend on: -* `@rules_python//sphinxdocs/src/sphinx_bzl:sphinx_bzl` +* `//sphinxdocs/src/sphinx_bzl:sphinx_bzl` * `myst_parser` (e.g. `@pypi//myst_parser`) * `typing_extensions` (e.g. `@pypi//myst_parser`) @@ -21,7 +21,7 @@ When defining the `sphinx_build_binary` target, also depend on: sphinx_build_binary( name = "sphinx-build", deps = [ - "@rules_python//sphinxdocs/src/sphinx_bzl", + "//sphinxdocs/src/sphinx_bzl", "@pypi//myst_parser", "@pypi//typing_extensions", ... diff --git a/sphinxdocs/sphinxdocs/integration_tests/bcr/BUILD.bazel b/sphinxdocs/sphinxdocs/integration_tests/bcr/BUILD.bazel new file mode 100644 index 0000000000..1aaa69b826 --- /dev/null +++ b/sphinxdocs/sphinxdocs/integration_tests/bcr/BUILD.bazel @@ -0,0 +1,7 @@ +load("@sphinxdocs//sphinxdocs:sphinx.bzl", "sphinx_docs") + +sphinx_docs( + name = "docs", + srcs = ["index.md"], + conf = "conf.py", +) diff --git a/sphinxdocs/sphinxdocs/integration_tests/bcr/MODULE.bazel b/sphinxdocs/sphinxdocs/integration_tests/bcr/MODULE.bazel new file mode 100644 index 0000000000..6a25aa5e4c --- /dev/null +++ b/sphinxdocs/sphinxdocs/integration_tests/bcr/MODULE.bazel @@ -0,0 +1,16 @@ +module( + name = "sphinxdocs_example", + version = "0.0.0", +) + +bazel_dep(name = "sphinxdocs", version = "0.0.0") +local_path_override( + module_name = "sphinxdocs", + path = "../..", +) + +bazel_dep(name = "rules_python", version = "0.0.0") +local_path_override( + module_name = "rules_python", + path = "../../..", +) diff --git a/sphinxdocs/sphinxdocs/integration_tests/bcr/conf.py b/sphinxdocs/sphinxdocs/integration_tests/bcr/conf.py new file mode 100644 index 0000000000..3b751bf402 --- /dev/null +++ b/sphinxdocs/sphinxdocs/integration_tests/bcr/conf.py @@ -0,0 +1,2 @@ +extensions = ["myst_parser"] +master_doc = "index" diff --git a/sphinxdocs/sphinxdocs/integration_tests/bcr/index.md b/sphinxdocs/sphinxdocs/integration_tests/bcr/index.md new file mode 100644 index 0000000000..bfe100937d --- /dev/null +++ b/sphinxdocs/sphinxdocs/integration_tests/bcr/index.md @@ -0,0 +1 @@ +# Sphinxdocs example diff --git a/sphinxdocs/inventories/BUILD.bazel b/sphinxdocs/sphinxdocs/inventories/BUILD.bazel similarity index 100% rename from sphinxdocs/inventories/BUILD.bazel rename to sphinxdocs/sphinxdocs/inventories/BUILD.bazel diff --git a/sphinxdocs/inventories/bazel_inventory.txt b/sphinxdocs/sphinxdocs/inventories/bazel_inventory.txt similarity index 100% rename from sphinxdocs/inventories/bazel_inventory.txt rename to sphinxdocs/sphinxdocs/inventories/bazel_inventory.txt diff --git a/sphinxdocs/private/BUILD.bazel b/sphinxdocs/sphinxdocs/private/BUILD.bazel similarity index 85% rename from sphinxdocs/private/BUILD.bazel rename to sphinxdocs/sphinxdocs/private/BUILD.bazel index c707b4d1d8..5a37cbd309 100644 --- a/sphinxdocs/private/BUILD.bazel +++ b/sphinxdocs/sphinxdocs/private/BUILD.bazel @@ -14,16 +14,16 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") -load("//python:py_binary.bzl", "py_binary") -load("//python:py_library.bzl", "py_library") +load("@rules_python//python:py_binary.bzl", "py_binary") +load("@rules_python//python:py_library.bzl", "py_library") package( default_visibility = ["//sphinxdocs:__subpackages__"], ) -# These are only exported because they're passed as files to the //sphinxdocs +# These are only exported because they're passed as files to the @sphinxdocs # macros, and thus must be visible to other packages. They should only be -# referenced by the //sphinxdocs macros. +# referenced by the @sphinxdocs macros. exports_files( [ "readthedocs_install.py", @@ -34,12 +34,20 @@ exports_files( visibility = ["//visibility:public"], ) +bzl_library( + name = "util_bzl", + srcs = ["util.bzl"], + deps = [ + "@bazel_skylib//lib:types", + ], +) + bzl_library( name = "sphinx_docs_library_macro_bzl", srcs = ["sphinx_docs_library_macro.bzl"], deps = [ ":sphinx_docs_library_bzl", - "//python/private:util_bzl", + "//sphinxdocs/private:util_bzl", ], ) @@ -59,13 +67,14 @@ bzl_library( srcs = ["sphinx.bzl"], deps = [ ":sphinx_docs_library_info_bzl", - "//python:py_binary_bzl", + ":util_bzl", "@bazel_skylib//:bzl_library", "@bazel_skylib//lib:paths", "@bazel_skylib//lib:types", "@bazel_skylib//rules:build_test", "@bazel_skylib//rules:common_settings", "@io_bazel_stardoc//stardoc:stardoc_lib", + "@rules_python//python:py_binary_bzl", ], ) @@ -74,8 +83,8 @@ bzl_library( srcs = ["sphinx_stardoc.bzl"], deps = [ ":sphinx_docs_library_macro_bzl", - "//python/private:util_bzl", "//sphinxdocs:sphinx_bzl", + "//sphinxdocs/private:util_bzl", "@bazel_skylib//:bzl_library", "@bazel_skylib//lib:paths", "@bazel_skylib//lib:types", @@ -87,7 +96,10 @@ bzl_library( bzl_library( name = "readthedocs_bzl", srcs = ["readthedocs.bzl"], - deps = ["//python:py_binary_bzl"], + deps = [ + ":util_bzl", + "@rules_python//python:py_binary_bzl", + ], ) py_binary( diff --git a/sphinxdocs/private/inventory_builder.py b/sphinxdocs/sphinxdocs/private/inventory_builder.py similarity index 100% rename from sphinxdocs/private/inventory_builder.py rename to sphinxdocs/sphinxdocs/private/inventory_builder.py diff --git a/sphinxdocs/private/proto_to_markdown.py b/sphinxdocs/sphinxdocs/private/proto_to_markdown.py similarity index 100% rename from sphinxdocs/private/proto_to_markdown.py rename to sphinxdocs/sphinxdocs/private/proto_to_markdown.py diff --git a/sphinxdocs/private/readthedocs.bzl b/sphinxdocs/sphinxdocs/private/readthedocs.bzl similarity index 87% rename from sphinxdocs/private/readthedocs.bzl rename to sphinxdocs/sphinxdocs/private/readthedocs.bzl index a62c51b86a..14bb1c9fcd 100644 --- a/sphinxdocs/private/readthedocs.bzl +++ b/sphinxdocs/sphinxdocs/private/readthedocs.bzl @@ -13,8 +13,8 @@ # limitations under the License. """Starlark rules for integrating Sphinx and Readthedocs.""" -load("//python:py_binary.bzl", "py_binary") -load("//python/private:util.bzl", "add_tag") # buildifier: disable=bzl-visibility +load("@rules_python//python:py_binary.bzl", "py_binary") +load("//sphinxdocs/private:util.bzl", "add_tag") # buildifier: disable=bzl-visibility _INSTALL_MAIN_SRC = Label("//sphinxdocs/private:readthedocs_install.py") @@ -33,7 +33,7 @@ def readthedocs_install(name, docs, **kwargs): is typically a single {obj}`sphinx_stardocs` target. **kwargs: {type}`dict` additional kwargs to pass onto the installer """ - add_tag(kwargs, "@rules_python//sphinxdocs:readthedocs_install") + add_tag(kwargs, "//sphinxdocs:readthedocs_install") py_binary( name = name, srcs = [_INSTALL_MAIN_SRC], @@ -43,6 +43,6 @@ def readthedocs_install(name, docs, **kwargs): "$(rlocationpaths {})".format(d) for d in docs ], - deps = [Label("//python/runfiles")], + deps = [Label("@rules_python//python/runfiles")], **kwargs ) diff --git a/sphinxdocs/private/readthedocs_install.py b/sphinxdocs/sphinxdocs/private/readthedocs_install.py similarity index 100% rename from sphinxdocs/private/readthedocs_install.py rename to sphinxdocs/sphinxdocs/private/readthedocs_install.py diff --git a/sphinxdocs/private/sphinx.bzl b/sphinxdocs/sphinxdocs/private/sphinx.bzl similarity index 97% rename from sphinxdocs/private/sphinx.bzl rename to sphinxdocs/sphinxdocs/private/sphinx.bzl index 0efbc269c5..b7c051a154 100644 --- a/sphinxdocs/private/sphinx.bzl +++ b/sphinxdocs/sphinxdocs/private/sphinx.bzl @@ -16,8 +16,8 @@ load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") -load("//python:py_binary.bzl", "py_binary") -load("//python/private:util.bzl", "add_tag", "copy_propagating_kwargs") # buildifier: disable=bzl-visibility +load("@rules_python//python:py_binary.bzl", "py_binary") +load("//sphinxdocs/private:util.bzl", "add_tag", "copy_propagating_kwargs") # buildifier: disable=bzl-visibility load(":sphinx_docs_library_info.bzl", "SphinxDocsLibraryInfo") _SPHINX_BUILD_MAIN_SRC = Label("//sphinxdocs/private:sphinx_build.py") @@ -83,7 +83,7 @@ def sphinx_build_binary(name, py_binary_rule = py_binary, **kwargs): **kwargs: {type}`dict` Additional kwargs to pass onto `py_binary`. The `srcs` and `main` attributes must not be specified. """ - add_tag(kwargs, "@rules_python//sphinxdocs:sphinx_build_binary") + add_tag(kwargs, "//sphinxdocs:sphinx_build_binary") py_binary_rule( name = name, srcs = [_SPHINX_BUILD_MAIN_SRC], @@ -134,7 +134,7 @@ def sphinx_docs( formats: (list of str) the formats (`-b` flag) to generate documentation in. Each format will become an output group. strip_prefix: {type}`str` A prefix to remove from the file paths of the - source files. e.g., given `//docs:foo.md`, stripping `docs/` makes + source files. e.g., given `//sphinxdocs/docs:foo.md`, stripping `docs/` makes Sphinx see `foo.md` in its generated source directory. If not specified, then {any}`native.package_name` is used. extra_opts: {type}`list[str]` Additional options to pass onto Sphinx building. @@ -148,7 +148,7 @@ def sphinx_docs( This can improve incremental building of docs. **kwargs: {type}`dict` Common attributes to pass onto rules. """ - add_tag(kwargs, "@rules_python//sphinxdocs:sphinx_docs") + add_tag(kwargs, "//sphinxdocs:sphinx_docs") common_kwargs = copy_propagating_kwargs(kwargs) internal_name = "_{}".format(name.lstrip("_")) @@ -189,7 +189,7 @@ def sphinx_docs( srcs = [_SPHINX_SERVE_MAIN_SRC], main = _SPHINX_SERVE_MAIN_SRC, data = [html_name], - deps = [Label("//python/runfiles")], + deps = [Label("@rules_python//python/runfiles")], args = [ "$(rlocationpath {})".format(html_name), ], @@ -482,7 +482,7 @@ def sphinx_inventory(*, name, src, **kwargs): the value `-` to indicate it is the same as `name` :::{seealso} - {bzl:obj}`//sphinxdocs/inventories` for inventories of Bazel objects. + {bzl:obj}`//inventories` for inventories of Bazel objects. ::: Args: diff --git a/sphinxdocs/private/sphinx_build.py b/sphinxdocs/sphinxdocs/private/sphinx_build.py similarity index 100% rename from sphinxdocs/private/sphinx_build.py rename to sphinxdocs/sphinxdocs/private/sphinx_build.py diff --git a/sphinxdocs/private/sphinx_docs_library.bzl b/sphinxdocs/sphinxdocs/private/sphinx_docs_library.bzl similarity index 100% rename from sphinxdocs/private/sphinx_docs_library.bzl rename to sphinxdocs/sphinxdocs/private/sphinx_docs_library.bzl diff --git a/sphinxdocs/private/sphinx_docs_library_info.bzl b/sphinxdocs/sphinxdocs/private/sphinx_docs_library_info.bzl similarity index 100% rename from sphinxdocs/private/sphinx_docs_library_info.bzl rename to sphinxdocs/sphinxdocs/private/sphinx_docs_library_info.bzl diff --git a/sphinxdocs/private/sphinx_docs_library_macro.bzl b/sphinxdocs/sphinxdocs/private/sphinx_docs_library_macro.bzl similarity index 70% rename from sphinxdocs/private/sphinx_docs_library_macro.bzl rename to sphinxdocs/sphinxdocs/private/sphinx_docs_library_macro.bzl index 095b3769ca..e93a2f5bf6 100644 --- a/sphinxdocs/private/sphinx_docs_library_macro.bzl +++ b/sphinxdocs/sphinxdocs/private/sphinx_docs_library_macro.bzl @@ -1,6 +1,6 @@ """Implementation of sphinx_docs_library macro.""" -load("//python/private:util.bzl", "add_tag") # buildifier: disable=bzl-visibility +load("//sphinxdocs/private:util.bzl", "add_tag") # buildifier: disable=bzl-visibility load(":sphinx_docs_library.bzl", _sphinx_docs_library = "sphinx_docs_library") def sphinx_docs_library(**kwargs): @@ -9,5 +9,5 @@ def sphinx_docs_library(**kwargs): Args: **kwargs: Args passed onto underlying {bzl:rule}`sphinx_docs_library` rule """ - add_tag(kwargs, "@rules_python//sphinxdocs:sphinx_docs_library") + add_tag(kwargs, "//sphinxdocs:sphinx_docs_library") _sphinx_docs_library(**kwargs) diff --git a/sphinxdocs/private/sphinx_run_template.sh b/sphinxdocs/sphinxdocs/private/sphinx_run_template.sh similarity index 100% rename from sphinxdocs/private/sphinx_run_template.sh rename to sphinxdocs/sphinxdocs/private/sphinx_run_template.sh diff --git a/sphinxdocs/private/sphinx_server.py b/sphinxdocs/sphinxdocs/private/sphinx_server.py similarity index 100% rename from sphinxdocs/private/sphinx_server.py rename to sphinxdocs/sphinxdocs/private/sphinx_server.py diff --git a/sphinxdocs/private/sphinx_stardoc.bzl b/sphinxdocs/sphinxdocs/private/sphinx_stardoc.bzl similarity index 97% rename from sphinxdocs/private/sphinx_stardoc.bzl rename to sphinxdocs/sphinxdocs/private/sphinx_stardoc.bzl index d5869b0bc4..ac76219299 100644 --- a/sphinxdocs/private/sphinx_stardoc.bzl +++ b/sphinxdocs/sphinxdocs/private/sphinx_stardoc.bzl @@ -19,8 +19,8 @@ load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_skylib//lib:types.bzl", "types") load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc") -load("//python/private:util.bzl", "add_tag", "copy_propagating_kwargs") # buildifier: disable=bzl-visibility load("//sphinxdocs/private:sphinx_docs_library_macro.bzl", "sphinx_docs_library") +load("//sphinxdocs/private:util.bzl", "add_tag", "copy_propagating_kwargs") # buildifier: disable=bzl-visibility _StardocInputHelperInfo = provider( doc = "Extracts the single source file from a bzl library.", @@ -73,7 +73,7 @@ def sphinx_stardocs( **kwargs: Additional kwargs to pass onto each `sphinx_stardoc` target """ internal_name = "_{}".format(name) - add_tag(kwargs, "@rules_python//sphinxdocs:sphinx_stardocs") + add_tag(kwargs, "//sphinxdocs:sphinx_stardocs") common_kwargs = copy_propagating_kwargs(kwargs) common_kwargs["target_compatible_with"] = kwargs.get("target_compatible_with") @@ -160,7 +160,7 @@ def sphinx_stardoc( **kwargs: {type}`dict` common args passed onto rules. """ internal_name = "_{}".format(name.lstrip("_")) - add_tag(kwargs, "@rules_python//sphinxdocs:sphinx_stardoc") + add_tag(kwargs, "//sphinxdocs:sphinx_stardoc") common_kwargs = copy_propagating_kwargs(kwargs) common_kwargs["target_compatible_with"] = kwargs.get("target_compatible_with") diff --git a/sphinxdocs/sphinxdocs/private/util.bzl b/sphinxdocs/sphinxdocs/private/util.bzl new file mode 100644 index 0000000000..f285a83c13 --- /dev/null +++ b/sphinxdocs/sphinxdocs/private/util.bzl @@ -0,0 +1,58 @@ +"""Utility functions used by sphinxdocs.""" + +load("@bazel_skylib//lib:types.bzl", "types") + +# When bzlmod is enabled, canonical repos names have @@ in them, while under +# workspace builds, there is never a @@ in labels. +BZLMOD_ENABLED = "@@" in str(Label("//sphinxdocs:unused")) + +def copy_propagating_kwargs(from_kwargs, into_kwargs = None): + """Copies args that must be compatible between two targets with a dependency relationship. + + This is intended for when one target depends on another, so they must have + compatible settings such as `testonly` and `compatible_with`. This usually + happens when a macro generates multiple targets, some of which depend + on one another, so their settings must be compatible. + + Args: + from_kwargs: keyword args dict whose common kwarg will be copied. + into_kwargs: optional keyword args dict that the values from `from_kwargs` + will be copied into. The values in this dict will take precedence + over the ones in `from_kwargs` (i.e., if this has `testonly` already + set, then it won't be overwritten). + NOTE: THIS WILL BE MODIFIED IN-PLACE. + + Returns: + Keyword args to use for the depender target derived from the dependency + target. If `into_kwargs` was passed in, then that same object is + returned; this is to facilitate easy `**` expansion. + """ + if into_kwargs == None: + into_kwargs = {} + + # Include tags because people generally expect tags to propagate. + for attr in ("testonly", "tags", "compatible_with", "restricted_to", "target_compatible_with"): + if attr in from_kwargs and attr not in into_kwargs: + into_kwargs[attr] = from_kwargs[attr] + return into_kwargs + +def add_tag(attrs, tag): + """Adds `tag` to `attrs["tags"]`. + + Args: + attrs: dict of keyword args. It is modified in place. + tag: str, the tag to add. + """ + if "tags" in attrs and attrs["tags"] != None: + tags = attrs["tags"] + + # Preserve the input type: this allows a test verifying the underlying + # rule can accept the tuple for the tags argument. + if types.is_tuple(tags): + attrs["tags"] = tags + (tag,) + else: + # List concatenation is necessary because the original value + # may be a frozen list. + attrs["tags"] = tags + [tag] + else: + attrs["tags"] = [tag] diff --git a/sphinxdocs/readthedocs.bzl b/sphinxdocs/sphinxdocs/readthedocs.bzl similarity index 100% rename from sphinxdocs/readthedocs.bzl rename to sphinxdocs/sphinxdocs/readthedocs.bzl diff --git a/sphinxdocs/sphinx.bzl b/sphinxdocs/sphinxdocs/sphinx.bzl similarity index 100% rename from sphinxdocs/sphinx.bzl rename to sphinxdocs/sphinxdocs/sphinx.bzl diff --git a/sphinxdocs/sphinx_docs_library.bzl b/sphinxdocs/sphinxdocs/sphinx_docs_library.bzl similarity index 100% rename from sphinxdocs/sphinx_docs_library.bzl rename to sphinxdocs/sphinxdocs/sphinx_docs_library.bzl diff --git a/sphinxdocs/sphinx_stardoc.bzl b/sphinxdocs/sphinxdocs/sphinx_stardoc.bzl similarity index 100% rename from sphinxdocs/sphinx_stardoc.bzl rename to sphinxdocs/sphinxdocs/sphinx_stardoc.bzl diff --git a/sphinxdocs/src/sphinx_bzl/BUILD.bazel b/sphinxdocs/sphinxdocs/src/sphinx_bzl/BUILD.bazel similarity index 69% rename from sphinxdocs/src/sphinx_bzl/BUILD.bazel rename to sphinxdocs/sphinxdocs/src/sphinx_bzl/BUILD.bazel index 8830315bc3..2dd25e09b3 100644 --- a/sphinxdocs/src/sphinx_bzl/BUILD.bazel +++ b/sphinxdocs/sphinxdocs/src/sphinx_bzl/BUILD.bazel @@ -1,7 +1,7 @@ -load("//python:py_library.bzl", "py_library") +load("@rules_python//python:py_library.bzl", "py_library") package( - default_visibility = ["//:__subpackages__"], + default_visibility = ["//sphinxdocs:__subpackages__"], ) # NOTE: This provides the library on its own, not its dependencies. diff --git a/sphinxdocs/src/sphinx_bzl/__init__.py b/sphinxdocs/sphinxdocs/src/sphinx_bzl/__init__.py similarity index 100% rename from sphinxdocs/src/sphinx_bzl/__init__.py rename to sphinxdocs/sphinxdocs/src/sphinx_bzl/__init__.py diff --git a/sphinxdocs/src/sphinx_bzl/bzl.py b/sphinxdocs/sphinxdocs/src/sphinx_bzl/bzl.py similarity index 99% rename from sphinxdocs/src/sphinx_bzl/bzl.py rename to sphinxdocs/sphinxdocs/src/sphinx_bzl/bzl.py index 7d5ec6a68e..a1f47b3b1d 100644 --- a/sphinxdocs/src/sphinx_bzl/bzl.py +++ b/sphinxdocs/sphinxdocs/src/sphinx_bzl/bzl.py @@ -57,7 +57,7 @@ def _log_debug(message, *args): # NOTE: Non-warning log messages go to stdout and are only # visible when -q isn't passed to Sphinx. Note that the sphinx_docs build - # rule passes -q by default; use --//sphinxdocs:quiet=false to disable it. + # rule passes -q by default; use --//:quiet=false to disable it. _logger.debug("%s" + message, _LOG_PREFIX, *args) @@ -1754,9 +1754,7 @@ def clear_doc(self, docname: str) -> None: if entry.full_id in self.data["objects"]: del self.data["objects"][entry.full_id] - if entry.full_id in self.data["objects_by_type"].get( - entry.object_type, {} - ): + if entry.full_id in self.data["objects_by_type"].get(entry.object_type, {}): del self.data["objects_by_type"][entry.object_type][entry.full_id] # We can't easily reverse the mapping for alt_names, so we have diff --git a/sphinxdocs/tests/BUILD.bazel b/sphinxdocs/sphinxdocs/tests/BUILD.bazel similarity index 100% rename from sphinxdocs/tests/BUILD.bazel rename to sphinxdocs/sphinxdocs/tests/BUILD.bazel diff --git a/sphinxdocs/tests/proto_to_markdown/BUILD.bazel b/sphinxdocs/sphinxdocs/tests/proto_to_markdown/BUILD.bazel similarity index 93% rename from sphinxdocs/tests/proto_to_markdown/BUILD.bazel rename to sphinxdocs/sphinxdocs/tests/proto_to_markdown/BUILD.bazel index 2964785eed..632d6d946f 100644 --- a/sphinxdocs/tests/proto_to_markdown/BUILD.bazel +++ b/sphinxdocs/sphinxdocs/tests/proto_to_markdown/BUILD.bazel @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//python:py_test.bzl", "py_test") +load("@rules_python//python:py_test.bzl", "py_test") py_test( name = "proto_to_markdown_test", diff --git a/sphinxdocs/tests/proto_to_markdown/proto_to_markdown_test.py b/sphinxdocs/sphinxdocs/tests/proto_to_markdown/proto_to_markdown_test.py similarity index 100% rename from sphinxdocs/tests/proto_to_markdown/proto_to_markdown_test.py rename to sphinxdocs/sphinxdocs/tests/proto_to_markdown/proto_to_markdown_test.py diff --git a/sphinxdocs/tests/sphinx_docs/BUILD.bazel b/sphinxdocs/sphinxdocs/tests/sphinx_docs/BUILD.bazel similarity index 100% rename from sphinxdocs/tests/sphinx_docs/BUILD.bazel rename to sphinxdocs/sphinxdocs/tests/sphinx_docs/BUILD.bazel diff --git a/sphinxdocs/tests/sphinx_docs/conf.py b/sphinxdocs/sphinxdocs/tests/sphinx_docs/conf.py similarity index 100% rename from sphinxdocs/tests/sphinx_docs/conf.py rename to sphinxdocs/sphinxdocs/tests/sphinx_docs/conf.py diff --git a/sphinxdocs/tests/sphinx_docs/defs.bzl b/sphinxdocs/sphinxdocs/tests/sphinx_docs/defs.bzl similarity index 100% rename from sphinxdocs/tests/sphinx_docs/defs.bzl rename to sphinxdocs/sphinxdocs/tests/sphinx_docs/defs.bzl diff --git a/sphinxdocs/tests/sphinx_docs/doc1.md b/sphinxdocs/sphinxdocs/tests/sphinx_docs/doc1.md similarity index 100% rename from sphinxdocs/tests/sphinx_docs/doc1.md rename to sphinxdocs/sphinxdocs/tests/sphinx_docs/doc1.md diff --git a/sphinxdocs/tests/sphinx_docs/doc2.md b/sphinxdocs/sphinxdocs/tests/sphinx_docs/doc2.md similarity index 100% rename from sphinxdocs/tests/sphinx_docs/doc2.md rename to sphinxdocs/sphinxdocs/tests/sphinx_docs/doc2.md diff --git a/sphinxdocs/tests/sphinx_docs/index.md b/sphinxdocs/sphinxdocs/tests/sphinx_docs/index.md similarity index 100% rename from sphinxdocs/tests/sphinx_docs/index.md rename to sphinxdocs/sphinxdocs/tests/sphinx_docs/index.md diff --git a/sphinxdocs/tests/sphinx_stardoc/BUILD.bazel b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/BUILD.bazel similarity index 98% rename from sphinxdocs/tests/sphinx_stardoc/BUILD.bazel rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/BUILD.bazel index af9af30886..a5d402b809 100644 --- a/sphinxdocs/tests/sphinx_stardoc/BUILD.bazel +++ b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/BUILD.bazel @@ -1,6 +1,6 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_skylib//rules:build_test.bzl", "build_test") -load("//python:py_test.bzl", "py_test") +load("@rules_python//python:py_test.bzl", "py_test") load("//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs") load("//sphinxdocs:sphinx_stardoc.bzl", "sphinx_stardoc", "sphinx_stardocs") diff --git a/sphinxdocs/tests/sphinx_stardoc/aspect.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/aspect.md similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/aspect.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/aspect.md diff --git a/sphinxdocs/tests/sphinx_stardoc/bzl_function.bzl b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/bzl_function.bzl similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/bzl_function.bzl rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/bzl_function.bzl diff --git a/sphinxdocs/tests/sphinx_stardoc/bzl_providers.bzl b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/bzl_providers.bzl similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/bzl_providers.bzl rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/bzl_providers.bzl diff --git a/sphinxdocs/tests/sphinx_stardoc/bzl_rule.bzl b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/bzl_rule.bzl similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/bzl_rule.bzl rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/bzl_rule.bzl diff --git a/sphinxdocs/tests/sphinx_stardoc/bzl_typedef.bzl b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/bzl_typedef.bzl similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/bzl_typedef.bzl rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/bzl_typedef.bzl diff --git a/sphinxdocs/tests/sphinx_stardoc/conf.py b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/conf.py similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/conf.py rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/conf.py diff --git a/sphinxdocs/tests/sphinx_stardoc/envvars.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/envvars.md similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/envvars.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/envvars.md diff --git a/sphinxdocs/tests/sphinx_stardoc/function.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/function.md similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/function.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/function.md diff --git a/sphinxdocs/tests/sphinx_stardoc/glossary.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/glossary.md similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/glossary.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/glossary.md diff --git a/sphinxdocs/tests/sphinx_stardoc/index.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/index.md similarity index 76% rename from sphinxdocs/tests/sphinx_stardoc/index.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/index.md index 43ef14f55a..51a7a671ec 100644 --- a/sphinxdocs/tests/sphinx_stardoc/index.md +++ b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/index.md @@ -5,7 +5,7 @@ This is a set of documents to test the sphinx_stardoc extension. To build and view these docs, run: ``` -bazel run //sphinxdocs/tests/sphinx_stardoc:docs.serve +bazel run //tests/sphinx_stardoc:docs.serve ``` This will build the docs and start an HTTP server where they can be viewed. @@ -14,7 +14,7 @@ To aid the edit/debug cycle, `ibazel` can be used to automatically rebuild the HTML: ``` -ibazel build //sphinxdocs/tests/sphinx_stardoc:docs +ibazel build //tests/sphinx_stardoc:docs ``` :::{toctree} diff --git a/sphinxdocs/tests/sphinx_stardoc/module_extension.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/module_extension.md similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/module_extension.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/module_extension.md diff --git a/sphinxdocs/tests/sphinx_stardoc/provider.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/provider.md similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/provider.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/provider.md diff --git a/sphinxdocs/tests/sphinx_stardoc/repo_rule.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/repo_rule.md similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/repo_rule.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/repo_rule.md diff --git a/sphinxdocs/tests/sphinx_stardoc/rule.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/rule.md similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/rule.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/rule.md diff --git a/sphinxdocs/tests/sphinx_stardoc/sphinx_output_test.py b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/sphinx_output_test.py similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/sphinx_output_test.py rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/sphinx_output_test.py diff --git a/sphinxdocs/tests/sphinx_stardoc/target.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/target.md similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/target.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/target.md diff --git a/sphinxdocs/tests/sphinx_stardoc/typedef.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/typedef.md similarity index 100% rename from sphinxdocs/tests/sphinx_stardoc/typedef.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/typedef.md diff --git a/sphinxdocs/tests/sphinx_stardoc/xrefs.md b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/xrefs.md similarity index 92% rename from sphinxdocs/tests/sphinx_stardoc/xrefs.md rename to sphinxdocs/sphinxdocs/tests/sphinx_stardoc/xrefs.md index bbd415ce19..9893c32023 100644 --- a/sphinxdocs/tests/sphinx_stardoc/xrefs.md +++ b/sphinxdocs/sphinxdocs/tests/sphinx_stardoc/xrefs.md @@ -36,7 +36,7 @@ Various tests of cross referencing support ## Using origin keys -* provider using `{type}`: {type}`"@rules_python//sphinxdocs/tests/sphinx_stardoc:bzl_rule.bzl%GenericInfo"` +* provider using `{type}`: {type}`"//tests/sphinx_stardoc:bzl_rule.bzl%GenericInfo"` ## Any xref