From e067b924ca34a9d237340df4dabbfff4cccdcb89 Mon Sep 17 00:00:00 2001 From: jiangjianfeng Date: Fri, 26 Dec 2025 07:37:59 +0000 Subject: [PATCH] Check documentation of all crates in `make docs` --- .github/workflows/publish_api_docs.yml | 5 ++++- Makefile | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish_api_docs.yml b/.github/workflows/publish_api_docs.yml index 2bd0e58dd..65c2fa996 100644 --- a/.github/workflows/publish_api_docs.yml +++ b/.github/workflows/publish_api_docs.yml @@ -25,10 +25,13 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Check API docs + - name: Check API docs of crates to publish if: github.event_name == 'pull_request' run: ./tools/github_workflows/publish_api_docs.sh --dry-run + - name: Check API docs of all crates + run: make docs + - name: Build & Upload Nightly API Docs if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' env: diff --git a/Makefile b/Makefile index e19832fdf..858dcf247 100644 --- a/Makefile +++ b/Makefile @@ -403,10 +403,17 @@ ktest: initramfs $(CARGO_OSDK) .PHONY: docs docs: $(CARGO_OSDK) @for dir in $(NON_OSDK_CRATES); do \ - (cd $$dir && cargo doc --no-deps) || exit 1; \ + (cd $$dir && RUSTDOCFLAGS="-Dwarnings" cargo doc --no-deps) || exit 1; \ done @for dir in $(OSDK_CRATES); do \ - (cd $$dir && cargo osdk doc --no-deps) || exit 1; \ + EXTRA_DOC_FLAGS=""; \ + # The kernel crate is primarily composed of private items. \ + # We include the --document-private-items flag \ + # to ensure documentation of the internal items is fully checked. \ + if [ "$$dir" = "kernel" ]; then \ + EXTRA_DOC_FLAGS="--document-private-items -Arustdoc::private_intra_doc_links"; \ + fi; \ + (cd $$dir && RUSTDOCFLAGS="-Dwarnings $$EXTRA_DOC_FLAGS" cargo osdk doc --no-deps) || exit 1; \ done .PHONY: book