forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdispatcher.rs
37 lines (34 loc) · 1.18 KB
/
dispatcher.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! rustbuild, the Rust build system
//!
//! This is the entry point for the build system used to compile the `rustc`
//! compiler. Lots of documentation can be found in the `README.md` file in the
//! parent directory, and otherwise documentation can be found throughout the `build`
//! directory in each respective module.
use std::env;
use std::env::consts::EXE_SUFFIX;
use std::ffi::OsStr;
use std::path::Path;
mod bootstrap;
mod llvm_config_wrapper;
mod rustc;
mod rustdoc;
mod sccache_plus_cl;
fn main() {
match env::args_os()
.next()
.as_deref()
.map(Path::new)
.and_then(Path::file_name)
.and_then(OsStr::to_str)
.map(|s| s.strip_suffix(EXE_SUFFIX).unwrap_or(s))
{
// the shim name is here to make default-run work.
Some("bootstrap" | "rustbuild-binary-dispatch-shim") => bootstrap::main(),
Some("rustc") => rustc::main(),
Some("rustdoc") => rustdoc::main(),
Some("sccache-plus-cl") => sccache_plus_cl::main(),
Some("llvm-config-wrapper") => llvm_config_wrapper::main(),
Some(arg) => panic!("invalid executable name: {}", arg),
None => panic!("argv[0] does not exist"),
}
}