Skip to content

Commit

Permalink
Rollup merge of rust-lang#125401 - GuillaumeGomez:migrate-rustdoc-scr…
Browse files Browse the repository at this point in the history
…ape-examples-macros, r=jieyouxu

Migrate `run-make/rustdoc-scrape-examples-macros` to `rmake.rs`

Part of rust-lang#121876.

r? ```@jieyouxu```
  • Loading branch information
matthiaskrgr authored May 23, 2024
2 parents 026b144 + fc76015 commit 428bc4a
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ run-make/rlib-format-packed-bundled-libs/Makefile
run-make/rmeta-preferred/Makefile
run-make/rustc-macro-dep-files/Makefile
run-make/rustdoc-io-error/Makefile
run-make/rustdoc-scrape-examples-macros/Makefile
run-make/rustdoc-verify-output-files/Makefile
run-make/rustdoc-with-output-option/Makefile
run-make/rustdoc-with-short-out-dir-option/Makefile
Expand Down
19 changes: 0 additions & 19 deletions tests/run-make/rustdoc-scrape-examples-macros/Makefile

This file was deleted.

64 changes: 64 additions & 0 deletions tests/run-make/rustdoc-scrape-examples-macros/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//@ ignore-cross-compile

use run_make_support::{htmldocck, rustc, rustdoc, tmp_dir};

fn main() {
let tmp_dir = tmp_dir();
let out_dir = tmp_dir.join("rustdoc");
let ex_dir = tmp_dir.join("ex.calls");
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)
.extern_(crate_name, tmp_dir.join(format!("lib{crate_name}.rlib")))
.extern_(proc_crate_name, tmp_dir.join(dylib_name.trim()))
.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());
}

0 comments on commit 428bc4a

Please sign in to comment.