From 155dd0902b370cae17616648945c9ce3ac633955 Mon Sep 17 00:00:00 2001 From: Rasmus Melchior Jacobsen Date: Tue, 17 Oct 2023 07:13:44 +0200 Subject: [PATCH 1/3] Include patch table in manifest This seems to fix #275 --- src/cargo_ops/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cargo_ops/mod.rs b/src/cargo_ops/mod.rs index 32481eb..d72e6d5 100644 --- a/src/cargo_ops/mod.rs +++ b/src/cargo_ops/mod.rs @@ -25,6 +25,8 @@ struct Manifest { #[serde(skip_serializing_if = "Option::is_none")] pub target: Option, pub features: Option, + #[serde(rename = "patch", skip_serializing_if = "Option::is_none")] + pub patch: Option
, } impl Manifest { From 21cccca23e5e44723c639047af4944f847f23f09 Mon Sep 17 00:00:00 2001 From: Rasmus Melchior Jacobsen Date: Tue, 17 Oct 2023 07:22:44 +0200 Subject: [PATCH 2/3] Include manipulation of patches To ensure that e.g. a relative path inside the patch section is updated. --- src/cargo_ops/temp_project.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cargo_ops/temp_project.rs b/src/cargo_ops/temp_project.rs index f4e10a3..e638d4e 100644 --- a/src/cargo_ops/temp_project.rs +++ b/src/cargo_ops/temp_project.rs @@ -258,6 +258,13 @@ impl<'tmp> TempProject<'tmp> { } } } + if let Some(t) = manifest.patch.as_mut() { + for (_key, target) in t.iter_mut() { + if let Value::Table(ref mut patch) = *target { + f(patch)?; + } + } + } Ok(()) } From 312354106d8720eb4ae687e07d18313876c65fad Mon Sep 17 00:00:00 2001 From: Rasmus Melchior Jacobsen Date: Tue, 17 Oct 2023 07:23:56 +0200 Subject: [PATCH 3/3] Rename target to patch --- src/cargo_ops/temp_project.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cargo_ops/temp_project.rs b/src/cargo_ops/temp_project.rs index e638d4e..8bbbe53 100644 --- a/src/cargo_ops/temp_project.rs +++ b/src/cargo_ops/temp_project.rs @@ -259,8 +259,8 @@ impl<'tmp> TempProject<'tmp> { } } if let Some(t) = manifest.patch.as_mut() { - for (_key, target) in t.iter_mut() { - if let Value::Table(ref mut patch) = *target { + for (_key, patch) in t.iter_mut() { + if let Value::Table(ref mut patch) = *patch { f(patch)?; } }