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

x doc --json flag not working #103816

Closed
viandoxdev opened this issue Oct 31, 2022 · 7 comments · Fixed by #103851
Closed

x doc --json flag not working #103816

viandoxdev opened this issue Oct 31, 2022 · 7 comments · Fixed by #103851
Assignees
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@viandoxdev
Copy link
Contributor

running

./x doc library/std --json --stage 0

only builds the html doc, but

RUSTDOCFLAGS="-Zunstable-options --output-format=json" ./x doc library/std --stage 0

builds the json doc.

I expected the json flag to act as the documentation says (./x doc --help):

        --json          render the documentation in JSON format in addition to
                        the usual HTML format

Meta

using the master branch of this repo commit 2afca78

running with a library profile.

@viandoxdev viandoxdev added the C-bug Category: This is a bug. label Oct 31, 2022
@the8472 the8472 added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Oct 31, 2022
@jyn514
Copy link
Member

jyn514 commented Nov 1, 2022

I can't reproduce this. The files show up for me in build/x86_64-unknown-linux-gnu/json-doc.

@jyn514 jyn514 added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Nov 1, 2022
@viandoxdev
Copy link
Contributor Author

FROM rust:1.64

WORKDIR /root/
RUN git clone --depth 1 https://github.com/rust-lang/rust

RUN echo "changelog-seen = 2"       > /root/rust/config.toml
RUN echo "[llvm]"                  >> /root/rust/config.toml
RUN echo "download-ci-llvm = true" >> /root/rust/config.toml

WORKDIR /root/rust

RUN /root/rust/x doc core --json --stage 0

RUN find /root/rust/build -name "core.json" | grep . || echo "not found"

Seems to reproduce, I could totally have overlooked a step tho

@jyn514
Copy link
Member

jyn514 commented Nov 1, 2022

Ok, I think I see the issue - JsonDoc and HtmlDoc have the same PathSet, and it's non-deterministic which one gets picked; for me hit happens to be JsonDoc, for you it happens to be HtmlDoc. 9791b9f should fix it.

@jyn514
Copy link
Member

jyn514 commented Nov 1, 2022

oh no it's even simpler than that lol it's calling the wrong ensure function

run.builder.ensure(Std { stage: run.builder.top_stage, target: run.target });

that should be JsonStd, not Std

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. and removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Nov 1, 2022
@viandoxdev
Copy link
Contributor Author

Should I make the PR or are you gonna do it ?

@jyn514
Copy link
Member

jyn514 commented Nov 1, 2022

If you could make a PR that would be great :)

@viandoxdev
Copy link
Contributor Author

Made the PR but since just changing the ensure wasn't enough there's a thing I'm unsure about (tested it, worked, but could be cleaner)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 5, 2022
…on_doc, r=jyn514

Fix json flag in bootstrap doc

Fix the `--json` flag not working with x.py (Closes rust-lang#103816)

While this works I'm not sure about the `should_run` of `JsonStd`, had to change it because https://github.com/rust-lang/rust/blob/ab5a2bc7316012ee9b2a4a4f3821673f2677f3d5/src/bootstrap/builder.rs#L334 would match with JsonStd and remove the paths that Std matched. So I did [this](https://github.com/viandoxdev/rust/blob/ffd4078264c4892b5098d6191e0adfe3564d62ca/src/bootstrap/doc.rs#L526-L534) but that looks more like a hack/workaround than anything. I'm guessing there's something to do with the default condition thing but idk how it works
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 6, 2022
…on_doc, r=jyn514

Fix json flag in bootstrap doc

Fix the `--json` flag not working with x.py (Closes rust-lang#103816)

While this works I'm not sure about the `should_run` of `JsonStd`, had to change it because https://github.com/rust-lang/rust/blob/ab5a2bc7316012ee9b2a4a4f3821673f2677f3d5/src/bootstrap/builder.rs#L334 would match with JsonStd and remove the paths that Std matched. So I did [this](https://github.com/viandoxdev/rust/blob/ffd4078264c4892b5098d6191e0adfe3564d62ca/src/bootstrap/doc.rs#L526-L534) but that looks more like a hack/workaround than anything. I'm guessing there's something to do with the default condition thing but idk how it works
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 6, 2022
…on_doc, r=jyn514

Fix json flag in bootstrap doc

Fix the `--json` flag not working with x.py (Closes rust-lang#103816)

While this works I'm not sure about the `should_run` of `JsonStd`, had to change it because https://github.com/rust-lang/rust/blob/ab5a2bc7316012ee9b2a4a4f3821673f2677f3d5/src/bootstrap/builder.rs#L334 would match with JsonStd and remove the paths that Std matched. So I did [this](https://github.com/viandoxdev/rust/blob/ffd4078264c4892b5098d6191e0adfe3564d62ca/src/bootstrap/doc.rs#L526-L534) but that looks more like a hack/workaround than anything. I'm guessing there's something to do with the default condition thing but idk how it works
@bors bors closed this as completed in 6e1361f Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants