the-lean-crate / cargo-diet

A cargo-companion to become a 'lean crate' (a member of The Lean Crate Initiative)
https://github.com/the-lean-crate/criner
MIT License
154 stars 3 forks source link

Cargo include directive mis-interpretation #6

Closed darnuria closed 4 years ago

darnuria commented 4 years ago

Hello thanks for the tool!

I am not sure but It look like there is an issue with include directives in cargo or in their interpretation in cargo diet

I added theses lines in the https://github.com/mongodb/bson-rust/pull/203 crate like suggested by cargo diet:

include = [
    "Cargo.toml",
    "src/**/*",
    "LICENSE",
    "README.md",
    "!**/tests/*"
]

In this case only the first files in src/tests will be not included.

And tests files in sub-folders of src/tests are still in the package under src after a cargo publish --dry-run

the rule: "!**/tests/**/*" seems to do the trick.

But cargo-diet analysis seems happy.

Byron commented 4 years ago

Thanks so much for reporting! This definitely is a bug, and I wasn't aware until now. Will take a look right away!

Byron commented 4 years ago

Fixed with v1.1.5 .

It's so great to see cargo-diet being picked up and used. And even though in the end maintainers may prefer a different way of writing the globs, at least it gets the conversation started and makes it easy to see the potential for slimming down a crate.

darnuria commented 4 years ago

Thanks, nice tool to check size usage by files, looking "by hand" in target/package is not straight forward. Have a nice weekend.

Byron commented 4 years ago

I was quite inspired by the idea of actually listing files in the crate, so in cargo-diet 1.2.0, there is now a new --list flag which does just that. It works in conjunction with the other flags, and really just dumps the last N biggest entries in the crate.