feat: build host-only doc tools in host config under cross --platforms#633
Draft
umaucher wants to merge 1 commit into
Draft
feat: build host-only doc tools in host config under cross --platforms#633umaucher wants to merge 1 commit into
umaucher wants to merge 1 commit into
Conversation
The runnable documentation targets (docs, docs_combo, docs_check, docs_link_check, live_preview, live_preview_combo_experimental, ide_support) are host tools that run Python/Sphinx locally. Under a cross `--platforms` (e.g. QNX) they were configured for the target platform and failed Python toolchain resolution, breaking `bazel build //...` in cross-compiling consumers. Wrap each in a small rule whose incoming transition pins `//command_line_option:platforms` to `--host_platform`, so they always build and run in the host configuration regardless of the top-level `--platforms`. The wrapper forwards the executable, runfiles and RunEnvironmentInfo so `bazel run //:docs` keeps working. `sphinx_build` is only consumed as a tool (already built in the exec/host config) and is tagged `manual` so wildcard builds under a cross platform do not try to configure it for the target platform.
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //src:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The runnable documentation targets created by
docs()—docs,docs_combo,docs_check,docs_link_check,live_preview,live_preview_combo_experimental,ide_support— are host tools that run Python/Sphinx on the build machine. When a consumer builds with a cross--platforms(e.g.--config=per-x86_64-qnx -- //...), these top-level targets get configured for the target platform and fail Python toolchain resolution (No matching toolchains ... tools/python), breaking the whole build in cross-compiling consumers (persistency, reference_integration).What
Each host-only run target is wrapped in a small rule (
_host_binary) whose incoming transition pins//command_line_option:platformsto whatever--host_platformis set to. The targets therefore always build and run in the host configuration regardless of the top-level--platforms.RunEnvironmentInfo, sobazel run //:docs(and theenv-carrying targets) keep working unchanged.--host_platformdynamically rather than hardcoding a platform, so it works for any consumer's host.sphinx_buildis only ever consumed as a tool (already built in the exec/host config), so it needs no transition; it is taggedmanualso a wildcardbazel build //...under a cross platform skips it instead of trying to configure it for the target platform.Validation
bazel build //:docs //:needs_json //:metrics_json,bazel run //:ide_support— no regression.bazel build --config=per-x86_64-qnx -- //...no longer fails Python toolchain resolution — the wrapped run targets transition to the host config, whilesphinx_build(amanualtool) is skipped by the wildcard and built only in the exec/host config when consumed byneeds_json.cquery --transitions=liteconfirms the wrapped targets transition to the host config. (The only remaining consumer failure is the unrelatedvalid_frommetamodel skew fixed by Set valid_from attribute for all features score#3064.)buildifierclean.No tracking issue.