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

Add a link validator to rustbuild #32133

Merged
merged 12 commits into from
Mar 11, 2016
Merged

Conversation

alexcrichton
Copy link
Member

This commit was originally targeted at just adding a link checking script to the rustbuild system. This ended up snowballing a bit to extend rustbuild to be amenable to various tools we have as part of the build system in general.

There's a new src/tools directory which has a number of scripts/programs that are purely intended to be used as part of the build system and CI of this repository. This is currently inhabited by rustbook, the error index generator, and a new linkchecker script added as part of this PR. I suspect that more tools like compiletest, tidy scripts, snapshot scripts, etc will migrate their way into this directory over time.

The commit which adds the error index generator shows the steps necessary to add new tools to the build system, namely:

  1. New steps are defined for building the tool and running the tool
  2. The dependencies are configured
  3. The steps are implemented

In terms of the link checker, these commits do a few things:

  • A new src/tools/linkchecker script is added. This will read an entire documentation tree looking for broken relative links (HTTP links aren't followed yet).
  • A large number of broken links throughout the documentation were fixed. Many of these were just broken when viewed from core as opposed to std, but were easily fixed.
  • A few rustdoc bugs here and there were fixed

We'll tack on more steps here later
Run `cargo doc` to generate all documentation for the standard library, and also
add a target which generates documentation for the compiler as well (but don't
enable it by default).
Use a macro so it automatically picks up new steps.
We've actually got quite a few tools that are compiled as part of our build,
let's start housing them all in a `tools` directory.
Instead of using a `is_std: bool`, instead use a more well-typed and
self-documenting enum to indicate the mode in which Cargo is being invoked.
The stage0 rustdoc comes from the snapshot, and we need a shim like with `rustc`
to pass `--cfg` for now.
Add a script to get run which verifies that `href` links in documents are
correct. We're always getting a steady stream of "fix a broken link" PRs and
issue reports, and we should probably just nip them all in the bud.
Just always build stage1 rustdoc, it's really not that much more to build as
it's essentially just one library.
A few categories:

* Links into compiler docs were just all removed as we're not generating
  compiler docs.
* Move up one more level to forcibly go to std docs to fix inlined documentation
  across the facade crates.
This is actually a reexported implementation detail in the `rt::v1` module but
rustdoc doesn't like reexporting items from `doc(hidden)` modules. Do what we'd
end up doing anyway from an API perspective and make a public-facing `enum` that
can be retranslated under the hood if necessary.
Right now whenever rustdoc inlines a struct or enum from another crate it ends
up inlining *all* `impl` items found in the other crate at the same time. The
rationale for this was to discover all trait impls which are otherwise not
probed for. This unfortunately picks up a lot of impls of public traits for
private types, causing lots of broken links.

This commit instead hoards all of those inlined impls into a temporary storage
location which is then selectively drawn from whenever we inline a new type.
This should ensure that we still inline all relevant impls while avoiding all
private ones.
This adds a step and a rule for building the error index as part of rustbuild.
@alexcrichton
Copy link
Member Author

r? @brson - mostly rustbuild
cc @steveklabnik - doc changes
cc @mitaa - rustdoc changes

@alexcrichton
Copy link
Member Author

Oh and I should also mention that this adds support for generating crate docs via rustbuild. This PR ended up doing a bit more than I originally intended...

@brson
Copy link
Contributor

brson commented Mar 8, 2016

r=me

@alexcrichton
Copy link
Member Author

@bors: r=brson 3e6fed3

@bors
Copy link
Contributor

bors commented Mar 11, 2016

⌛ Testing commit 3e6fed3 with merge aeb85a9...

bors added a commit that referenced this pull request Mar 11, 2016
Add a link validator to rustbuild

This commit was originally targeted at just adding a link checking script to the rustbuild system. This ended up snowballing a bit to extend rustbuild to be amenable to various tools we have as part of the build system in general.

There's a new `src/tools` directory which has a number of scripts/programs that are purely intended to be used as part of the build system and CI of this repository. This is currently inhabited by rustbook, the error index generator, and a new linkchecker script added as part of this PR. I suspect that more tools like compiletest, tidy scripts, snapshot scripts, etc will migrate their way into this directory over time.

The commit which adds the error index generator shows the steps necessary to add new tools to the build system, namely:

1. New steps are defined for building the tool and running the tool
2. The dependencies are configured
3. The steps are implemented

In terms of the link checker, these commits do a few things:

* A new `src/tools/linkchecker` script is added. This will read an entire documentation tree looking for broken relative links (HTTP links aren't followed yet).
* A large number of broken links throughout the documentation were fixed. Many of these were just broken when viewed from core as opposed to std, but were easily fixed.
* A few rustdoc bugs here and there were fixed
@bors bors merged commit 3e6fed3 into rust-lang:master Mar 11, 2016
@alexcrichton alexcrichton deleted the linkchecker branch March 11, 2016 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants