Files
metal2vulkan/scripts/api-docs
T
Anees Iqbal 7596ec76db Translator: its comments cite no deleted runtime crate or lane
The translator's comments cited the deleted runtime's files and the deleted validation lanes
(runtime_lane::*) as where a measurement or a mirror test lived, and called rt "the new runtime".
The measurements now stand as measured, and "the new runtime" says "the runtime". The crate
docs' last line names metal2vulkan-rt as the Metal-like runtime built on this API, and
scripts/api-docs no longer says the runtime uses the hidden env_vars and repro modules (nothing
outside the crate does).

Left for the translator-switch commit, which deletes what they describe: driver_facts.rs,
profile.rs, derive.rs, lockstep.rs's resident-table domains, the old render descriptor key
(compile/api.rs and its pinned test), DriverDeviation's doc in error/mod.rs, function_storage.rs,
and the Device::new notes in engine_private_render_state, engine_simd and engine_arith.

Comments only, plus the crate-root doc line and one script comment.
2026-11-20 07:59:12 -08:00

54 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Renders the consumer reference of the new API's frozen surface, warnings
# denied. CI runs it after the ordinary documentation build; so does the gate in CONTRIBUTING.md.
#
# scripts/api-docs # render into <target>/doc/metal2vulkan
# scripts/api-docs --open # and open it in a browser
#
# It is the ordinary rustdoc build of the library with every feature: the crate root shows the new
# API's public module roots, `Budget`, and `CancelToken`, and hides the hidden crate-root
# modules (`env_vars` and `repro`, which the binary uses). Hidden items and
# submodules inside the roots stay hidden.
# `crates/metal2vulkan/tests/api_surface.rs` keeps that set equal to the pinned surface table.
#
# The previous output is removed first, so no page of another build survives in the reference.
# Rustdoc renders a link to an item it does not document (a hidden or internal one) as its
# bracketed text, without a warning; the script fails when a page shows one, so the reference
# never points at internals.
set -euo pipefail
cd "$(dirname "$0")/.."
case "${1-}" in
"" | --open) ;;
*)
echo "usage: scripts/api-docs [--open]" >&2
exit 64
;;
esac
target_dir=$(cargo metadata --format-version 1 --no-deps |
sed -n 's/.*"target_directory":"\([^"]*\)".*/\1/p')
doc="$target_dir/doc/metal2vulkan"
rm -rf "$doc"
export RUSTDOCFLAGS="${RUSTDOCFLAGS-} -D warnings"
cargo doc -p metal2vulkan --lib --no-deps --all-features
if [ ! -f "$doc/pipeline/index.html" ]; then
echo "scripts/api-docs: $doc has no pipeline module page" >&2
exit 1
fi
unresolved=$(find "$doc" -name '*.html' -print0 |
xargs -0 grep -L 'http-equiv="refresh"' |
tr '\n' '\0' |
xargs -0 grep -Ho '\[<code>[^<]*</code>\]' || true)
if [ -n "$unresolved" ]; then
echo "scripts/api-docs: links that did not resolve (to hidden or internal items):" >&2
printf '%s\n' "$unresolved" | sed "s#^$doc/##" >&2
exit 1
fi
echo "scripts/api-docs: rendered $doc/index.html"
if [ "${1-}" = --open ]; then
cargo doc -p metal2vulkan --lib --no-deps --all-features --open
fi