Skip to content

Commit 7715656

Browse files
committed
Add jsondocck tool, and use it for rustdoc JSON
1 parent f09fb48 commit 7715656

25 files changed

+542
-816
lines changed

Cargo.lock

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ version = "0.4.7"
101101
source = "registry+https://github.com/rust-lang/crates.io-index"
102102
checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034"
103103

104+
[[package]]
105+
name = "array_tool"
106+
version = "1.0.3"
107+
source = "registry+https://github.com/rust-lang/crates.io-index"
108+
checksum = "8f8cb5d814eb646a863c4f24978cff2880c4be96ad8cde2c0f0678732902e271"
109+
104110
[[package]]
105111
name = "arrayref"
106112
version = "0.3.6"
@@ -1630,6 +1636,32 @@ version = "0.11.15"
16301636
source = "registry+https://github.com/rust-lang/crates.io-index"
16311637
checksum = "92c245af8786f6ac35f95ca14feca9119e71339aaab41e878e7cdd655c97e9e5"
16321638

1639+
[[package]]
1640+
name = "jsondocck"
1641+
version = "0.1.0"
1642+
dependencies = [
1643+
"getopts",
1644+
"jsonpath_lib",
1645+
"lazy_static",
1646+
"regex",
1647+
"serde",
1648+
"serde_json",
1649+
"shlex",
1650+
]
1651+
1652+
[[package]]
1653+
name = "jsonpath_lib"
1654+
version = "0.2.6"
1655+
source = "registry+https://github.com/rust-lang/crates.io-index"
1656+
checksum = "61352ec23883402b7d30b3313c16cbabefb8907361c4eb669d990cbb87ceee5a"
1657+
dependencies = [
1658+
"array_tool",
1659+
"env_logger 0.7.1",
1660+
"log",
1661+
"serde",
1662+
"serde_json",
1663+
]
1664+
16331665
[[package]]
16341666
name = "jsonrpc-client-transports"
16351667
version = "14.2.1"
@@ -2854,9 +2886,9 @@ dependencies = [
28542886

28552887
[[package]]
28562888
name = "regex"
2857-
version = "1.3.9"
2889+
version = "1.4.3"
28582890
source = "registry+https://github.com/rust-lang/crates.io-index"
2859-
checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
2891+
checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a"
28602892
dependencies = [
28612893
"aho-corasick",
28622894
"memchr",
@@ -2876,9 +2908,9 @@ dependencies = [
28762908

28772909
[[package]]
28782910
name = "regex-syntax"
2879-
version = "0.6.18"
2911+
version = "0.6.22"
28802912
source = "registry+https://github.com/rust-lang/crates.io-index"
2881-
checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
2913+
checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
28822914

28832915
[[package]]
28842916
name = "remote-test-client"
@@ -4578,6 +4610,7 @@ version = "1.0.59"
45784610
source = "registry+https://github.com/rust-lang/crates.io-index"
45794611
checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95"
45804612
dependencies = [
4613+
"indexmap",
45814614
"itoa",
45824615
"ryu",
45834616
"serde",

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ members = [
3131
"src/tools/rustdoc-themes",
3232
"src/tools/unicode-table-generator",
3333
"src/tools/expand-yaml-anchors",
34+
"src/tools/jsondocck",
3435
]
3536

3637
exclude = [

src/bootstrap/builder.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,11 @@ impl<'a> Builder<'a> {
751751
cmd
752752
}
753753

754+
/// Gets a path to the jsondocck tool
755+
pub fn jsondocck(&self, compiler: Compiler, target: TargetSelection) -> PathBuf {
756+
self.ensure(tool::JsonDocCk { compiler, target })
757+
}
758+
754759
/// Return the path to `llvm-config` for the target, if it exists.
755760
///
756761
/// Note that this returns `None` if LLVM is disabled, or if we're in a

src/bootstrap/test.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,8 @@ note: if you're sure you want to do this, please open an issue as to why. In the
10721072

10731073
cmd.arg("--docck-python").arg(builder.python());
10741074

1075+
cmd.arg("--jsondocck-path").arg(builder.jsondocck(compiler, target));
1076+
10751077
if builder.config.build.ends_with("apple-darwin") {
10761078
// Force /usr/bin/python3 on macOS for LLDB tests because we're loading the
10771079
// LLDB plugin's compiled module which only works with the system python

src/bootstrap/tool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ bootstrap_tool!(
367367
RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes";
368368
ExpandYamlAnchors, "src/tools/expand-yaml-anchors", "expand-yaml-anchors";
369369
LintDocs, "src/tools/lint-docs", "lint-docs";
370+
JsonDocCk, "src/tools/jsondocck", "jsondocck", is_unstable_tool = true;
370371
);
371372

372373
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]

src/test/rustdoc-json/check_missing_items.py renamed to src/etc/check_missing_items.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# `index` or `paths`. It DOES NOT check that the structure of the produced json is actually in
55
# any way correct, for example an empty map would pass.
66

7+
# FIXME: Better error output
8+
79
import sys
810
import json
911

src/test/rustdoc-json/compare.py

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)