feat: rebuild(-ish) rustdoc json for different version of same crates#16773
feat: rebuild(-ish) rustdoc json for different version of same crates#16773motorailgun wants to merge 2 commits intorust-lang:masterfrom
Conversation
|
r? @epage rustbot has assigned @epage. Use Why was this reviewer chosen?The reviewer was selected based on:
|
a1ef71b to
04024f4
Compare
| let path = if bcx.build_config.intent.wants_doc_json_output() { | ||
| let hash = self.metadata(unit).unit_id(); | ||
| let crate_name = unit.target.crate_name(); | ||
| self.output_dir(unit) |
There was a problem hiding this comment.
Haven't yet thought harder on this (and haven't yet started a thorough review), though I wonder if this can somehow leverage per-unit directory layout
There was a problem hiding this comment.
-Zrustdoc-mergrable-info also puts things to new layout dir btw
There was a problem hiding this comment.
Interesting, will it be somewhere around <build_dir>/<profile>/build/<pkg_name>/<hash>/out/?
There was a problem hiding this comment.
These were the past relevant discussions
- feat: support for rustdoc mergeable cross-crate info #16309 (comment)
- Implictly enable -Zbuild-dir-new-layout when -Zrustdoc-mergeable-info #16527
And if we want to put this under things like <build_dir>/<profile>/build/<pkg_name>/<hash>/out/ it might be better to move doc parts JSON into a sub-dir, and so does rustdoc output JSON, such as
<build_dir>/<profile>/build/<pkg_name>/<hash>/out/parts/for doc-parts<build_dir>/<profile>/build/<pkg_name>/<hash>/out/json/for JSON output
I had a experimental commit here moving things weihanglo@f53fd1e.
If we ever did this, we might want to note this in the tracking rustdoc JSON output tracking issue.
There was a problem hiding this comment.
Thank you for all the feedback! As per reading about new layouts, I think (1) always put json into build/<pkg_name>/<hash>/out and (2) uplift if new layout is not specified - is a good option. For parts I am not sure, but if it's not something that changes by depend-ers, they could also just be at build/<pkg_name>/<hash>/out .
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Oh I think I was wrong. A unit that outputs JSON format won't be the same unit that output doc parts. I must have been brain dead.
No. No subdirectory needed unless one day JSON output also has doc parts JSON, which is unlikely.
There was a problem hiding this comment.
Oh I see, then build/<pkg_name>/<hash>/out would be right for this PR I guess...?
04024f4 to
be69519
Compare
be69519 to
2f32d53
Compare
|
Updated to use new directory layout. |
Fix #16291.
What does this PR try to resolve?
As discussed in the linked issue,
cargo rustdoc --output-format=jsondoesn't rebuild for same crate name but with different versions. This is because current cargo implementation around rustdoc only specifies output paths/names by only its crate names, but not with version(hash) info.This PR forces new layout for json output, and uplift the file into backward-compatible place.
How to test and review this PR?
doc/<crate-name>-<hash>.jsonas this option is still unstable.