From f8f08210fcbdae116206fe9953073321768e106e Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Thu, 3 Oct 2024 22:04:33 -0400 Subject: [PATCH] build(xtask): bump cmake version in `bump-version` --- xtask/src/bump.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/xtask/src/bump.rs b/xtask/src/bump.rs index 02cda499..bd357afc 100644 --- a/xtask/src/bump.rs +++ b/xtask/src/bump.rs @@ -119,6 +119,7 @@ pub fn bump_versions() -> Result<(), Box> { println!("Bumping from {current_version} to {version}"); update_crates(¤t_version, &version)?; update_makefile(&version)?; + update_cmake(&version)?; update_npm(&version)?; update_zig(&version)?; tag_next_version(&repo, &version)?; @@ -146,6 +147,7 @@ fn tag_next_version( "cli/npm/package.json", "lib/binding_web/package.json", "Makefile", + "lib/CMakeLists.txt", "build.zig.zon", ] { index.add_path(Path::new(file))?; @@ -200,6 +202,32 @@ fn update_makefile(next_version: &Version) -> Result<(), Box Result<(), Box> { + let cmake = std::fs::read_to_string("lib/CMakeLists.txt")?; + let cmake = cmake + .lines() + .map(|line| { + if line.contains(" VERSION") { + let start_quote = line.find('"').unwrap(); + let end_quote = line.rfind('"').unwrap(); + format!( + "{}{next_version}{}", + &line[..start_quote + 1], + &line[end_quote..] + ) + } else { + line.to_string() + } + }) + .collect::>() + .join("\n") + + "\n"; + + std::fs::write("lib/CMakeLists.txt", cmake)?; + + Ok(()) +} + fn update_crates( current_version: &Version, next_version: &Version,