From 17020f4924685e6dd92c20ab93d0d318647565fb Mon Sep 17 00:00:00 2001 From: chrysn Date: Thu, 1 Feb 2024 13:35:51 +0100 Subject: [PATCH] build: Tolerate absence of RIOT_USEMODULES This is not a breaking change, it just turns what used to be a build.rs error into a later error (eg. when used with an older riot-wrappers, that would be missing modules -- but only if the build system suddenly stopped passing in the variable). Tolerating the absence allows the build system to phase out passing dummy values into RIOT_USEMODULES even before [38] is through. [38]: https://github.com/RIOT-OS/rust-riot-sys/pull/38 --- build.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index d057245..e9bb749 100644 --- a/build.rs +++ b/build.rs @@ -126,10 +126,10 @@ fn main() { #[cfg(not(feature = "riot-rs"))] { println!("cargo:rerun-if-env-changed=RIOT_USEMODULE"); - env::var("RIOT_USEMODULE").expect(&format!( - "RIOT_USEMODULE is required when {} is given", - &compile_commands_json, - )) + // We tolerate the absence. Older versions of riot-wrappers would then fail to + // enable modules, but newer versions just work without it (and would need a dummy + // variable passed in otherwise). On the long run, this is going away anyway. + env::var("RIOT_USEMODULE").unwrap_or_default() } #[cfg(feature = "riot-rs")] {