Allow pre-rendered HTML
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
Start with _resolve_data_mounts and the builder-inited and build-finished handlers in src/extensions/score_mounts/, then read bzl/bundle_rules.bzl and bzl/mount_rules.bzl to see how bundle data reaches the manifest. The open questions on destination overlap and live-preview rebuilds need maintainer input before coding. Done means index.html from a root and a mounted tree lands at the expected paths in the html_extra scenario under src/tests/docs_bzl/scenarios/, and needs_json builds without the tree.
索引モデルが issue の本文から書いたものです。
説明
Problem
Since 8.3.0, files in docs(data = ...) belong to the root :docs_bundle and travel with it into every site that mounts that bundle.
A pre-rendered HTML tree listed there, such as a Doxygen API reference staged with filegroup, breaks every site that mounts the bundle.
# component/BUILD
filegroup
name = "doxygen_staged",
srcs = [":doxygen"], # rules_doxygen, declares `html` as a directory artifact
)
docs(
source_dir = "docs",
data = [":doxygen_staged"], # conf.py: html_extra_path = ["../../bazel-bin/component/docs/_doxygen"]
)
# product/BUILD
docs(
source_dir = "docs",
bundles = [{"bundle": "//component:docs_bundle", "mount_at": "component"}],
)
bazel run //component:docs succeeds, while bazel run //product:docs fails in config-inited:
ValueError: score_mounts: resolved data file does not exist: <execroot>/bazel-out/k8-opt/bin/component/docs/_doxygen/api (mount_at=component)
The directory exists, but _resolve_data_mounts requires every data entry of a mounted bundle to pass Path.is_file().
Accepting directories there is not enough, because bundle data is mounted as a Sphinx source directory and HTML in it never reaches the output.
The same setup builds with 7.1.0.
No existing argument fits:
docs_bundle(srcs = ...)takes Sphinx sources with known file names, not a directory to copy.html_extra_pathcopies to the output root of one site, so every mounting site has to restage each child's tree under the child'smount_at.- A
py_library(data = [...])passed throughdocs(deps = ...)builds the tree without it entering the bundle, which is the workaround in use, but it misuses Python deps and keeps the per-site staging.
Proposal
Add html_extra to docs() and docs_bundle(), a dict from a label that provides one directory to a destination relative to the bundle's pages.
filegroup(
name = "doxygen_html",
srcs = [":doxygen"],
output_group = "html",
)
docs(
source_dir = "docs",
html_extra = {":doxygen_html": "api"},
)
- Every site that builds or mounts the bundle copies the directory's contents to
<outdir>/<mount_at>/<destination>/, so relative links such asapi/index.htmlresolve everywhere. - The destination is a non-empty relative path without
..and without a leading/. - Only HTML-format builders receive the trees, and the Needs actions,
docs_checkanddocs_link_checkneither build nor copy them. - Mounting sites need no staging target and no
html_extra_path.
| Target | Component tree lands at |
|---|---|
bazel run //component:docs |
component/_build/api/ |
bazel run //product:docs |
product/_build/component/api/ |
Implementation sketch
bzl/bundle_rules.bzl- Add
html_extra = attr.label_keyed_string_dict(allow_files = True)to_docs_bundle, and validate oneis_directoryfile per label and the destination. - Store
[struct(tree, dest)]on the bundle's entry, also for a bundle without sources or data, and carry it unchanged through_rebase_bundle_entry. - Expose all trees as
DocsBundleInfo.html_extra_files, kept out ofDefaultInfoanddatasoneeds_jsonnever waits for Doxygen.
- Add
bzl/mount_rules.bzl: emit"html_extra": [{"path": ..., "dest": ...}]per manifest entry.docs.bzl- Add the
html_extraparameter todocs()anddocs_bundle(). - Add an internal target that exposes
html_extra_files, to thedataof thedocsandlive_previewbinaries only.
- Add the
src/extensions/score_mounts/_resolver.py- Parse an optional
html_extralist intoMountSpec, so manifests without the key stay readable. - Move the
bazel-out/<config>/binpath translation out ofresolve_walk_dirinto a helper shared with_resolve_data_mountsandmounted_watch_dirs, which drops their hard-codedk8-fastbuildprefix.
- Parse an optional
src/extensions/score_mounts/__init__.py- On
builder-inited, for HTML-format builders only, resolve every tree to<mount_at>/<dest>and fail on a missing source or a duplicate target. - On
build-finishedwithout an exception, copy each tree withshutil.copytree(..., dirs_exist_ok=True). - Report a directory in bundle
dataas "is a directory, use html_extra" in place of "does not exist".
- On
Tests
- Unit tests in
src/extensions/score_mounts/tests/: target paths for root and mounted bundles, missing source, duplicate target, non-HTML builder, failed build, and a manifest without the key. - Analysis tests in
bzl/tests/: invalid labels and destinations, and no trees among theneeds_jsoninputs. - An integration scenario in
src/tests/docs_bzl/scenarios/html_extra/: a root and a mounted bundle each carry a tree, bothindex.htmlfiles land at their expected paths, andneeds_jsonbuilds without the tree. - Documentation in
docs/reference/bazel_macros.rstanddocs/how-to/generated_docs.rst.
Estimated effort is about 1.5 days.
Open questions
html_extrafollows Sphinx'shtml_extra_path, andextra_htmlorhtml_treesare the alternatives.- A destination may or may not be allowed to overlap a directory of Sphinx-generated pages, which the copy would overwrite.
- Live preview runs
build-finishedon every rebuild, so the copy may need to skip unchanged trees.
- 主要言語
- Python
- スター
- 11
- フォーク
- 39
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 65
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
eclipse-score/docs-as-code のほかの issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
eclipse-score/docs-as-code#1031 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
waiting_for_author
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
eclipse-score/docs-as-code#1029 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
intentionally-limited
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
eclipse-score/docs-as-code#1019 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
eclipse-score/docs-as-code#920 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Add project name to headline ...再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンdocumentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
eclipse-score/docs-as-code#613 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
eclipse-score/docs-as-code の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
AIR-Bench Foundation reads the first letter of the word after "answer" as the model's choice対応中かも @beartester34 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelscope/evalscope#2330 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Distribution plot crashes when a numeric feature is constant in the train or test set対応中かも @adembilge が今日担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 10 日以内に返信