diff --git a/.changes/change-pr-12270.md b/.changes/change-pr-12270.md new file mode 100644 index 000000000000..9557656d0667 --- /dev/null +++ b/.changes/change-pr-12270.md @@ -0,0 +1,5 @@ +--- +"tauri-build": "patch:bug" +--- + +Update `cargo_toml` to `0.21.0`. This adds compatibility with Rust's 2024 Edition. diff --git a/Cargo.lock b/Cargo.lock index 105805136d46..286b07141c24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1561,9 +1561,9 @@ dependencies = [ [[package]] name = "cargo_toml" -version = "0.17.2" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a969e13a7589e9e3e4207e153bae624ade2b5622fb4684a4923b23ec3d57719" +checksum = "5fbd1fe9db3ebf71b89060adaf7b0504c2d6a425cf061313099547e382c2e472" dependencies = [ "serde", "toml 0.8.19", diff --git a/crates/tauri-build/Cargo.toml b/crates/tauri-build/Cargo.toml index c6a8972b8d62..9738c27b51cc 100644 --- a/crates/tauri-build/Cargo.toml +++ b/crates/tauri-build/Cargo.toml @@ -33,7 +33,7 @@ tauri-utils = { version = "2.1.1", path = "../tauri-utils", features = [ "build", "resources", ] } -cargo_toml = "0.17" +cargo_toml = "0.21" serde = "1" serde_json = "1" heck = "0.5" diff --git a/crates/tauri-build/src/lib.rs b/crates/tauri-build/src/lib.rs index a1dd235ea26c..a4033d76bd2f 100644 --- a/crates/tauri-build/src/lib.rs +++ b/crates/tauri-build/src/lib.rs @@ -506,19 +506,8 @@ pub fn try_build(attributes: Attributes) -> Result<()> { cfg_alias("dev", is_dev()); - let ws_path = get_workspace_dir()?; - let mut manifest = - Manifest::::from_slice_with_metadata(&fs::read("Cargo.toml")?)?; - - if let Ok(ws_manifest) = Manifest::from_path(ws_path.join("Cargo.toml")) { - Manifest::complete_from_path_and_workspace( - &mut manifest, - Path::new("Cargo.toml"), - Some((&ws_manifest, ws_path.as_path())), - )?; - } else { - Manifest::complete_from_path(&mut manifest, Path::new("Cargo.toml"))?; - } + let cargo_toml_path = Path::new("Cargo.toml").canonicalize()?; + let mut manifest = Manifest::::from_path_with_metadata(cargo_toml_path)?; let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); @@ -701,23 +690,3 @@ pub fn try_build(attributes: Attributes) -> Result<()> { Ok(()) } - -#[derive(serde::Deserialize)] -struct CargoMetadata { - workspace_root: PathBuf, -} - -fn get_workspace_dir() -> Result { - let output = std::process::Command::new("cargo") - .args(["metadata", "--no-deps", "--format-version", "1"]) - .output()?; - - if !output.status.success() { - return Err(anyhow::anyhow!( - "cargo metadata command exited with a non zero exit code: {}", - String::from_utf8(output.stderr)? - )); - } - - Ok(serde_json::from_slice::(&output.stdout)?.workspace_root) -} diff --git a/crates/tauri/Cargo.toml b/crates/tauri/Cargo.toml index e7a39710fa7d..d5492ed72195 100644 --- a/crates/tauri/Cargo.toml +++ b/crates/tauri/Cargo.toml @@ -150,7 +150,7 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" tauri = { path = ".", default-features = false, features = ["wry"] } tokio = { version = "1", features = ["full"] } -cargo_toml = "0.17" +cargo_toml = "0.21" http-range = "0.1.5" # macOS