Skip to content

Commit 6c78a06

Browse files
committed
Fix build scripts for docs.rs env
1 parent 654e0ed commit 6c78a06

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

crates/backtest/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ use std::env;
1818

1919
#[allow(clippy::expect_used)]
2020
fn main() {
21+
// Skip file generation if we're in the docs.rs environment
22+
if std::env::var("DOCS_RS").is_ok() {
23+
println!("cargo:warning=Running in docs.rs environment, skipping file generation");
24+
return;
25+
}
26+
2127
// Ensure the build script runs on changes
2228
println!("cargo:rerun-if-env-changed=HIGH_PRECISION");
2329
println!("cargo:rerun-if-env-changed=CARGO_FEATURE_HIGH_PRECISION");

crates/common/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ use std::env;
1818

1919
#[allow(clippy::expect_used)]
2020
fn main() {
21+
// Skip file generation if we're in the docs.rs environment
22+
if std::env::var("DOCS_RS").is_ok() {
23+
println!("cargo:warning=Running in docs.rs environment, skipping file generation");
24+
return;
25+
}
26+
2127
// Ensure the build script runs on changes
2228
println!("cargo:rerun-if-env-changed=HIGH_PRECISION");
2329
println!("cargo:rerun-if-env-changed=CARGO_FEATURE_HIGH_PRECISION");

crates/core/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ fn main() {
4040
println!("cargo:rustc-env=NAUTILUS_VERSION={nautilus_version}");
4141
println!("cargo:rustc-env=NAUTILUS_USER_AGENT=NautilusTrader/{nautilus_version}");
4242

43+
// Skip file generation if we're in the docs.rs environment
44+
if std::env::var("DOCS_RS").is_ok() {
45+
println!("cargo:warning=Running in docs.rs environment, skipping file generation");
46+
return;
47+
}
48+
4349
#[cfg(feature = "ffi")]
4450
if env::var("CARGO_FEATURE_FFI").is_ok() {
4551
use std::{

crates/model/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ use std::env;
2020
#[allow(unused_assignments)]
2121
#[allow(unused_mut)]
2222
fn main() {
23+
// Skip file generation if we're in the docs.rs environment
24+
if std::env::var("DOCS_RS").is_ok() {
25+
println!("cargo:warning=Running in docs.rs environment, skipping file generation");
26+
return;
27+
}
28+
2329
// Ensure the build script runs on changes
2430
println!("cargo:rerun-if-env-changed=HIGH_PRECISION");
2531
println!("cargo:rerun-if-env-changed=CARGO_FEATURE_HIGH_PRECISION");

0 commit comments

Comments
 (0)