Skip to content

Commit 94004f8

Browse files
committed
Attach all build scripts to the target
1 parent b68356b commit 94004f8

File tree

2 files changed

+290
-57
lines changed

2 files changed

+290
-57
lines changed

src/cargo/util/toml/targets.rs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,21 @@ pub(super) fn to_targets(
105105
if metabuild.is_some() {
106106
anyhow::bail!("cannot specify both `metabuild` and `build`");
107107
}
108-
if custom_build.len() > 1 {
109-
anyhow::bail!("multiple build scripts feature is not implemented yet! ")
108+
for script in custom_build {
109+
let script_path = Path::new(script);
110+
let name = format!(
111+
"build-script-{}",
112+
script_path
113+
.file_stem()
114+
.and_then(|s| s.to_str())
115+
.unwrap_or("")
116+
);
117+
targets.push(Target::custom_build_target(
118+
&name,
119+
package_root.join(script_path),
120+
edition,
121+
));
110122
}
111-
let custom_build = Path::new(&custom_build[0]);
112-
let name = format!(
113-
"build-script-{}",
114-
custom_build
115-
.file_stem()
116-
.and_then(|s| s.to_str())
117-
.unwrap_or("")
118-
);
119-
targets.push(Target::custom_build_target(
120-
&name,
121-
package_root.join(custom_build),
122-
edition,
123-
));
124123
}
125124
if let Some(metabuild) = metabuild {
126125
// Verify names match available build deps.
@@ -1107,9 +1106,7 @@ pub fn normalize_build(
11071106
Some(TomlPackageBuild::Auto(true)) => {
11081107
Ok(Some(TomlPackageBuild::SingleScript(BUILD_RS.to_owned())))
11091108
}
1110-
Some(TomlPackageBuild::MultipleScript(_scripts)) => {
1111-
anyhow::bail!("multiple build scripts feature is not implemented yet!");
1112-
}
1109+
Some(TomlPackageBuild::MultipleScript(_scripts)) => Ok(build.cloned()),
11131110
}
11141111
}
11151112

0 commit comments

Comments
 (0)