Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0fa6667

Browse filesBrowse files
255rickeylev
andauthored
chore: Remove *_build_test targets from sphinx_docs (#2645) (#2650)
Remove implicit `build_test`s from `sphinx_docs` targets. Instead, users can decide whether or not to add `build_tests` for docs. This also keeps `sphinx_docs` builds out of `bazel test //...`, which may not be desirable. Add `build_test`s to cover in-tree `sphinx_docs` targets. Rename the existing `build_test` for `//sphinxdocs/tests/sphinx_docs:docs` to match the new targets. Also, tag the `sphinx_docs` `*.run` and `*.serve` targets as `"manual"` so they are excluded from wildcards. These are only needed for interactive development. --------- Co-authored-by: Richard Levasseur <richardlev@gmail.com>
1 parent a816962 commit 0fa6667
Copy full SHA for 0fa6667

File tree

Expand file treeCollapse file tree

4 files changed

+18
-10
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+18
-10
lines changed

‎docs/BUILD.bazel

Copy file name to clipboardExpand all lines: docs/BUILD.bazel
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
16+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
1617
load("@dev_pip//:requirements.bzl", "requirement")
1718
load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility
1819
load("//python/private:util.bzl", "IS_BAZEL_7_OR_HIGHER") # buildifier: disable=bzl-visibility
@@ -77,6 +78,11 @@ sphinx_docs(
7778
],
7879
)
7980

81+
build_test(
82+
name = "docs_build_test",
83+
targets = [":docs"],
84+
)
85+
8086
sphinx_stardocs(
8187
name = "bzl_api_docs",
8288
srcs = [

‎sphinxdocs/private/sphinx.bzl

Copy file name to clipboardExpand all lines: sphinxdocs/private/sphinx.bzl
+5-9Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"""Implementation of sphinx rules."""
1616

1717
load("@bazel_skylib//lib:paths.bzl", "paths")
18-
load("@bazel_skylib//rules:build_test.bzl", "build_test")
1918
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
2019
load("//python:py_binary.bzl", "py_binary")
2120
load("//python/private:util.bzl", "add_tag", "copy_propagating_kwargs") # buildifier: disable=bzl-visibility
@@ -177,6 +176,9 @@ def sphinx_docs(
177176
**common_kwargs
178177
)
179178

179+
common_kwargs_with_manual_tag = dict(common_kwargs)
180+
common_kwargs_with_manual_tag["tags"] = list(common_kwargs.get("tags") or []) + ["manual"]
181+
180182
py_binary(
181183
name = name + ".serve",
182184
srcs = [_SPHINX_SERVE_MAIN_SRC],
@@ -185,18 +187,12 @@ def sphinx_docs(
185187
args = [
186188
"$(execpath {})".format(html_name),
187189
],
188-
**common_kwargs
190+
**common_kwargs_with_manual_tag
189191
)
190192
sphinx_run(
191193
name = name + ".run",
192194
docs = name,
193-
**common_kwargs
194-
)
195-
196-
build_test(
197-
name = name + "_build_test",
198-
targets = [name],
199-
**kwargs # kwargs used to pick up target_compatible_with
195+
**common_kwargs_with_manual_tag
200196
)
201197

202198
def _sphinx_docs_impl(ctx):

‎sphinxdocs/tests/sphinx_docs/BUILD.bazel

Copy file name to clipboardExpand all lines: sphinxdocs/tests/sphinx_docs/BUILD.bazel
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ sphinx_build_binary(
4040
)
4141

4242
build_test(
43-
name = "build_tests",
43+
name = "docs_build_test",
4444
targets = [":docs"],
4545
)

‎sphinxdocs/tests/sphinx_stardoc/BUILD.bazel

Copy file name to clipboardExpand all lines: sphinxdocs/tests/sphinx_stardoc/BUILD.bazel
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
2+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
23
load("//python:py_test.bzl", "py_test")
34
load("//python/private:util.bzl", "IS_BAZEL_7_OR_HIGHER") # buildifier: disable=bzl-visibility
45
load("//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs")
@@ -40,6 +41,11 @@ sphinx_docs(
4041
],
4142
)
4243

44+
build_test(
45+
name = "docs_build_test",
46+
targets = [":docs"],
47+
)
48+
4349
sphinx_stardocs(
4450
name = "simple_bzl_docs",
4551
srcs = [

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.