-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #809 from godot-rust/bugfix/api-exclusivity-check
Fix validation for `api-*` mutual exclusivity
- Loading branch information
Showing
4 changed files
with
44 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) godot-rust; Bromeon and contributors. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
// `api-*` validation is required here because otherwise, user gets confusing error about conflicting module imports. | ||
// We can also not use this in dependent crates, e.g. in godot/build.rs, since this crate is compiled before and already causes the error. | ||
// It's the only purpose of this build.rs file. If a better solution is found, this file can be removed. | ||
|
||
#[rustfmt::skip] | ||
fn main() { | ||
let mut count = 0; | ||
if cfg!(feature = "api-custom") { count += 1; } | ||
|
||
// [version-sync] [[ | ||
// [line] \tif cfg!(feature = "api-$kebabVersion") { count += 1; } | ||
if cfg!(feature = "api-4-0") { count += 1; } | ||
if cfg!(feature = "api-4-0-1") { count += 1; } | ||
if cfg!(feature = "api-4-0-2") { count += 1; } | ||
if cfg!(feature = "api-4-0-3") { count += 1; } | ||
if cfg!(feature = "api-4-0-4") { count += 1; } | ||
if cfg!(feature = "api-4-1") { count += 1; } | ||
if cfg!(feature = "api-4-1-1") { count += 1; } | ||
if cfg!(feature = "api-4-1-2") { count += 1; } | ||
if cfg!(feature = "api-4-1-3") { count += 1; } | ||
if cfg!(feature = "api-4-1-4") { count += 1; } | ||
if cfg!(feature = "api-4-2") { count += 1; } | ||
if cfg!(feature = "api-4-2-1") { count += 1; } | ||
if cfg!(feature = "api-4-2-2") { count += 1; } | ||
// ]] | ||
|
||
assert!(count <= 1, "ERROR: at most one `api-*` feature can be enabled"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters