Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo.lock is unexpectedly included in packaged library crate #9317

Closed
nazar-pc opened this issue Apr 1, 2021 · 3 comments
Closed

Cargo.lock is unexpectedly included in packaged library crate #9317

nazar-pc opened this issue Apr 1, 2021 · 3 comments
Labels
C-bug Category: bug

Comments

@nazar-pc
Copy link

nazar-pc commented Apr 1, 2021

Problem
The latest update i this topic I found was #7026, which says that Cargo.lock is included by default with executable crates.
However, my crate is not executable, yet I found that it still includes lock file for some reason.

Steps

  1. Clone https://github.com/nazar-pc/mediasoup/tree/1021dc6c13196afe8f47c81ccdfe76f19635c5d8
  2. cd rust
  3. cargo package
  4. Check generated package, it will include Cargo.lock

Possible Solution(s)
Would be nice to not include it I think, especially since root Cargo.lock is excluded in .gitignore.

Notes

Output of cargo version: cargo 1.51.0 (43b129a 2021-03-16)

UPD: Excluding Cargo.lock in Cargo.toml explicitly doesn't seem to have any effect either 🤔

@nazar-pc nazar-pc added the C-bug Category: bug label Apr 1, 2021
@ehuss
Copy link
Contributor

ehuss commented Apr 1, 2021

Your package includes examples, which will trigger the inclusion of Cargo.lock. There shouldn't be any concern for including it, as it is otherwise ignored.

@nazar-pc
Copy link
Author

nazar-pc commented Apr 1, 2021

Hm... but examples don't make crate an executable, there are even separate parameters for them like autobins and autoexamples.
It was discovered accidentally in rust-lang/docs.rs#1338 (comment)
Not a huge issue for sure, but it was certainly surprising to me.

@ehuss
Copy link
Contributor

ehuss commented Jun 2, 2021

This is intended behavior, as examples can be potentially installed with cargo install. Closing as intended behavior, which is documented at https://doc.rust-lang.org/cargo/commands/cargo-package.html, but thanks for opening the issue!

@ehuss ehuss closed this as completed Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants