Skip to content

Conversation

@dsykes16
Copy link

@dsykes16 dsykes16 commented Oct 6, 2025

Fix docs.rs build by removing exclusion on protobuf code generation when DOCS_RS environment variable is set.

This issue appears to have been introduced in #138.

Docs.rs build log:

# rustc version
rustc 1.90.0-nightly (ba7e63b63 2025-07-29)# docs.rs version
docsrs 0.6.0 (e18d034e 2025-07-29)# build log
[INFO] running `Command { std: "docker" "create" "-v" "/home/cratesfyi/workspace/builds/spiffe-0.6.7/target:/opt/rustwide/target:rw,Z" "-v" "/home/cratesfyi/workspace/builds/spiffe-0.6.7/source:/opt/rustwide/workdir:ro,Z" "-v" "/home/cratesfyi/workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/home/cratesfyi/workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "DOCS_RS=1" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "6442450944" "--cpus" "6" "--user" "1001:1001" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:cf8efcab8866f2cf4285301c7418e2f4f2a9b088c91ba69c40d5b659f81557f7" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "rustdoc" "--lib" "-Zrustdoc-map" "--config" "build.rustdocflags=[\"--cfg\", \"docsrs\", \"-Z\", \"unstable-options\", \"--emit=invocation-specific\", \"--resource-suffix\", \"-20250729-1.90.0-nightly-ba7e63b63\", \"--static-root-path\", \"/-/rustdoc.static/\", \"--cap-lints\", \"warn\", \"--extern-html-root-takes-precedence\"]" "--offline" "-Zunstable-options" "--config=doc.extern-map.registries.crates-io=\"https://docs.rs/{pkg_name}/{version}/x86_64-unknown-linux-gnu\"" "-Zrustdoc-scrape-examples" "-j6" "--target" "x86_64-unknown-linux-gnu", kill_on_drop: false }`
[INFO] [stderr] WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
[INFO] [stdout] efd0bdece441370c2fe87a772b7a26a9fa323c7e58417d89d90c332f11785411
[INFO] running `Command { std: "docker" "start" "-a" "efd0bdece441370c2fe87a772b7a26a9fa323c7e58417d89d90c332f11785411", kill_on_drop: false }`
[INFO] [stderr] warning: target filter specified, but no targets matched; this is a no-op
[INFO] [stderr] warning: [email protected]: Skipping protobuf code generation on docs.rs.
[INFO] [stderr]  Documenting spiffe v0.6.7 (/opt/rustwide/workdir)
[INFO] [stderr] error: couldn't read `/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/build/spiffe-f0105de0204d5a80/out/workload.rs`: No such file or directory (os error 2)
[INFO] [stderr]    --> src/lib.rs:105:9
[INFO] [stderr]     |
[INFO] [stderr] 105 |         include!(concat!(env!("OUT_DIR"), "/workload.rs"));
[INFO] [stderr]     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] warning: [email protected]: Skipping protobuf code generation on docs.rs.
[INFO] [stderr] error: could not document `spiffe`
[INFO] running `Command { std: "docker" "inspect" "efd0bdece441370c2fe87a772b7a26a9fa323c7e58417d89d90c332f11785411", kill_on_drop: false }`
[INFO] running `Command { std: "docker" "rm" "-f" "efd0bdece441370c2fe87a772b7a26a9fa323c7e58417d89d90c332f11785411", kill_on_drop: false }`
[INFO] [stdout] efd0bdece441370c2fe87a772b7a26a9fa323c7e58417d89d90c332f11785411

Fix docs.rs build by removing exclusion on protobuf code generation
when `DOCS_RS` environment variable is set.

Signed-off-by: Dwayne Sykes <[email protected]>
use anyhow::{ensure, Context as _};

fn main() -> anyhow::Result<()> {
println!("cargo::rerun-if-changed=src/proto");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix this directive

Suggested change
println!("cargo::rerun-if-changed=src/proto");
println!("cargo:rerun-if-changed=src/proto");


fn main() -> anyhow::Result<()> {
println!("cargo::rerun-if-changed=src/proto");
println!("cargo::rerun-if-env-changed=DOCS_RS");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line from spire-api/build.rs as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants