Fix bazel build //... failure caused by missing JSON schema files in Sphinx source tree#201
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
a5f9b1b to
92ae971
Compare
|
For me |
|
I don't get that error. I'm using a clean devcontainer
You are missing the |
Okay, then its fine. I was only building without the "--config" because the PR description states that |
Problem
bazel build //...was failing becauseliteralincludedirectives in the docstraversed up from the Sphinx source tree to
src/…, but Bazel's sandbox onlypopulates the execroot — not the
_sources/directory that Sphinx operates in.This caused the build to break for any contributor running a top-level build.
Root Cause
When Sphinx runs inside a Bazel action (
//:needs_json), the CWD is theexecroot and JSON schema files are linked there at their workspace-relative
paths. However, the Sphinx source tree lives under
bazel-out/…/_needs_json/_sources/, which Bazel does not populate with thosefiles automatically.
literalincludedirectives traversing up tosrc/…therefore resolved to
_sources/src/…, which didn't exist.Changes
BUILD— adds//src/launch_manager_daemon/config/config_schema:config_schema_filesas a data dependency of the
docstarget so the schema files are available inthe sandbox.
src/launch_manager_daemon/config/config_schema/BUILD— introduces aconfig_schema_filesfilegroup that exposes all JSON files under the directorywith public visibility.
docs/conf.py— adds asetup()hook that copies the schema files fromthe execroot into the Sphinx source tree at the path
literalincludeexpects.The copy is guarded so it is a no-op for non-Bazel runs (local
sphinx-buildor
bazel run //:docs) where the files already exist at the expected location.Testing
Notes
docsmacro were modified.conf.pycopy is intentionally defensive (if src_json_dir.exists() and not dest_json_dir.exists()) to avoid interfering with incremental builds orlocal workflows.
Closes #199