2024-05-22 11:47:32 +02:00
|
|
|
//@ ignore-cross-compile
|
|
|
|
|
2024-06-07 14:10:27 +02:00
|
|
|
use run_make_support::{htmldocck, rust_lib_name, rustc, rustdoc};
|
2024-05-22 11:47:32 +02:00
|
|
|
|
|
|
|
fn main() {
|
2024-06-06 21:34:34 +02:00
|
|
|
let out_dir = "rustdoc";
|
|
|
|
let ex_dir = "ex.calls";
|
2024-05-22 11:47:32 +02:00
|
|
|
let proc_crate_name = "foobar_macro";
|
|
|
|
let crate_name = "foobar";
|
|
|
|
|
|
|
|
let dylib_name = String::from_utf8(
|
|
|
|
rustc()
|
|
|
|
.crate_name(proc_crate_name)
|
|
|
|
.crate_type("dylib")
|
|
|
|
.arg("--print")
|
|
|
|
.arg("file-names")
|
|
|
|
.arg("-")
|
|
|
|
.command_output()
|
|
|
|
.stdout,
|
|
|
|
)
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
rustc()
|
|
|
|
.input("src/proc.rs")
|
|
|
|
.crate_name(proc_crate_name)
|
|
|
|
.edition("2021")
|
|
|
|
.crate_type("proc-macro")
|
|
|
|
.emit("dep-info,link")
|
|
|
|
.run();
|
|
|
|
rustc()
|
|
|
|
.input("src/lib.rs")
|
|
|
|
.crate_name(crate_name)
|
|
|
|
.edition("2021")
|
|
|
|
.crate_type("lib")
|
|
|
|
.emit("dep-info,link")
|
|
|
|
.run();
|
|
|
|
|
|
|
|
rustdoc()
|
|
|
|
.input("examples/ex.rs")
|
|
|
|
.crate_name("ex")
|
|
|
|
.crate_type("bin")
|
|
|
|
.output(&out_dir)
|
2024-06-07 14:07:02 +02:00
|
|
|
.extern_(crate_name, rust_lib_name(crate_name))
|
2024-06-06 21:34:34 +02:00
|
|
|
.extern_(proc_crate_name, dylib_name.trim())
|
2024-05-22 11:47:32 +02:00
|
|
|
.arg("-Zunstable-options")
|
|
|
|
.arg("--scrape-examples-output-path")
|
|
|
|
.arg(&ex_dir)
|
|
|
|
.arg("--scrape-examples-target-crate")
|
|
|
|
.arg(crate_name)
|
|
|
|
.run();
|
|
|
|
|
|
|
|
rustdoc()
|
|
|
|
.input("src/lib.rs")
|
|
|
|
.crate_name(crate_name)
|
|
|
|
.crate_type("lib")
|
|
|
|
.output(&out_dir)
|
|
|
|
.arg("-Zunstable-options")
|
|
|
|
.arg("--with-examples")
|
|
|
|
.arg(&ex_dir)
|
|
|
|
.run();
|
|
|
|
|
|
|
|
assert!(htmldocck().arg(out_dir).arg("src/lib.rs").status().unwrap().success());
|
|
|
|
}
|