forked from cloudflare/wrangler-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
22 lines (21 loc) · 804 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/// This file customizes debug builds for Wrangler
///
/// 1) sets the debug flag for rustc so Wrangler can feature detect
/// https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-cfg
/// 2) set the source directory for Wrangler so debug builds know where to
/// look for wranglerjs source files
/// https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-envvarvalue
use std::env;
fn main() {
if let Ok(profile) = env::var("PROFILE") {
if profile == "debug" {
println!("cargo:rustc-cfg=feature={:?}", profile);
println!(
"cargo:rustc-env=SOURCE_DIR={:?}",
env::current_dir().unwrap()
);
} else {
println!("cargo:rustc-env=SOURCE_DIR={:?}", "");
}
}
}