Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate rustdoc target spec json path #125071

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/tools/run-make-support/src/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ impl Rustdoc {
self
}

/// Specify the target triple, or a path to a custom target json spec file.
pub fn target(&mut self, target: &str) -> &mut Self {
self.cmd.arg(format!("--target={target}"));
self
}

/// Specify the crate type.
pub fn crate_type(&mut self, crate_type: &str) -> &mut Self {
self.cmd.arg("--crate-type");
Expand All @@ -137,6 +143,14 @@ impl Rustdoc {
self
}

/// Add a directory to the library search path. It corresponds to the `-L`
/// rustdoc option.
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
self.cmd.arg("-L");
self.cmd.arg(path.as_ref());
self
}

#[track_caller]
pub fn run_fail_assert_exit_code(&mut self, code: i32) -> Output {
let caller_location = std::panic::Location::caller();
Expand Down
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 @@ -251,7 +251,6 @@ run-make/rustdoc-scrape-examples-multiple/Makefile
run-make/rustdoc-scrape-examples-remap/Makefile
run-make/rustdoc-scrape-examples-test/Makefile
run-make/rustdoc-scrape-examples-whitespace/Makefile
run-make/rustdoc-target-spec-json-path/Makefile
run-make/rustdoc-themes/Makefile
run-make/rustdoc-verify-output-files/Makefile
run-make/rustdoc-with-out-dir-option/Makefile
Expand Down
9 changes: 0 additions & 9 deletions tests/run-make/rustdoc-target-spec-json-path/Makefile

This file was deleted.

14 changes: 14 additions & 0 deletions tests/run-make/rustdoc-target-spec-json-path/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Test that rustdoc will properly canonicalize the target spec json path just like rustc.

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

fn main() {
let out_dir = tmp_dir().join("rustdoc-target-spec-json-path");
rustc().crate_type("lib").input("dummy_core.rs").target("target.json").run();
rustdoc()
.input("my_crate.rs")
.output(out_dir)
.library_search_path(tmp_dir())
.target("target.json")
.run();
}
Loading