From: Steve Myers Date: Sun, 20 Feb 2022 00:08:08 +0000 (-0800) Subject: Prevent building with more than one database feature enabled X-Git-Tag: v0.5.0~3^2~1 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/struct.CommandStringError.html?a=commitdiff_plain;h=14106ebdde145be0e5d88bbba8f87653c2558efb;p=bdk-cli Prevent building with more than one database feature enabled --- diff --git a/build.rs b/build.rs index 92e4946..30c1796 100644 --- a/build.rs +++ b/build.rs @@ -16,4 +16,21 @@ fn main() { if blockchain_features.len() > 1 { panic!("At most one blockchain client feature can be enabled but these features were enabled: {:?}", blockchain_features) } + + let key_value_db = + env::var_os("CARGO_FEATURE_KEY_VALUE_DB").map(|_| "key-value-db".to_string()); + let sqlite_db = env::var_os("CARGO_FEATURE_SQLITE_DB").map(|_| "sqlite-db".to_string()); + + let database_features: Vec = vec![key_value_db, sqlite_db] + .iter() + .map(|f| f.to_owned()) + .flatten() + .collect(); + + if database_features.len() > 1 { + panic!( + "At most one database feature can be enabled but these features were enabled: {:?}", + database_features + ) + } }