-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Tracking Issue: Add rustc-guide to toolstate #59597
Comments
Hi there, is anyone working on this already? @mark-i-m Anyway, I played with this for a bit, I'm just not sure about how to add mdbook-linkcheck as dep. And if the changes above are enough. If they are, I'm happy to open the PR! My first to rust <3 |
Hi @andrehjr! You are the first person to work on this :) Thanks! That looks like a great start, but it causes the entire compiler to be built before rustc-guide is tested, which is not necessary. Also, I’m not sure if actually tests rustc-guide or just libstd. You will probably need to manually define RustcGuide and impl Step for it. I did a bit more digging, and I think such an implementation can look similar to the one for test::ErrorIndex, which also requires calling an external tool. Except in our case, we want to call a tool called rustbook, which calls mdbook (src/tools/rustbook/). It looks like rustbook calls mdbook programmatically, so we might need to find a way to call mdbook-linkcheck programmatically too. My guess is that we will also need to add linkcheck as a dependency of rustbook somehow... If I have time tomorrow I can try to learn more, or if you are feeling adventurous feel free to explore :) |
A quick note: it looks like you can use the linkchecker as a library: https://docs.rs/mdbook-linkcheck/0.2.3/mdbook_linkcheck/fn.check_links.html My guess is that you can get the RenderContext from the mdbook crate, which is already imported in rustbook. So it looks like it should be possible to add a “linkcheck mode” to rustbook. Feel free to ping me if you need anything :) |
Thanks for the tips @mark-i-m ! I thought I could get away using the Interesting! I'll dig more into this today. |
Hi @mark-i-m I played with it a bit more, I think I'm on the right track. Just need some refactoring :) And ensure everything is working as expected. I was able to call the check_links programmatically passing a RenderContext from the md_book. Also note that mdbook-linkcheck only supports mdbook > 2. I ended up adding a new subcommand on mdbook just for linkchecks, I can tweak it into the other command if needed. Locally, I'm getting a few intermittent 'request timeouts' for a few links every now and then. Maybe it's just my internet connection. I did not push Cargo.lock because it added a bunch of stuff from macOS, what can I do in those cases? Also, it seems like when you 'build' the book it runs the linkcheck automatically if it's configured on book.toml. The way I did here, it just loads up the book using mdbook and linkchecks it (without fully building it/generating .htmls) |
@andrehjr Just took a look, and it looks good 👍
Sorry, I forgot to mention this. Could you add in the command line description for the
There may also be some rate-limiting somewhere because I see failures every once in a while both on my laptop and on CI. I think it is probably ok for now. If it gets to be an issue later, we can do some deeper debugging.
It looks like those are transitive dependencies of
Yes, that is correct. On the rustc-guide repo, that is how we get Travis to run the linkchecker. In that case, we also want to build the book itself so that we can host it, but for toolstate, just linkchecking is fine. |
Cool! I updated the command line description! There's an issue when building rustbook on travisci:
|
Add rustc guide to toolstate Closes #59597
(According to the plan in rust-lang-nursery/rust-toolstate#5)
cc @nikomatsakis @kennytm @Michael-F-Bryan
@kennytm Could you tag this with Help-Wanted?
Instructions
Background: We have a cool tool called
toolstate
which posts a message on PRs that break dependent crates (e.g.clippy
). For example, it might generate a post like this. There is also a web portal: https://rust-lang-nursery.github.io/rust-toolstate/Objective: Currently the rustc-guide is not tracked by toolstate, but we want it to be. This will help us detect when the compiler changes and the guide needs to be updated. However, some infrastructure work is needed for this to work.
Steps
mdbook
andmdbook-linkcheck
as dependencies for the rust-lang/rust build. These are used to build and check links in therustc-guide
repo.mdbook
to build The Book and other things, but it's not clear to me how we make sure they are installed... (Perhaps @kennytm has ideas?)./x.py test src/doc/rustc-guide
command1. Create a new
struct RustcGuide
insrc/bootstrap/test.rs
.2.
impl Step for RustcGuide
to runmdbook build
insrc/doc/rustc-guide
- Make sure that this test is not part of the standard build process or it will block PRs on the rust-lang/rust repo. IIUC, this can be done in the implementation of
should_run
andmake_run
inStep
(see the documentation insrc/bootstrap/builder.rs
3. Update
Builder::get_step_descriptions
4. You may or may not need to do other stuff to wire things together... not sure. In the end, you should be able to do
./x.py test src/doc/rustc-guide
to run the book build and linkchecker on the guide.rustc-guide
, as done here: https://github.com/rust-lang/rust/pull/59038/filesMAINTAINERS
section. (@nikomatsakis do you want to be added too?)Feel free to ping me on this thread if you need help :)
The text was updated successfully, but these errors were encountered: