Skip to content

Commit 848d0e0

Browse files
aureljFabianLars
andauthored
chore(deps): update cargo_toml for edition 2024 [fix #10412] (#12270)
Co-authored-by: Fabian-Lars <github@fabianlars.de>
1 parent ae75a35 commit 848d0e0

5 files changed

Lines changed: 11 additions & 37 deletions

File tree

.changes/change-pr-12270.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-build": "patch:bug"
3+
---
4+
5+
Update `cargo_toml` to `0.21.0`. This adds compatibility with Rust's 2024 Edition.

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tauri-build/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ tauri-utils = { version = "2.1.1", path = "../tauri-utils", features = [
3333
"build",
3434
"resources",
3535
] }
36-
cargo_toml = "0.17"
36+
cargo_toml = "0.21"
3737
serde = "1"
3838
serde_json = "1"
3939
heck = "0.5"

crates/tauri-build/src/lib.rs

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -506,19 +506,8 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
506506

507507
cfg_alias("dev", is_dev());
508508

509-
let ws_path = get_workspace_dir()?;
510-
let mut manifest =
511-
Manifest::<cargo_toml::Value>::from_slice_with_metadata(&fs::read("Cargo.toml")?)?;
512-
513-
if let Ok(ws_manifest) = Manifest::from_path(ws_path.join("Cargo.toml")) {
514-
Manifest::complete_from_path_and_workspace(
515-
&mut manifest,
516-
Path::new("Cargo.toml"),
517-
Some((&ws_manifest, ws_path.as_path())),
518-
)?;
519-
} else {
520-
Manifest::complete_from_path(&mut manifest, Path::new("Cargo.toml"))?;
521-
}
509+
let cargo_toml_path = Path::new("Cargo.toml").canonicalize()?;
510+
let mut manifest = Manifest::<cargo_toml::Value>::from_path_with_metadata(cargo_toml_path)?;
522511

523512
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
524513

@@ -701,23 +690,3 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
701690

702691
Ok(())
703692
}
704-
705-
#[derive(serde::Deserialize)]
706-
struct CargoMetadata {
707-
workspace_root: PathBuf,
708-
}
709-
710-
fn get_workspace_dir() -> Result<PathBuf> {
711-
let output = std::process::Command::new("cargo")
712-
.args(["metadata", "--no-deps", "--format-version", "1"])
713-
.output()?;
714-
715-
if !output.status.success() {
716-
return Err(anyhow::anyhow!(
717-
"cargo metadata command exited with a non zero exit code: {}",
718-
String::from_utf8(output.stderr)?
719-
));
720-
}
721-
722-
Ok(serde_json::from_slice::<CargoMetadata>(&output.stdout)?.workspace_root)
723-
}

crates/tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ serde = { version = "1", features = ["derive"] }
150150
serde_json = "1"
151151
tauri = { path = ".", default-features = false, features = ["wry"] }
152152
tokio = { version = "1", features = ["full"] }
153-
cargo_toml = "0.17"
153+
cargo_toml = "0.21"
154154
http-range = "0.1.5"
155155

156156
# macOS

0 commit comments

Comments
 (0)