-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[WIP] Accessing each build script's OUT_DIR
#15891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,7 @@ pub(super) fn to_targets( | |
if metabuild.is_some() { | ||
anyhow::bail!("cannot specify both `metabuild` and `build`"); | ||
} | ||
validate_unique_build_scripts(custom_build)?; | ||
for script in custom_build { | ||
let script_path = Path::new(script); | ||
let name = format!( | ||
|
@@ -901,6 +902,22 @@ fn validate_unique_names(targets: &[TomlTarget], target_kind: &str) -> CargoResu | |
Ok(()) | ||
} | ||
|
||
/// Will check a list of build scripts, and make sure script file stems are unique within a vector. | ||
fn validate_unique_build_scripts(scripts: &[String]) -> CargoResult<()> { | ||
let mut seen = HashSet::new(); | ||
for script in scripts { | ||
let stem = Path::new(script).file_stem().unwrap().to_str().unwrap(); | ||
if !seen.insert(stem) { | ||
anyhow::bail!( | ||
"found duplicate build script file stem {}, \ | ||
but all build scripts must have a unique file stem", | ||
stem | ||
); | ||
} | ||
Comment on lines
+911
to
+916
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we gather this into a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I was just following how earlier |
||
} | ||
Ok(()) | ||
} | ||
|
||
fn configure( | ||
toml: &TomlTarget, | ||
target: &mut Target, | ||
|
Uh oh!
There was an error while loading. Please reload this page.