ruwuma/crates/ruma-common/build.rs
gnieto cd133c2c15 common: Allow to configure exhaustive types when environment variable is set
Allow to configure exhaustive types via the
`RUMA_UNSTABLE_EXHAUSTIVE_TYPES` environment variable in the same way as
it's done in other crates.

ruma-common contains at least `NewPushRule` which may be configured
as exhaustive. `ruma-client-api` uses the mentioned type and, when the
environment variable is set, it fails to compile the project.
2025-03-11 18:07:50 -04:00

17 lines
626 B
Rust

use std::env;
fn main() {
// Set the `ruma_identifiers_storage` configuration from an environment variable.
if let Ok(value) = env::var("RUMA_IDENTIFIERS_STORAGE") {
println!("cargo:rustc-cfg=ruma_identifiers_storage={value}");
}
println!("cargo:rerun-if-env-changed=RUMA_IDENTIFIERS_STORAGE");
// Set the `ruma_unstable_exhaustive_types` configuration from an environment variable.
if env::var("RUMA_UNSTABLE_EXHAUSTIVE_TYPES").is_ok() {
println!("cargo:rustc-cfg=ruma_unstable_exhaustive_types");
}
println!("cargo:rerun-if-env-changed=RUMA_UNSTABLE_EXHAUSTIVE_TYPES");
}