From 87fd2f5ca3c2198c6b11ece3e060aab0e81406ac Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 12 Oct 2020 11:53:16 -0700 Subject: [PATCH] rust: Detect debug builds using PROFILE env var in build script Fixes #757 --- lib/binding_rust/build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/binding_rust/build.rs b/lib/binding_rust/build.rs index caf5fa8e..0ec7a4ad 100644 --- a/lib/binding_rust/build.rs +++ b/lib/binding_rust/build.rs @@ -21,8 +21,8 @@ fn main() { let mut config = cc::Build::new(); - println!("cargo:rerun-if-env-changed=DEBUG"); - if env::var("DEBUG").map(|s| s == "true").unwrap_or(false) { + println!("cargo:rerun-if-env-changed=PROFILE"); + if env::var("PROFILE").map_or(false, |s| s == "debug") { config.define("TREE_SITTER_TEST", ""); }