How to access the current cargo profile (build, test, bench, document, ...) from the script assembly (build.rs)

I want to write a custom build.rs script that generates some diagrams to accompany the documentation for the box I'm working on. I want this script to be run only when cargo doc launched, and not in other profiles ( cargo build , cargo test , ...). What would be the best way to do this?

I was hoping the load would pass this information to build.rs in the PROFILE env variable, but it looks like it only contains "debug" or "release".

+6
source share
1 answer

This is not possible with Rust 1.38. Load Problem # 4001 tracks the possibility of any support.

+1
source

Source: https://habr.com/ru/post/1246533/


All Articles