-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublic_api_report.sh
More file actions
executable file
·49 lines (37 loc) · 1.2 KB
/
public_api_report.sh
File metadata and controls
executable file
·49 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
set -euo pipefail
# Generates a lightweight public API report via rustdoc JSON.
# Requires nightly rustdoc.
RUSTDOCFLAGS="-Zunstable-options --output-format json" \
cargo +nightly doc --no-deps --lib -Z unstable-options
JSON="target/doc/jvmti_bindings.json"
OUT="docs/PUBLIC_API_REPORT.md"
python - <<'PY'
import json
from pathlib import Path
json_path = Path("target/doc/jvmti_bindings.json")
if not json_path.exists():
raise SystemExit("rustdoc json not found: " + str(json_path))
j = json.loads(json_path.read_text())
# Very lightweight report: list top-level exports by name.
# We keep this simple to avoid a heavy dependency on rustdoc internals.
crate_index = j.get("index", {})
items = []
for k, v in crate_index.items():
if v.get("crate_id") == 0 and v.get("visibility") == "public":
name = v.get("name")
if name:
items.append(name)
items = sorted(set(items))
out = Path("docs/PUBLIC_API_REPORT.md")
lines = [
"# Public API Report",
"",
"(Generated by scripts/public_api_report.sh)",
"",
"Top-level public items:",
]
lines.extend([f"1. {name}" for name in items])
out.write_text("\n".join(lines) + "\n")
print(f"Wrote {out}")
PY