Rollup merge of #129122 - GuillaumeGomez:remove-duplicated-rustdoc-output-methods, r=Kobzol

Remove duplicated `Rustdoc::output` method from `run-make-support` lib

I discovered recently that `--output` is deprecated in rustdoc and that `--out-dir` is doing the exact same thing. To keep things along with the current rustdoc status, I removed the `Rustdoc::output` method.

cc `@jieyouxu`
r? `@Kobzol`
This commit is contained in:
Matthias Krüger 2024-08-15 19:32:38 +02:00 committed by GitHub
commit bc986c7290
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 21 additions and 27 deletions

View File

@ -71,14 +71,8 @@ impl Rustdoc {
self
}
/// Specify path to the output folder.
pub fn output<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
self.cmd.arg("-o");
self.cmd.arg(path.as_ref());
self
}
/// Specify output directory.
#[doc(alias = "output")]
pub fn out_dir<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
self.cmd.arg("--out-dir").arg(path.as_ref());
self

View File

@ -12,5 +12,5 @@ use run_make_support::{cwd, rustc, rustdoc};
fn main() {
rustc().input("foo.rs").run();
rustc().input("bar.rs").run();
rustdoc().input("baz.rs").library_search_path(cwd()).output(cwd()).run();
rustdoc().input("baz.rs").library_search_path(cwd()).out_dir(cwd()).run();
}

View File

@ -13,7 +13,7 @@ fn main() {
rustdoc()
.arg("-Zunstable-options")
.arg("--emit=invocation-specific")
.output("invocation-only")
.out_dir("invocation-only")
.arg("--resource-suffix=-xxx")
.args(&["--theme", "y.css"])
.args(&["--extend-css", "z.css"])
@ -34,7 +34,7 @@ fn main() {
rustdoc()
.arg("-Zunstable-options")
.arg("--emit=toolchain-shared-resources")
.output("toolchain-only")
.out_dir("toolchain-only")
.arg("--resource-suffix=-xxx")
.args(&["--extend-css", "z.css"])
.input("x.rs")
@ -68,7 +68,7 @@ fn main() {
rustdoc()
.arg("-Zunstable-options")
.arg("--emit=toolchain-shared-resources,unversioned-shared-resources")
.output("all-shared")
.out_dir("all-shared")
.arg("--resource-suffix=-xxx")
.args(&["--extend-css", "z.css"])
.input("x.rs")

View File

@ -16,7 +16,7 @@ fn main() {
.run_fail()
.assert_exit_code(101);
rustdoc().arg("success.rs").output("exit-code").run();
rustdoc().arg("success.rs").out_dir("exit-code").run();
rustdoc().arg("--invalid-arg-foo").run_fail().assert_exit_code(1);

View File

@ -7,12 +7,12 @@ use run_make_support::{diff, rustdoc};
fn main() {
let foo_first = Path::new("foo_first");
rustdoc().input("foo.rs").output(&foo_first).run();
rustdoc().input("bar.rs").output(&foo_first).run();
rustdoc().input("foo.rs").out_dir(&foo_first).run();
rustdoc().input("bar.rs").out_dir(&foo_first).run();
let bar_first = Path::new("bar_first");
rustdoc().input("bar.rs").output(&bar_first).run();
rustdoc().input("foo.rs").output(&bar_first).run();
rustdoc().input("bar.rs").out_dir(&bar_first).run();
rustdoc().input("foo.rs").out_dir(&bar_first).run();
diff()
.expected_file(foo_first.join("search-index.js"))

View File

@ -25,7 +25,7 @@ fn main() {
permissions.set_readonly(true);
rfs::set_permissions(&out_dir, permissions);
let output = rustdoc().input("foo.rs").output(&out_dir).env("RUST_BACKTRACE", "1").run_fail();
let output = rustdoc().input("foo.rs").out_dir(&out_dir).env("RUST_BACKTRACE", "1").run_fail();
rfs::set_permissions(&out_dir, original_permissions);

View File

@ -6,7 +6,7 @@ fn main() {
.input("foo.rs")
.arg("-Zunstable-options")
.arg("--generate-redirect-map")
.output(&out_dir)
.out_dir(&out_dir)
.run();
// FIXME (GuillaumeGomez): Port the python script to Rust as well.
python_command().arg("validate_json.py").arg(&out_dir).run();

View File

@ -6,6 +6,6 @@ use run_make_support::rustdoc;
fn main() {
let out_dir = Path::new("foo/bar/doc");
rustdoc().input("foo.rs").output(&out_dir).run();
rustdoc().input("foo.rs").out_dir(&out_dir).run();
assert!(out_dir.exists());
}

View File

@ -10,7 +10,7 @@ fn main() {
// First we check that we generate the JSON in the stdout.
rustdoc()
.input("foo.rs")
.output("-")
.out_dir("-")
.arg("-Zunstable-options")
.output_format("json")
.run()

View File

@ -35,7 +35,7 @@ fn main() {
.input("examples/ex.rs")
.crate_name("ex")
.crate_type("bin")
.output(&out_dir)
.out_dir(&out_dir)
.extern_(crate_name, rust_lib_name(crate_name))
.extern_(proc_crate_name, dylib_name.trim())
.arg("-Zunstable-options")
@ -49,7 +49,7 @@ fn main() {
.input("src/lib.rs")
.crate_name(crate_name)
.crate_type("lib")
.output(&out_dir)
.out_dir(&out_dir)
.arg("-Zunstable-options")
.arg("--with-examples")
.arg(&ex_dir)

View File

@ -20,7 +20,7 @@ pub fn scrape(extra_args: &[&str]) {
.input(&dep)
.crate_name(&dep_stem)
.crate_type("bin")
.output(&out_dir)
.out_dir(&out_dir)
.extern_(crate_name, format!("lib{crate_name}.rmeta"))
.arg("-Zunstable-options")
.arg("--scrape-examples-output-path")
@ -35,7 +35,7 @@ pub fn scrape(extra_args: &[&str]) {
let mut rustdoc = rustdoc();
rustdoc
.input("src/lib.rs")
.output(&out_dir)
.out_dir(&out_dir)
.crate_name(crate_name)
.crate_type("lib")
.arg("-Zunstable-options");

View File

@ -7,7 +7,7 @@ fn main() {
rustc().crate_type("lib").input("dummy_core.rs").target("target.json").run();
rustdoc()
.input("my_crate.rs")
.output(out_dir)
.out_dir(out_dir)
.library_search_path(cwd())
.target("target.json")
.run();

View File

@ -27,6 +27,6 @@ fn main() {
rfs::create_dir_all(&out_dir);
rfs::write(&test_css, test_content);
rustdoc().output(&out_dir).input("foo.rs").arg("--theme").arg(&test_css).run();
rustdoc().out_dir(&out_dir).input("foo.rs").arg("--theme").arg(&test_css).run();
htmldocck().arg(out_dir).arg("foo.rs").run();
}

View File

@ -2,6 +2,6 @@ use run_make_support::{htmldocck, rustdoc};
fn main() {
let out_dir = "rustdoc";
rustdoc().input("src/lib.rs").crate_name("foobar").crate_type("lib").output(&out_dir).run();
rustdoc().input("src/lib.rs").crate_name("foobar").crate_type("lib").out_dir(&out_dir).run();
htmldocck().arg(out_dir).arg("src/lib.rs").run();
}