问题
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".
回答1:
This is not possible as of Rust 1.38. Cargo issue #4001 tracks the possibility of supporting this in some fashion.
来源:https://stackoverflow.com/questions/36446642/how-to-access-current-cargo-profile-build-test-bench-doc-from-the-bui