hsivonen / encoding_rs

A Gecko-oriented implementation of the Encoding Standard in Rust
https://docs.rs/encoding_rs/
Other
379 stars 55 forks source link

Add explicit `include` to `Cargo.toml` #69

Open XAMPPRocky opened 3 years ago

XAMPPRocky commented 3 years ago

I noticed that encoding-rs is the largest download in my crate graph at 1.4MB. While relatively it's not a lot, this could reduced significantly, by just adding a include to the Cargo.toml and only including what is needed to build the crate with the licence and copyright. I'm not too familiar with the project structure so there might more needed but this seems like everything.

include = [
    "COPYRIGHT",
    "LICENSE-APACHE",
    "LICENSE-MIT",
    "build.rs",
    "src/**/*",
]
hsivonen commented 3 years ago

The other stuff is needed for running cargo test. I'm not sure what the expectations are / etiquette is regarding publishing everything that's needed for running tests to crates.io.

XAMPPRocky commented 3 years ago

I don't think you need to supply what's needed for cargo test. You can never run a dependencies tests from crates.io, unless you download a raw tarball and run cargo locally. FWIW tokei hasn't published its tests to crates.io in years and no one has ever asked about it.

BurntSushi commented 3 years ago

I've generally tried to keep test stuff inside the crate, although I don't have any automated processes in place to check it. The reason why I have done that is because it seems like a generally good idea to make it possible to download a crate from crates.io and be able to run its test suite with whatever it is you downloaded. Particularly for tooling like crater. But @XAMPPRocky is right in that it's unlikely you'll hear any complaints. Otherwise, I don't think there is any firm established practice here.

XAMPPRocky commented 3 years ago

Particularly for tooling like crater.

That doesn't affect this crate though right? The tests that encoding-rs has outside of src are fuzzing, which would not be run by crater. Crater would only run tests under tests. I think the main folder I'm not really sure about is the doc folder which seems like module docs but I can't see where that's used.

BurntSushi commented 3 years ago

Ah gotya. I didn't look too closely at the specific setup here. :-)