run_make_support: move external deps to external_deps
module
This commit is contained in:
parent
a02008edac
commit
288c572745
@ -1,5 +1,5 @@
|
||||
use std::ffi::OsString;
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
|
||||
#[track_caller]
|
||||
#[must_use]
|
||||
|
14
src/tools/run-make-support/src/external_deps/htmldocck.rs
Normal file
14
src/tools/run-make-support/src/external_deps/htmldocck.rs
Normal file
@ -0,0 +1,14 @@
|
||||
use crate::command::Command;
|
||||
use crate::source_root;
|
||||
|
||||
use super::python::python_command;
|
||||
|
||||
/// `htmldocck` is a python script which is used for rustdoc test suites, it is assumed to be
|
||||
/// available at `$SOURCE_ROOT/src/etc/htmldocck.py`.
|
||||
#[track_caller]
|
||||
#[must_use]
|
||||
pub fn htmldocck() -> Command {
|
||||
let mut python = python_command();
|
||||
python.arg(source_root().join("src/etc/htmldocck.py"));
|
||||
python
|
||||
}
|
10
src/tools/run-make-support/src/external_deps/mod.rs
Normal file
10
src/tools/run-make-support/src/external_deps/mod.rs
Normal file
@ -0,0 +1,10 @@
|
||||
//! This module contains external tool dependencies that we assume are available in the environment,
|
||||
//! such as `cc` or `python`.
|
||||
|
||||
pub mod cc;
|
||||
pub mod clang;
|
||||
pub mod htmldocck;
|
||||
pub mod llvm;
|
||||
pub mod python;
|
||||
pub mod rustc;
|
||||
pub mod rustdoc;
|
11
src/tools/run-make-support/src/external_deps/python.rs
Normal file
11
src/tools/run-make-support/src/external_deps/python.rs
Normal file
@ -0,0 +1,11 @@
|
||||
use crate::command::Command;
|
||||
use crate::env_checked::env_var;
|
||||
|
||||
/// Obtain path of python as provided by the `PYTHON` environment variable. It is up to the caller
|
||||
/// to document and check if the python version is compatible with its intended usage.
|
||||
#[track_caller]
|
||||
#[must_use]
|
||||
pub fn python_command() -> Command {
|
||||
let python_path = env_var("PYTHON");
|
||||
Command::new(python_path)
|
||||
}
|
@ -3,17 +3,13 @@
|
||||
//! notably is built via cargo: this means that if your test wants some non-trivial utility, such
|
||||
//! as `object` or `wasmparser`, they can be re-exported and be made available through this library.
|
||||
|
||||
pub mod cc;
|
||||
pub mod clang;
|
||||
mod command;
|
||||
pub mod diff;
|
||||
pub mod env_checked;
|
||||
pub mod external_deps;
|
||||
pub mod fs_wrapper;
|
||||
pub mod llvm;
|
||||
mod macros;
|
||||
pub mod run;
|
||||
pub mod rustc;
|
||||
pub mod rustdoc;
|
||||
pub mod targets;
|
||||
|
||||
use std::fs;
|
||||
@ -27,17 +23,26 @@ pub use object;
|
||||
pub use regex;
|
||||
pub use wasmparser;
|
||||
|
||||
// Re-exports of external dependencies.
|
||||
pub use external_deps::{cc, clang, htmldocck, llvm, python, rustc, rustdoc};
|
||||
|
||||
pub use cc::{cc, extra_c_flags, extra_cxx_flags, Cc};
|
||||
pub use clang::{clang, Clang};
|
||||
pub use diff::{diff, Diff};
|
||||
pub use env_checked::{env_var, env_var_os};
|
||||
pub use htmldocck::htmldocck;
|
||||
pub use llvm::{
|
||||
llvm_ar, llvm_filecheck, llvm_objdump, llvm_profdata, llvm_readobj, LlvmAr, LlvmFilecheck,
|
||||
LlvmObjdump, LlvmProfdata, LlvmReadobj,
|
||||
};
|
||||
pub use run::{cmd, run, run_fail, run_with_args};
|
||||
pub use python::python_command;
|
||||
pub use rustc::{aux_build, bare_rustc, rustc, Rustc};
|
||||
pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};
|
||||
|
||||
pub use diff::{diff, Diff};
|
||||
|
||||
pub use env_checked::{env_var, env_var_os};
|
||||
|
||||
pub use run::{cmd, run, run_fail, run_with_args};
|
||||
|
||||
pub use targets::{is_darwin, is_msvc, is_windows, target, uname};
|
||||
|
||||
use command::{Command, CompletedProcess};
|
||||
@ -55,21 +60,6 @@ pub fn ar(inputs: &[impl AsRef<Path>], output_path: impl AsRef<Path>) {
|
||||
}
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
#[must_use]
|
||||
pub fn python_command() -> Command {
|
||||
let python_path = env_var("PYTHON");
|
||||
Command::new(python_path)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
#[must_use]
|
||||
pub fn htmldocck() -> Command {
|
||||
let mut python = python_command();
|
||||
python.arg(source_root().join("src/etc/htmldocck.py"));
|
||||
python
|
||||
}
|
||||
|
||||
/// Returns the path for a local test file.
|
||||
pub fn path<P: AsRef<Path>>(p: P) -> PathBuf {
|
||||
cwd().join(p.as_ref())
|
||||
|
Loading…
x
Reference in New Issue
Block a user