Auto merge of #29895 - mrobinson:cleanup-rustdoc, r=jdm

Clean up rustdoc run

1. The options specified in `rustdoc-with-private` are essentially the default now so we can remove this script.
2. `./mach browse-doc` is redundant with `./mach doc --open` which uses the underlying cargo functionality to browse the documentation.
3. `etc/rustdoc-style.html` is unused and can simply be removed.

Fixes #29888.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #29888 (GitHub issue number if applicable)
- [x] These changes do not require tests because they just update build scripts.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2023-06-20 20:48:02 +02:00 committed by GitHub
commit 92d65a9a81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 41 deletions

View file

@ -1,8 +0,0 @@
<style>
.docblock table {
border-collapse: collapse;
}
.docblock table th, .docblock table td {
border: 1px solid #888;
}
</style>

View file

@ -1,16 +0,0 @@
#!/usr/bin/env bash
# Emit documentation for private items so it is easier to look
# up internal definitions.
#
# Deny "deny warnings" to ensure documenting the crates
# succeeds even if new warnings are introduced to the compiler.
if [[ "$*" == *--document-private-items* ]]
then
ARGS=""
else
ARGS="--document-private-items"
fi
rustdoc -Z "unstable-options" --cap-lints warn $ARGS "$@"

View file

@ -10,7 +10,7 @@
from __future__ import print_function from __future__ import print_function
import contextlib import contextlib
from typing import Optional from typing import List, Optional
import distro import distro
import functools import functools
import gzip import gzip
@ -616,11 +616,7 @@ class CommandBase(object):
if hosts_file_path: if hosts_file_path:
env['HOST_FILE'] = hosts_file_path env['HOST_FILE'] = hosts_file_path
if not test_unit: if test_unit and "msvc" in servo.platform.host_triple():
# This wrapper script is in bash and doesn't work on Windows
# where we want to run doctests as part of `./mach test-unit`
env['RUSTDOC'] = path.join(self.context.topdir, 'etc', 'rustdoc-with-private')
elif "msvc" in servo.platform.host_triple():
# on MSVC, we need some DLLs in the path. They were copied # on MSVC, we need some DLLs in the path. They were copied
# in to the servo.exe build dir, so just point PATH to that. # in to the servo.exe build dir, so just point PATH to that.
util.prepend_paths_to_env(env, "PATH", path.dirname(self.get_binary_path(False, False))) util.prepend_paths_to_env(env, "PATH", path.dirname(self.get_binary_path(False, False)))
@ -824,7 +820,7 @@ class CommandBase(object):
self.features += ["media-" + media_stack] self.features += ["media-" + media_stack]
def run_cargo_build_like_command( def run_cargo_build_like_command(
self, command, cargo_args, self, command: str, cargo_args: List[str],
env=None, verbose=False, env=None, verbose=False,
libsimpleservo=False, libsimpleservo=False,
debug_mozjs=False, with_debug_assertions=False, debug_mozjs=False, with_debug_assertions=False,

View file

@ -14,6 +14,7 @@ import os
import os.path as path import os.path as path
import subprocess import subprocess
from shutil import copytree, rmtree, copy2 from shutil import copytree, rmtree, copy2
from typing import List
import servo.util import servo.util
@ -242,7 +243,7 @@ class PostBuildCommands(CommandBase):
'params', nargs='...', 'params', nargs='...',
help="Command-line arguments to be passed through to cargo doc") help="Command-line arguments to be passed through to cargo doc")
@CommandBase.build_like_command_arguments @CommandBase.build_like_command_arguments
def doc(self, params, **kwargs): def doc(self, params: List[str], **kwargs):
self.ensure_bootstrapped(rustup_components=["rust-docs"]) self.ensure_bootstrapped(rustup_components=["rust-docs"])
rustc_path = check_output( rustc_path = check_output(
["rustup" + BIN_SUFFIX, "which", "--toolchain", self.rust_toolchain(), "rustc"] ["rustup" + BIN_SUFFIX, "which", "--toolchain", self.rust_toolchain(), "rustc"]
@ -278,12 +279,3 @@ class PostBuildCommands(CommandBase):
static = path.join(self.context.topdir, "etc", "doc.servo.org") static = path.join(self.context.topdir, "etc", "doc.servo.org")
for name in os.listdir(static): for name in os.listdir(static):
copy2(path.join(static, name), path.join(docs, name)) copy2(path.join(static, name), path.join(docs, name))
@Command('browse-doc',
description='Generate documentation and open it in a web browser',
category='post-build')
def serve_docs(self):
self.doc([])
import webbrowser
webbrowser.open("file://" + path.abspath(path.join(
servo.util.get_target_dir(), "doc", "servo", "index.html")))