Skip to content

Commit

Permalink
Fix release script (#766)
Browse files Browse the repository at this point in the history
Causes the release script to update build-dependencies and the desktop
tracker

- [x] no changelog update needed
  • Loading branch information
corwinkuiper committed Sep 24, 2024
2 parents 49ad674 + 1f6c715 commit dd5ab9b
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions tools/src/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn update_to_version(
&[
"agb-*/Cargo.toml",
"agb/Cargo.toml",
"tracker/agb-*/Cargo.toml",
"tracker/*/Cargo.toml",
"examples/*/Cargo.toml",
"book/games/*/Cargo.toml",
"template/Cargo.toml",
Expand All @@ -123,21 +123,28 @@ fn update_to_version(
.parse::<toml_edit::DocumentMut>()
.map_err(|_| Error::InvalidToml(cargo_toml_file.to_string_lossy().into_owned()))?;

if let Some(this_dep) = cargo_toml["dependencies"].get_mut(&project_name) {
match this_dep {
toml_edit::Item::Value(s @ toml_edit::Value::String(_)) => {
*s = new_version.clone().into()
}
toml_edit::Item::Value(toml_edit::Value::InlineTable(t)) => {
t["version"] = new_version.clone().into()
}
toml_edit::Item::None => continue,
_ => {
return Err(Error::InvalidToml(format!(
"{:?} while searching dependencies in {}",
this_dep,
cargo_toml_file.to_string_lossy()
)))
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 {
toml_edit::Item::Value(s @ toml_edit::Value::String(_)) => {
*s = new_version.clone().into()
}
toml_edit::Item::Value(toml_edit::Value::InlineTable(t)) => {
t["version"] = new_version.clone().into()
}
toml_edit::Item::None => continue,
_ => {
return Err(Error::InvalidToml(format!(
"{:?} while searching dependencies in {}",
this_dep,
cargo_toml_file.to_string_lossy()
)))
}
}
}
}
Expand Down

0 comments on commit dd5ab9b

Please sign in to comment.