in build2cmake/src/main.rs [189:210]
fn update_build(build_toml: PathBuf) -> Result<()> {
let build_compat: BuildCompat = parse_and_validate(&build_toml)?;
if matches!(build_compat, BuildCompat::V2(_)) {
return Ok(());
}
let build: Build = build_compat
.try_into()
.context("Cannot update build configuration")?;
let pretty_toml = toml::to_string_pretty(&build)?;
let mut writer =
BufWriter::new(File::create(&build_toml).wrap_err_with(|| {
format!("Cannot open {} for writing", build_toml.to_string_lossy())
})?);
writer
.write_all(pretty_toml.as_bytes())
.wrap_err_with(|| format!("Cannot write to {}", build_toml.to_string_lossy()))?;
Ok(())
}