gtk-rs / gtk3-rs

Rust bindings for GTK 3
https://gtk-rs.org
MIT License
508 stars 90 forks source link

Activate dox feature wherever possible #775

Closed pentamassiv closed 1 year ago

pentamassiv commented 1 year ago

Analogous to: https://github.com/gtk-rs/gtk-rs-core/pull/778

Whenever a crate is published on crates.io, its documentation is automatically built on docs.rs regardless of the documentation field in the Cargo.toml file. On docs.rs it is possible to look at all previous versions. This is why there is value in having working builds on docs.rs. Having broken builds on docs.rs also prevents crates using that library from providing their own documentation on docs.rs. I enabled the dox feature wherever it is available to ensure the docs always build, even if the dependencies are not available.

GuillaumeGomez commented 1 year ago

Thanks! I'm surprised we didn't do it in those crates. Is there a reason for that @sdroege ?

pentamassiv commented 1 year ago

For gtk3 I guess it isn't strictly necessary since I guess all dependencies are available on docs.rs for the builds to succeed. There were some failed builds for gtk4 though so I made the changes for all crates.

GuillaumeGomez commented 1 year ago

Oh, interestingly enough, gir is messing with the Cargo file.

pentamassiv commented 1 year ago

Is that the failed regen check? I was wondering why that failed.

pentamassiv commented 1 year ago

https://github.com/gtk-rs/gtk-rs-core/pull/778#discussion_r989132506 I guess I have to teach it to gir instead.

GuillaumeGomez commented 1 year ago

Ah sure. Please open issue on gir first so it's not lost.

sdroege commented 1 year ago

Why do we care about the documentation on docs.rs though? It's incomplete without all the docs injected by generator.py..

The change itself makes sense of course.

pentamassiv commented 1 year ago

The reason why I care is because I sometimes like to go back and forth between versions of the docs and compare the differences. It helps me when I change the version of a dependency. I wanted to do that with the documentation for relm4, but that's not possible because the builds on docs.rs failed. The reason for the failure is that some of it's dependencies such as libadwaita (thats fixed now) failed to build. I am sure there are other smaller projects out there that use some gtk crates as dependencies and would like to provide documentation. It should be as easy as possible for them to do so. Even if the documentation for gtk crates is not perfect if built on docs.rs, it helps other crates that depend on it. I understand that it is not your priority, so I decided to work on it myself :)

pentamassiv commented 1 year ago

While the newest version of gir activates the dox feature in all dependencies in the Cargo.toml, it does not activate them in the Cargo.toml of the safe wrapper crates. This commit activates the dox feature in the safe wrapper crates too.

GuillaumeGomez commented 1 year ago

Thanks!