gtk-rs / gir

Tool to generate rust bindings and user API for glib-based libraries
https://gtk-rs.org/gir/book/
MIT License
225 stars 99 forks source link

Exclude tests folder and Gir.toml, versions.txt files #1491

Closed pentamassiv closed 11 months ago

pentamassiv commented 11 months ago

Similar to https://github.com/gtk-rs/gtk-rs-core/pull/1158

The size of the crates can be reduced by excluding the tests folder and the Gir.toml + versions.txt files from being published to crates.io. All crates that are generated by gir have the two files and most will have a tests folder. They never have to get published to crates.io so gir can automatically generate that line for us. If for whatever reason they do need to be published, the entries can be removed from the list. The entry is never overwritten if it exists. There can also be an include list. If that is the case, no exclude is added.

While this in most cases will only save a few KB, the gtk, gstreamer and related crates do get a lot of downloads so I believe it is beneficial.

You can see which files will be included without publishing the crates by running cargo package --list.

pentamassiv commented 11 months ago

Another option would be to use something like this:

include = ["src/*", "build.rs", "Cargo.toml", "LICENSE", "COPYRIGHT"]

but that probably is more error prone and would lead to more questions.

sdroege commented 11 months ago

Same questions as for https://github.com/gtk-rs/gtk-rs-core/pull/1158#pullrequestreview-1565363425

pentamassiv commented 11 months ago

I did not know packagers use the tests from crates.io and the other included files