Skip to content

artifact-dependencies seems to build both cdylib and staticlib when only one is specified #12109

Closed
@ehuss

Description

@ehuss

Problem

When an artifact dependency specifies artifact='staticlib', and the dependency declares its crate type as ["staticlib", "cdylib"], cargo will build both the staticlib and cdylib separately. I would expect it to only build the staticlib.

Steps

Create a project with an artifact dependency:

[package]
name = "foo"
version = "0.1.0"
edition = "2021"

[dependencies]
bar = {path = "bar", artifact = "staticlib"}

and in the bar dependency, specify it with multiple crate types:

[package]
name = "bar"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["staticlib", "cdylib"]

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.71.0-nightly (569b648b5 2023-05-05)
release: 1.71.0-nightly
commit-hash: 569b648b5831ae8a515e90c80843a5287c3304ef
commit-date: 2023-05-05
host: aarch64-apple-darwin
libgit2: 1.6.3 (sys:0.17.0 vendored)
libcurl: 7.87.0 (sys:0.4.61+curl-8.0.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1t  7 Feb 2023
os: Mac OS 13.3.1 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.Z-bindepsNightly: binary artifact dependencies

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions