Source directory was modified by build.rs
⚓ Rust 📅 2025-12-31 👤 surdeus 👁️ 6Hello
I have a project with a build.rs which creates bindings inside my src/ folder
When I run cargo publish, i encounter the error
Source directory was modified by build.rs during cargo publish. Build scripts should not modify anything outside of OUT_DIR.
Is there a way - like in docs.rs with the env DOCS_RS to skip the build script on publish ??
Currently I do
if env::var("DOCS_RS").is_ok() {
// do nothing on docs.rs
return Ok(());
}
I would like to do
if env::var("DOCS_RS").is_ok() || env::var("CARGO_PUBLISH").is_ok() {
// do nothing on docs.rs or during publish
return Ok(());
}
Thanks!
3 posts - 2 participants
🏷️ Rust_feed