Description
Problem
Context is: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/499
The setup here is a workspace with multiple cdylib/staticlib/rlib crates. When publishing them, the ones with an example or binary will have their Cargo.lock included in the package, the others not:
/// Returns if package should include `Cargo.lock`.
pub fn include_lockfile(&self) -> bool {
self.targets().iter().any(|t| t.is_example() || t.is_bin())
}
This seems a bit arbitrary in this situation. Some of the crates have examples, some not 🤷
In practice this causes problems if people get the crates from crates.io and try to build the cdylib/staticlib, e.g. via cargo-c, and use --frozen
to ensure that the same Cargo.lock
is used as during publishing.
Steps
- Create a cdylib crate
cargo publish --dry-run
and check whether theCargo.lock is included in
target/package` (it is not)- Add an example to the crate
cargo publish --dry-run
and check whether theCargo.lock is included in
target/package` (it is included now)
Possible Solution(s)
I would suggest to update the heuristic above to either include cdylib/staticlib crates, and/or to provide some kind of configuration in Cargo.toml
whether the Cargo.lock
should be included or not.
If something is decided, I'd be happy to implement this.
Notes
No response
Version
cargo 1.76.0 (c84b36747 2024-01-18)
release: 1.76.0
commit-hash: c84b367471a2db61d2c2c6aab605b14130b8a31b
commit-date: 2024-01-18
host: x86_64-unknown-linux-gnu
libgit2: 1.7.1 (sys:0.18.1 vendored)
libcurl: 8.5.0-DEV (sys:0.4.70+curl-8.5.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Fedora 39.0.0 [64-bit]