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

Use crate documentation url #1406

Open
bilelmoussaoui opened this issue May 22, 2021 · 6 comments
Open

Use crate documentation url #1406

bilelmoussaoui opened this issue May 22, 2021 · 6 comments

Comments

@bilelmoussaoui
Copy link

bilelmoussaoui commented May 22, 2021

In the case of various crates we have for glib based libraries bindings, the documentations generated with a simple cargo doc don't contain any documentations due to licensing issues. As we can't "overwrite" the source files during the doc stage, because the files are read only, we opted for deploying our docs using CI ourselves.

Sadly, now once we will have a release, people looking for say gtk4 in docs.rs will end up with pretty poor quality docs instead of the one specified in Cargo.toml's documentation url.

I wonder if there's a possibility to make the docs.rs url point to that in such case instead of re-building the docs as part of docs.rs, it could be even something to opt-in for somehow.

See https://docs.rs/gtk/0.9.2/gtk/ for example instead of https://gtk-rs.org/docs/gtk/

@syphar
Copy link
Member

syphar commented May 25, 2021

@bilelmoussaoui this looks like a duplicate of #125, does it? Or am I missing something?

@bilelmoussaoui
Copy link
Author

Ah indeed, my bad I didn't notice it, sorry for the noise. I will copy over my comment to the other issue

Thanks @syphar :)

@jyn514
Copy link
Member

jyn514 commented May 25, 2021

I don't think this is a duplicate. It's very reasonable for the link to go to the other url if the build fails. I don't think we should use the link if it succeeds, since not all documentation URLs are actually rustdoc pages.

@jyn514 jyn514 reopened this May 25, 2021
@jyn514
Copy link
Member

jyn514 commented May 25, 2021

@bilelmoussaoui Assuming that gets implemenred, if the build succeeds but with poorer quality docs, you could add a cargo feature which just gives a compile error 😆 and then that fails the build and docs.rs links to the full docs.

@Nemo157
Copy link
Member

Nemo157 commented May 25, 2021

Alternatively, gtk-rs could reimplement the doc-embedding to use macros instead of modifying immutable source files, a proc-macro based solution would be pretty easy:

#[cfg_attr(include_docs, lgpl_docs::embed(AboutDialog))]
pub struct AboutDialog;

or with 1.54 even a macro_rules! solution is possible

#[cfg_attr(include_docs, doc = lgpl_docs::embed!(AboutDialog))]
pub struct AboutDialog;

@Nemo157
Copy link
Member

Nemo157 commented May 25, 2021

It's very reasonable for the link to go to the other url if the build fails

The majority of build failures are transient issues in the package. I don't think we would want to default to auto-redirecting to the documentation url on all build failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants