also update build-dependencies

This commit is contained in:
Corwin 2024-09-24 20:25:27 +01:00
parent 49ad674d93
commit 1f6c7157be
No known key found for this signature in database

View file

@ -111,7 +111,7 @@ fn update_to_version(
&[ &[
"agb-*/Cargo.toml", "agb-*/Cargo.toml",
"agb/Cargo.toml", "agb/Cargo.toml",
"tracker/agb-*/Cargo.toml", "tracker/*/Cargo.toml",
"examples/*/Cargo.toml", "examples/*/Cargo.toml",
"book/games/*/Cargo.toml", "book/games/*/Cargo.toml",
"template/Cargo.toml", "template/Cargo.toml",
@ -123,7 +123,13 @@ fn update_to_version(
.parse::<toml_edit::DocumentMut>() .parse::<toml_edit::DocumentMut>()
.map_err(|_| Error::InvalidToml(cargo_toml_file.to_string_lossy().into_owned()))?; .map_err(|_| Error::InvalidToml(cargo_toml_file.to_string_lossy().into_owned()))?;
if let Some(this_dep) = cargo_toml["dependencies"].get_mut(&project_name) { let to_update = ["dependencies", "build-dependencies"];
for kind in to_update {
if let Some(this_dep) = cargo_toml
.get_mut(kind)
.and_then(|x| x.get_mut(&project_name))
{
match this_dep { match this_dep {
toml_edit::Item::Value(s @ toml_edit::Value::String(_)) => { toml_edit::Item::Value(s @ toml_edit::Value::String(_)) => {
*s = new_version.clone().into() *s = new_version.clone().into()
@ -141,6 +147,7 @@ fn update_to_version(
} }
} }
} }
}
std::fs::write(cargo_toml_file, cargo_toml.to_string()) std::fs::write(cargo_toml_file, cargo_toml.to_string())
.map_err(|_| Error::WriteTomlFile)?; .map_err(|_| Error::WriteTomlFile)?;