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

Is there a way to run cargo doc and only get the documentation for direct dependencies of my project? #6421

Closed
arthmis opened this issue Dec 12, 2018 · 6 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-doc

Comments

@arthmis
Copy link

arthmis commented Dec 12, 2018

Describe the problem you are trying to solve

Whenever I run cargo doc, it builds the documentation for all the dependencies of the project. The problem is that I don't want all the documentation for every crate. I only want the documentation for the crates that are direct dependencies of my project and not the dependencies of my project's dependencies.

Describe the solution you'd like

I would prefer if the default behavior of cargo doc only builds the documentation for my project and its direct dependencies.

@alexcrichton
Copy link
Member

There isn't currently, but a flag could be added!

@alexcrichton alexcrichton added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Dec 12, 2018
@dwijnand
Copy link
Member

Plausible flag names? --direct-deps-only?

@arthmis
Copy link
Author

arthmis commented Dec 14, 2018

Is there a reason cargo doc builds the documentation for every dependency of the project and not only the direct dependencies? I can't imagine that someone would want the documentation for all dependencies and also what is the point of the flag --all?

@ehuss
Copy link
Contributor

ehuss commented Mar 13, 2019

This may be a duplicate of #2025.

@yuyoyuppe
Copy link

I'd like to help implementing this, but I wonder what is the expected behavior of links which refer to the "undocumented" crates? some options OTOH:

  • make them lead to a special "not documented" page
  • transform the links so they refer to the official docs.rs page

I'm not yet familiar how the doc command works, so maybe those links won't be generated in the first place.

I also wonder if it's possible to avoid building the documentation of the indirect dependencies entirely, not just hiding after the fact, since building them is a time-consuming process.

@ehuss
Copy link
Contributor

ehuss commented May 23, 2020

Closing as a duplicate of #2025.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-doc
Projects
None yet
Development

No branches or pull requests

5 participants