Skip to content

Commit 14106eb

Browse files
committed
Prevent building with more than one database feature enabled
1 parent fac465e commit 14106eb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

build.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,21 @@ fn main() {
1616
if blockchain_features.len() > 1 {
1717
panic!("At most one blockchain client feature can be enabled but these features were enabled: {:?}", blockchain_features)
1818
}
19+
20+
let key_value_db =
21+
env::var_os("CARGO_FEATURE_KEY_VALUE_DB").map(|_| "key-value-db".to_string());
22+
let sqlite_db = env::var_os("CARGO_FEATURE_SQLITE_DB").map(|_| "sqlite-db".to_string());
23+
24+
let database_features: Vec<String> = vec![key_value_db, sqlite_db]
25+
.iter()
26+
.map(|f| f.to_owned())
27+
.flatten()
28+
.collect();
29+
30+
if database_features.len() > 1 {
31+
panic!(
32+
"At most one database feature can be enabled but these features were enabled: {:?}",
33+
database_features
34+
)
35+
}
1936
}

0 commit comments

Comments
 (0)