I want to write a custom build.rs
script that generates some diagrams to accompany the documentation for a crate I'm working on. I want this script to run only when I run cargo doc
, not the other profiles (cargo build
, cargo test
, ...). What would be the best way to do that?
I was hoping that cargo would pass this info to build.rs
in the PROFILE
env variable, but that seems to only contain "debug" or "release".
This is not possible as of Rust 1.38. Cargo issue #4001 tracks the possibility of supporting this in some fashion.