diff options
| author | Jerry Wang <jerrylwang123@gmail.com> | 2024-07-15 19:42:45 -0400 |
|---|---|---|
| committer | Jerry Wang <jerrylwang123@gmail.com> | 2024-07-17 16:47:39 -0400 |
| commit | a9e14668d62b294d8394b7aae08cf552ba2d684e (patch) | |
| tree | a4addfc6b87b2197e4ffe8c030bbd7fdf77937a6 /src | |
| parent | f00f85091904530ee8f5b29251c53571e0062a76 (diff) | |
| download | rust-a9e14668d62b294d8394b7aae08cf552ba2d684e.tar.gz rust-a9e14668d62b294d8394b7aae08cf552ba2d684e.zip | |
Add `llvm_components_contain` to `run-make-support`
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/run-make-support/src/lib.rs | 2 | ||||
| -rw-r--r-- | src/tools/run-make-support/src/targets.rs | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs index b15705e8965..e6a45f57de6 100644 --- a/src/tools/run-make-support/src/lib.rs +++ b/src/tools/run-make-support/src/lib.rs @@ -61,7 +61,7 @@ pub use env::{env_var, env_var_os}; pub use run::{cmd, run, run_fail, run_with_args}; /// Helpers for checking target information. -pub use targets::{is_darwin, is_msvc, is_windows, target, uname}; +pub use targets::{is_darwin, is_msvc, is_windows, llvm_components_contain, target, uname}; /// Helpers for building names of output artifacts that are potentially target-specific. pub use artifact_names::{ diff --git a/src/tools/run-make-support/src/targets.rs b/src/tools/run-make-support/src/targets.rs index 42d4a45680d..5dcb0b83430 100644 --- a/src/tools/run-make-support/src/targets.rs +++ b/src/tools/run-make-support/src/targets.rs @@ -28,6 +28,13 @@ pub fn is_darwin() -> bool { target().contains("darwin") } +/// Check if `component` is within `LLVM_COMPONENTS` +#[must_use] +pub fn llvm_components_contain(component: &str) -> bool { + // `LLVM_COMPONENTS` is a space-separated list of words + env_var("LLVM_COMPONENTS").split_whitespace().find(|s| s == &component).is_some() +} + /// Run `uname`. This assumes that `uname` is available on the platform! #[track_caller] #[must_use] |
