From 6165bbf02119e8da22def8fa73656b9d5290e04b Mon Sep 17 00:00:00 2001 From: Ian Hobson Date: Thu, 13 Apr 2023 10:32:05 +0200 Subject: [PATCH] Avoid 'duplicate package' warnings when depending on cbindgen via git When specifying `cbindgen` as a dependency via git, several 'skipping duplicate package' warnings pop up regarding some of the test crates. The warning seems to be spurious given that the test packages aren't needed when depending on `cbindgen` (see https://github.com/rust-lang/cargo/issues/10752), but while a fix is being considered for Cargo, this commit disambiguates the duplicated package names by referring to their relative paths. --- tests/rust/dep_v2/Cargo.lock | 12 +++++++----- tests/rust/dep_v2/Cargo.toml | 4 ++-- tests/rust/dep_v2/cbindgen.toml | 2 +- tests/rust/dep_v2/dep/Cargo.toml | 2 +- tests/rust/dep_v2/src/lib.rs | 2 +- tests/rust/expand_default_features/Cargo.lock | 7 ++++--- tests/rust/expand_default_features/Cargo.toml | 2 +- tests/rust/expand_default_features/cbindgen.toml | 2 +- tests/rust/expand_dep_v2/Cargo.lock | 14 ++++++++------ tests/rust/expand_dep_v2/Cargo.toml | 2 +- tests/rust/expand_dep_v2/dep/Cargo.toml | 2 +- tests/rust/expand_dep_v2/dep_v2/Cargo.toml | 2 +- tests/rust/expand_features/Cargo.lock | 7 ++++--- tests/rust/expand_features/Cargo.toml | 2 +- tests/rust/expand_no_default_features/Cargo.lock | 7 ++++--- tests/rust/expand_no_default_features/Cargo.toml | 2 +- .../rust/expand_no_default_features/cbindgen.toml | 2 +- tests/rust/external_workspace_child/Cargo.toml | 2 +- tests/rust/external_workspace_child/src/lib.rs | 2 +- tests/rust/literal_target/Cargo.lock | 10 ++++++---- tests/rust/literal_target/Cargo.toml | 2 +- tests/rust/workspace/Cargo.lock | 13 +++++++------ tests/rust/workspace/Cargo.toml | 2 +- tests/rust/workspace/cbindgen.toml | 2 +- tests/rust/workspace/dep/Cargo.toml | 2 +- 25 files changed, 59 insertions(+), 49 deletions(-) diff --git a/tests/rust/dep_v2/Cargo.lock b/tests/rust/dep_v2/Cargo.lock index 8019bb0..a5a18d9 100644 --- a/tests/rust/dep_v2/Cargo.lock +++ b/tests/rust/dep_v2/Cargo.lock @@ -1,12 +1,14 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "dep" -version = "0.1.0" +version = 3 [[package]] -name = "expand-dep" +name = "dep-2" version = "0.1.0" dependencies = [ - "dep", + "dep-2-dep", ] + +[[package]] +name = "dep-2-dep" +version = "0.1.0" diff --git a/tests/rust/dep_v2/Cargo.toml b/tests/rust/dep_v2/Cargo.toml index 40e3e8b..df0679a 100644 --- a/tests/rust/dep_v2/Cargo.toml +++ b/tests/rust/dep_v2/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "expand-dep" +name = "dep-2" version = "0.1.0" authors = ["cbindgen"] edition = "2018" [dependencies] -dep = { path = "dep" } +dep-2-dep = { path = "dep" } diff --git a/tests/rust/dep_v2/cbindgen.toml b/tests/rust/dep_v2/cbindgen.toml index ac9c278..fc79487 100644 --- a/tests/rust/dep_v2/cbindgen.toml +++ b/tests/rust/dep_v2/cbindgen.toml @@ -1,3 +1,3 @@ [parse] parse_deps = true -include = ["dep"] +include = ["dep-2-dep"] diff --git a/tests/rust/dep_v2/dep/Cargo.toml b/tests/rust/dep_v2/dep/Cargo.toml index 1cc8d62..dbf5cef 100644 --- a/tests/rust/dep_v2/dep/Cargo.toml +++ b/tests/rust/dep_v2/dep/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "dep" +name = "dep-2-dep" version = "0.1.0" authors = ["cbindgen"] edition = "2018" diff --git a/tests/rust/dep_v2/src/lib.rs b/tests/rust/dep_v2/src/lib.rs index 639678d..fad267c 100644 --- a/tests/rust/dep_v2/src/lib.rs +++ b/tests/rust/dep_v2/src/lib.rs @@ -1,4 +1,4 @@ -use dep::dep_struct; +use dep_2_dep::dep_struct; #[no_mangle] pub unsafe extern "C" fn get_x(dep_struct: *const dep_struct) -> u32 { diff --git a/tests/rust/expand_default_features/Cargo.lock b/tests/rust/expand_default_features/Cargo.lock index 817860e..971ff12 100644 --- a/tests/rust/expand_default_features/Cargo.lock +++ b/tests/rust/expand_default_features/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "expand" -version = "0.1.0" +version = 3 +[[package]] +name = "expand-default-features" +version = "0.1.0" diff --git a/tests/rust/expand_default_features/Cargo.toml b/tests/rust/expand_default_features/Cargo.toml index 98a968d..a33c620 100644 --- a/tests/rust/expand_default_features/Cargo.toml +++ b/tests/rust/expand_default_features/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "expand" +name = "expand-default-features" version = "0.1.0" authors = ["cbindgen"] diff --git a/tests/rust/expand_default_features/cbindgen.toml b/tests/rust/expand_default_features/cbindgen.toml index 5741ca7..8489c1d 100644 --- a/tests/rust/expand_default_features/cbindgen.toml +++ b/tests/rust/expand_default_features/cbindgen.toml @@ -1,5 +1,5 @@ [parse] parse_deps = false [parse.expand] -crates = ["expand"] +crates = ["expand-default-features"] all_features = false diff --git a/tests/rust/expand_dep_v2/Cargo.lock b/tests/rust/expand_dep_v2/Cargo.lock index 5e12ed6..e1477d5 100644 --- a/tests/rust/expand_dep_v2/Cargo.lock +++ b/tests/rust/expand_dep_v2/Cargo.lock @@ -1,24 +1,26 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "dep" -version = "0.1.0" +version = 3 [[package]] name = "dep" -version = "0.2.0" +version = "0.1.0" [[package]] name = "expand-dep" version = "0.1.0" dependencies = [ - "dep 0.1.0", + "dep", ] [[package]] name = "expand-dep-2" version = "0.2.0" dependencies = [ - "dep 0.2.0", "expand-dep", + "expand-dep-2-dep-2", ] + +[[package]] +name = "expand-dep-2-dep-2" +version = "0.2.0" diff --git a/tests/rust/expand_dep_v2/Cargo.toml b/tests/rust/expand_dep_v2/Cargo.toml index fbfeb8a..719b178 100644 --- a/tests/rust/expand_dep_v2/Cargo.toml +++ b/tests/rust/expand_dep_v2/Cargo.toml @@ -6,4 +6,4 @@ edition = "2018" [dependencies] expand-dep = { path = "../expand_dep" } -dep = { path = "dep_v2" } +expand-dep-2-dep-2 = { path = "dep_v2" } diff --git a/tests/rust/expand_dep_v2/dep/Cargo.toml b/tests/rust/expand_dep_v2/dep/Cargo.toml index 1cc8d62..4ccc092 100644 --- a/tests/rust/expand_dep_v2/dep/Cargo.toml +++ b/tests/rust/expand_dep_v2/dep/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "dep" +name = "expand-dep-2-dep" version = "0.1.0" authors = ["cbindgen"] edition = "2018" diff --git a/tests/rust/expand_dep_v2/dep_v2/Cargo.toml b/tests/rust/expand_dep_v2/dep_v2/Cargo.toml index fe52e95..96e63ad 100644 --- a/tests/rust/expand_dep_v2/dep_v2/Cargo.toml +++ b/tests/rust/expand_dep_v2/dep_v2/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "dep" +name = "expand-dep-2-dep-2" version = "0.2.0" authors = ["cbindgen"] edition = "2018" diff --git a/tests/rust/expand_features/Cargo.lock b/tests/rust/expand_features/Cargo.lock index 817860e..f463f3d 100644 --- a/tests/rust/expand_features/Cargo.lock +++ b/tests/rust/expand_features/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "expand" -version = "0.1.0" +version = 3 +[[package]] +name = "expand-features" +version = "0.1.0" diff --git a/tests/rust/expand_features/Cargo.toml b/tests/rust/expand_features/Cargo.toml index f1dc6d4..eca9596 100644 --- a/tests/rust/expand_features/Cargo.toml +++ b/tests/rust/expand_features/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "expand" +name = "expand-features" version = "0.1.0" authors = ["cbindgen"] diff --git a/tests/rust/expand_no_default_features/Cargo.lock b/tests/rust/expand_no_default_features/Cargo.lock index 817860e..7aa897a 100644 --- a/tests/rust/expand_no_default_features/Cargo.lock +++ b/tests/rust/expand_no_default_features/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "expand" -version = "0.1.0" +version = 3 +[[package]] +name = "expand-no-default-features" +version = "0.1.0" diff --git a/tests/rust/expand_no_default_features/Cargo.toml b/tests/rust/expand_no_default_features/Cargo.toml index 98a968d..678fea2 100644 --- a/tests/rust/expand_no_default_features/Cargo.toml +++ b/tests/rust/expand_no_default_features/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "expand" +name = "expand-no-default-features" version = "0.1.0" authors = ["cbindgen"] diff --git a/tests/rust/expand_no_default_features/cbindgen.toml b/tests/rust/expand_no_default_features/cbindgen.toml index 53b00d9..ed4a6d2 100644 --- a/tests/rust/expand_no_default_features/cbindgen.toml +++ b/tests/rust/expand_no_default_features/cbindgen.toml @@ -1,5 +1,5 @@ [parse] parse_deps = false [parse.expand] -crates = ["expand"] +crates = ["expand-no-default-features"] default_features = false diff --git a/tests/rust/external_workspace_child/Cargo.toml b/tests/rust/external_workspace_child/Cargo.toml index 34e0738..98c68a3 100644 --- a/tests/rust/external_workspace_child/Cargo.toml +++ b/tests/rust/external_workspace_child/Cargo.toml @@ -4,5 +4,5 @@ version = "0.1.0" authors = ["cbindgen"] workspace = "../workspace" -[dependencies.dep] +[dependencies.workspace-dep] path = "../workspace/dep" diff --git a/tests/rust/external_workspace_child/src/lib.rs b/tests/rust/external_workspace_child/src/lib.rs index 0b7e549..494ac13 100644 --- a/tests/rust/external_workspace_child/src/lib.rs +++ b/tests/rust/external_workspace_child/src/lib.rs @@ -1,4 +1,4 @@ -extern crate dep; +extern crate workspace_dep; #[no_mangle] pub extern "C" fn consume_ext(_ext: dep::ExtType) { diff --git a/tests/rust/literal_target/Cargo.lock b/tests/rust/literal_target/Cargo.lock index a81869d..c9542e0 100644 --- a/tests/rust/literal_target/Cargo.lock +++ b/tests/rust/literal_target/Cargo.lock @@ -1,12 +1,14 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "dep" -version = "0.1.0" +version = 3 [[package]] name = "literal_target" version = "0.1.0" dependencies = [ - "dep", + "workspace-dep", ] + +[[package]] +name = "workspace-dep" +version = "0.1.0" diff --git a/tests/rust/literal_target/Cargo.toml b/tests/rust/literal_target/Cargo.toml index 60a69cb..b4804b4 100644 --- a/tests/rust/literal_target/Cargo.toml +++ b/tests/rust/literal_target/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" authors = ["cbindgen"] [target.x86_64-pc-windows-gnu.dependencies] -dep = { path = "../workspace/dep" } +workspace-dep = { path = "../workspace/dep" } diff --git a/tests/rust/workspace/Cargo.lock b/tests/rust/workspace/Cargo.lock index 1e9e0a2..5934423 100644 --- a/tests/rust/workspace/Cargo.lock +++ b/tests/rust/workspace/Cargo.lock @@ -1,20 +1,21 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "child" version = "0.1.0" dependencies = [ - "dep 0.1.0", + "workspace-dep", ] -[[package]] -name = "dep" -version = "0.1.0" - [[package]] name = "workspace" version = "0.1.0" dependencies = [ - "dep 0.1.0", + "workspace-dep", ] +[[package]] +name = "workspace-dep" +version = "0.1.0" diff --git a/tests/rust/workspace/Cargo.toml b/tests/rust/workspace/Cargo.toml index cf67e02..a6eb074 100644 --- a/tests/rust/workspace/Cargo.toml +++ b/tests/rust/workspace/Cargo.toml @@ -3,7 +3,7 @@ name = "workspace" version = "0.1.0" authors = ["cbindgen"] -[dependencies.dep] +[dependencies.workspace-dep] path = "dep" [workspace] diff --git a/tests/rust/workspace/cbindgen.toml b/tests/rust/workspace/cbindgen.toml index d2fea7e..120f788 100644 --- a/tests/rust/workspace/cbindgen.toml +++ b/tests/rust/workspace/cbindgen.toml @@ -1,3 +1,3 @@ [parse] parse_deps = true -extra_bindings = ["dep"] +extra_bindings = ["workspace-dep"] diff --git a/tests/rust/workspace/dep/Cargo.toml b/tests/rust/workspace/dep/Cargo.toml index 388d431..4aada74 100644 --- a/tests/rust/workspace/dep/Cargo.toml +++ b/tests/rust/workspace/dep/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "dep" +name = "workspace-dep" version = "0.1.0" authors = ["cbindgen"]