Skip to content

cargo doc: Add --publish-dir option #10100

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

Closed

Conversation

basile-henry
Copy link
Contributor

Resolves #10089

The PR adds a new option to cargo doc/cargo rustdoc: --publish-dir

When using this new option, the generated documentation will be copied to the specified publish directory.
This can be used to publish documentation straight into, for example, a directory that is being served up by a local web server already.

@rust-highfive
Copy link

r? @ehuss

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 19, 2021
@basile-henry basile-henry force-pushed the basile-henry/doc-publish branch from ceb9740 to 5e833ba Compare November 20, 2021 21:56
@ehuss
Copy link
Contributor

ehuss commented Nov 30, 2021

Thanks for the PR! The team talked about this a bit, and we had a few comments:

  • What is the use case for this? I would assume that if you are packaging or otherwise collecting the build results somewhere, that you have an outer build system or script that can do the same task of copying the files.
  • We were thinking this seems essentially the same as --out-dir. We were thinking that it would probably be best to avoid adding too many different options, so perhaps this should just be the same as --out-dir?
    • Related to that, unfortunately --out-dir is not really on a path to ever being stabilized. We're happy to include cargo doc with --out-dir, this is just a heads-up that it's not clear how it will move forward.

@jonhoo
Copy link
Contributor

jonhoo commented Dec 6, 2021

I can chime into this from my perspective.

Yes, this is exactly like --out-dir, just implemented specifically for doc. I agree that consolidating the two makes sense. I don't know that the current implementation of --out-dir allows setting it just for [doc], but if it did, it'd at least solve my use-case.

As for what that use-case is, for me at least the hope is to encode information about where other tools look for documentation directly into Cargo's configuration so that users can just run cargo doc and the documentation is automatically included in whatever those other tools may be (which suggests >1 out-dirs should be specifiable, but that's a separate point). Concretely, in my case, I have an external build system that links and exports any documentation present in a particular subdirectory of a folder named build, and I would like users using Cargo to be able to just use cargo doc, and still have their docs published to the external build system as well. out-dir would do that wonderfully.

@alexcrichton alexcrichton added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 14, 2021
@alexcrichton
Copy link
Member

I've tagged this as waiting-on-author now as the consensus seems to be that if we are to implement a feature such as this it would be done with --out-dir

@ehuss
Copy link
Contributor

ehuss commented Mar 23, 2022

Closing per the conversation above about not wishing to add a new flag for this.

@ehuss ehuss closed this Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doc: make root directory configurable
5 participants