Skip to content

Commit

Permalink
Avoid 'duplicate package' warnings when depending on cbindgen via git
Browse files Browse the repository at this point in the history
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 rust-lang/cargo#10752),
but while a fix is being considered for Cargo, this commit disambiguates the
duplicated package names by referring to their relative paths.
  • Loading branch information
irh authored and emilio committed May 31, 2023
1 parent c8546ad commit 6165bbf
Show file tree
Hide file tree
Showing 25 changed files with 56 additions and 46 deletions.
12 changes: 7 additions & 5 deletions tests/rust/dep_v2/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions 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" }
2 changes: 1 addition & 1 deletion tests/rust/dep_v2/cbindgen.toml
@@ -1,3 +1,3 @@
[parse]
parse_deps = true
include = ["dep"]
include = ["dep-2-dep"]
2 changes: 1 addition & 1 deletion 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"
Expand Down
2 changes: 1 addition & 1 deletion 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 {
Expand Down
5 changes: 3 additions & 2 deletions tests/rust/expand_default_features/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/rust/expand_default_features/Cargo.toml
@@ -1,5 +1,5 @@
[package]
name = "expand"
name = "expand-default-features"
version = "0.1.0"
authors = ["cbindgen"]

Expand Down
2 changes: 1 addition & 1 deletion 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
14 changes: 8 additions & 6 deletions tests/rust/expand_dep_v2/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/rust/expand_dep_v2/Cargo.toml
Expand Up @@ -6,4 +6,4 @@ edition = "2018"

[dependencies]
expand-dep = { path = "../expand_dep" }
dep = { path = "dep_v2" }
expand-dep-2-dep-2 = { path = "dep_v2" }
2 changes: 1 addition & 1 deletion 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"
Expand Down
2 changes: 1 addition & 1 deletion 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"
Expand Down
5 changes: 3 additions & 2 deletions tests/rust/expand_features/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/rust/expand_features/Cargo.toml
@@ -1,5 +1,5 @@
[package]
name = "expand"
name = "expand-features"
version = "0.1.0"
authors = ["cbindgen"]

Expand Down
5 changes: 3 additions & 2 deletions tests/rust/expand_no_default_features/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 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"]

Expand Down
2 changes: 1 addition & 1 deletion 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
2 changes: 1 addition & 1 deletion tests/rust/external_workspace_child/Cargo.toml
Expand Up @@ -4,5 +4,5 @@ version = "0.1.0"
authors = ["cbindgen"]
workspace = "../workspace"

[dependencies.dep]
[dependencies.workspace-dep]
path = "../workspace/dep"
2 changes: 1 addition & 1 deletion 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) {
Expand Down
10 changes: 6 additions & 4 deletions tests/rust/literal_target/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/rust/literal_target/Cargo.toml
Expand Up @@ -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" }
13 changes: 7 additions & 6 deletions tests/rust/workspace/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/rust/workspace/Cargo.toml
Expand Up @@ -3,7 +3,7 @@ name = "workspace"
version = "0.1.0"
authors = ["cbindgen"]

[dependencies.dep]
[dependencies.workspace-dep]
path = "dep"

[workspace]
Expand Down
2 changes: 1 addition & 1 deletion tests/rust/workspace/cbindgen.toml
@@ -1,3 +1,3 @@
[parse]
parse_deps = true
extra_bindings = ["dep"]
extra_bindings = ["workspace-dep"]
2 changes: 1 addition & 1 deletion tests/rust/workspace/dep/Cargo.toml
@@ -1,5 +1,5 @@
[package]
name = "dep"
name = "workspace-dep"
version = "0.1.0"
authors = ["cbindgen"]

Expand Down

0 comments on commit 6165bbf

Please sign in to comment.