Added
Link Here
|
0 |
- |
1 |
https://github.com/juspay/hyperswitch/issues/4137 |
|
|
2 |
https://github.com/juspay/hyperswitch/pull/4139 |
3 |
https://github.com/juspay/hyperswitch/commit/8f7d9fbc3a002127e220d8a968a6a4e15796e2fd |
4 |
|
5 |
--- Cargo.lock.orig 2024-01-05 07:20:19 UTC |
6 |
+++ Cargo.lock |
7 |
@@ -1455,9 +1455,9 @@ dependencies = [ |
8 |
|
9 |
[[package]] |
10 |
name = "cargo_metadata" |
11 |
-version = "0.15.4" |
12 |
+version = "0.18.1" |
13 |
source = "registry+https://github.com/rust-lang/crates.io-index" |
14 |
-checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" |
15 |
+checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" |
16 |
dependencies = [ |
17 |
"camino", |
18 |
"cargo-platform", |
19 |
@@ -5169,7 +5169,7 @@ dependencies = [ |
20 |
name = "router_env" |
21 |
version = "0.1.0" |
22 |
dependencies = [ |
23 |
- "cargo_metadata 0.15.4", |
24 |
+ "cargo_metadata 0.18.1", |
25 |
"config", |
26 |
"error-stack", |
27 |
"gethostname", |
28 |
--- crates/router_env/Cargo.toml.orig 2024-01-05 07:20:19 UTC |
29 |
+++ crates/router_env/Cargo.toml |
30 |
@@ -8,7 +8,7 @@ readme = "README.md" |
31 |
license.workspace = true |
32 |
|
33 |
[dependencies] |
34 |
-cargo_metadata = "0.15.4" |
35 |
+cargo_metadata = "0.18.1" |
36 |
config = { version = "0.13.3", features = ["toml"] } |
37 |
error-stack = "0.3.1" |
38 |
gethostname = "0.4.3" |
39 |
@@ -34,7 +34,7 @@ vergen = { version = "8.2.1", optional = true, feature |
40 |
tokio = { version = "1.28.2", features = ["macros", "rt-multi-thread"] } |
41 |
|
42 |
[build-dependencies] |
43 |
-cargo_metadata = "0.15.4" |
44 |
+cargo_metadata = "0.18.1" |
45 |
vergen = { version = "8.2.1", features = ["cargo", "git", "git2", "rustc"], optional = true } |
46 |
|
47 |
[features] |
48 |
--- crates/router_env/src/cargo_workspace.rs.orig 2024-01-05 07:20:19 UTC |
49 |
+++ crates/router_env/src/cargo_workspace.rs |
50 |
@@ -14,17 +14,11 @@ pub fn set_cargo_workspace_members_env() { |
51 |
let metadata = cargo_metadata::MetadataCommand::new() |
52 |
.exec() |
53 |
.expect("Failed to obtain cargo metadata"); |
54 |
- let workspace_members = metadata.workspace_members; |
55 |
|
56 |
- let workspace_members = workspace_members |
57 |
+ let workspace_members = metadata |
58 |
+ .workspace_packages() |
59 |
.iter() |
60 |
- .map(|package_id| { |
61 |
- package_id |
62 |
- .repr |
63 |
- .split_once(' ') |
64 |
- .expect("Unknown cargo metadata package ID format") |
65 |
- .0 |
66 |
- }) |
67 |
+ .map(|package| package.name.as_str()) |
68 |
.collect::<Vec<_>>() |
69 |
.join(","); |
70 |
|
71 |
@@ -35,7 +29,7 @@ pub fn set_cargo_workspace_members_env() { |
72 |
.expect("Failed to set `CARGO_WORKSPACE_MEMBERS` environment variable"); |
73 |
} |
74 |
|
75 |
-/// Verify that the cargo metadata workspace members format matches that expected by |
76 |
+/// Verify that the cargo metadata workspace packages format matches that expected by |
77 |
/// [`set_cargo_workspace_members_env`] to set the `CARGO_WORKSPACE_MEMBERS` environment variable. |
78 |
/// |
79 |
/// This function should be typically called within build scripts, before the |
80 |
@@ -43,24 +37,20 @@ pub fn set_cargo_workspace_members_env() { |
81 |
/// |
82 |
/// # Panics |
83 |
/// |
84 |
-/// Panics if running the `cargo metadata` command fails, or if the workspace members package ID |
85 |
-/// format cannot be determined. |
86 |
+/// Panics if running the `cargo metadata` command fails, or if the workspace member package names |
87 |
+/// cannot be determined. |
88 |
pub fn verify_cargo_metadata_format() { |
89 |
#[allow(clippy::expect_used)] |
90 |
let metadata = cargo_metadata::MetadataCommand::new() |
91 |
.exec() |
92 |
.expect("Failed to obtain cargo metadata"); |
93 |
- let workspace_members = metadata.workspace_members; |
94 |
|
95 |
- let package_id_entry_prefix = |
96 |
- format!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); |
97 |
assert!( |
98 |
- workspace_members |
99 |
+ metadata |
100 |
+ .workspace_packages() |
101 |
.iter() |
102 |
- .any(|package_id| package_id.repr.starts_with(&package_id_entry_prefix)), |
103 |
- "Unknown workspace members package ID format. \ |
104 |
- Please run `cargo metadata --format-version=1 | jq '.workspace_members'` and update this \ |
105 |
- build script to match the updated package ID format." |
106 |
+ .any(|package| package.name == env!("CARGO_PKG_NAME")), |
107 |
+ "Unable to determine workspace member package names from `cargo metadata`" |
108 |
); |
109 |
} |
110 |
|