Remove all implicit "rustc" from rustc_info.rs
This commit is contained in:
parent
6900c9943d
commit
de8a4d5d46
@ -4,7 +4,7 @@
|
|||||||
use super::path::{Dirs, RelPath};
|
use super::path::{Dirs, RelPath};
|
||||||
use super::prepare::GitRepo;
|
use super::prepare::GitRepo;
|
||||||
use super::rustc_info::get_file_name;
|
use super::rustc_info::get_file_name;
|
||||||
use super::utils::{hyperfine_command, spawn_and_wait};
|
use super::utils::{hyperfine_command, spawn_and_wait, Compiler};
|
||||||
|
|
||||||
static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
|
static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
|
||||||
"ebobby",
|
"ebobby",
|
||||||
@ -13,11 +13,11 @@
|
|||||||
"<none>",
|
"<none>",
|
||||||
);
|
);
|
||||||
|
|
||||||
pub(crate) fn benchmark(dirs: &Dirs) {
|
pub(crate) fn benchmark(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
|
||||||
benchmark_simple_raytracer(dirs);
|
benchmark_simple_raytracer(dirs, bootstrap_host_compiler);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn benchmark_simple_raytracer(dirs: &Dirs) {
|
fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
|
||||||
if std::process::Command::new("hyperfine").output().is_err() {
|
if std::process::Command::new("hyperfine").output().is_err() {
|
||||||
eprintln!("Hyperfine not installed");
|
eprintln!("Hyperfine not installed");
|
||||||
eprintln!("Hint: Try `cargo install hyperfine` to install hyperfine");
|
eprintln!("Hint: Try `cargo install hyperfine` to install hyperfine");
|
||||||
@ -31,8 +31,9 @@ fn benchmark_simple_raytracer(dirs: &Dirs) {
|
|||||||
let bench_runs = env::var("BENCH_RUNS").unwrap_or_else(|_| "10".to_string()).parse().unwrap();
|
let bench_runs = env::var("BENCH_RUNS").unwrap_or_else(|_| "10".to_string()).parse().unwrap();
|
||||||
|
|
||||||
eprintln!("[BENCH COMPILE] ebobby/simple-raytracer");
|
eprintln!("[BENCH COMPILE] ebobby/simple-raytracer");
|
||||||
let cargo_clif =
|
let cargo_clif = RelPath::DIST
|
||||||
RelPath::DIST.to_path(dirs).join(get_file_name("cargo_clif", "bin").replace('_', "-"));
|
.to_path(dirs)
|
||||||
|
.join(get_file_name(&bootstrap_host_compiler.rustc, "cargo_clif", "bin").replace('_', "-"));
|
||||||
let manifest_path = SIMPLE_RAYTRACER_REPO.source_dir().to_path(dirs).join("Cargo.toml");
|
let manifest_path = SIMPLE_RAYTRACER_REPO.source_dir().to_path(dirs).join("Cargo.toml");
|
||||||
let target_dir = RelPath::BUILD.join("simple_raytracer").to_path(dirs);
|
let target_dir = RelPath::BUILD.join("simple_raytracer").to_path(dirs);
|
||||||
|
|
||||||
@ -75,9 +76,18 @@ fn benchmark_simple_raytracer(dirs: &Dirs) {
|
|||||||
bench_runs,
|
bench_runs,
|
||||||
None,
|
None,
|
||||||
&[
|
&[
|
||||||
Path::new(".").join(get_file_name("raytracer_cg_llvm", "bin")).to_str().unwrap(),
|
Path::new(".")
|
||||||
Path::new(".").join(get_file_name("raytracer_cg_clif", "bin")).to_str().unwrap(),
|
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_llvm", "bin"))
|
||||||
Path::new(".").join(get_file_name("raytracer_cg_clif_opt", "bin")).to_str().unwrap(),
|
.to_str()
|
||||||
|
.unwrap(),
|
||||||
|
Path::new(".")
|
||||||
|
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_clif", "bin"))
|
||||||
|
.to_str()
|
||||||
|
.unwrap(),
|
||||||
|
Path::new(".")
|
||||||
|
.join(get_file_name(&bootstrap_host_compiler.rustc, "raytracer_cg_clif_opt", "bin"))
|
||||||
|
.to_str()
|
||||||
|
.unwrap(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
bench_run.current_dir(RelPath::BUILD.to_path(dirs));
|
bench_run.current_dir(RelPath::BUILD.to_path(dirs));
|
||||||
|
@ -52,5 +52,5 @@ pub(crate) fn build_backend(
|
|||||||
.target_dir(dirs)
|
.target_dir(dirs)
|
||||||
.join(&bootstrap_host_compiler.triple)
|
.join(&bootstrap_host_compiler.triple)
|
||||||
.join(channel)
|
.join(channel)
|
||||||
.join(get_file_name("rustc_codegen_cranelift", "dylib"))
|
.join(get_file_name(&bootstrap_host_compiler.rustc, "rustc_codegen_cranelift", "dylib"))
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ pub(crate) fn build_sysroot(
|
|||||||
try_hard_link(cg_clif_dylib_src, &cg_clif_dylib_path);
|
try_hard_link(cg_clif_dylib_src, &cg_clif_dylib_path);
|
||||||
|
|
||||||
// Build and copy rustc and cargo wrappers
|
// Build and copy rustc and cargo wrappers
|
||||||
let wrapper_base_name = get_file_name("____", "bin");
|
let wrapper_base_name = get_file_name(&bootstrap_host_compiler.rustc, "____", "bin");
|
||||||
let toolchain_name = get_toolchain_name();
|
let toolchain_name = get_toolchain_name();
|
||||||
for wrapper in ["rustc-clif", "rustdoc-clif", "cargo-clif"] {
|
for wrapper in ["rustc-clif", "rustdoc-clif", "cargo-clif"] {
|
||||||
let wrapper_name = wrapper_base_name.replace("____", wrapper);
|
let wrapper_name = wrapper_base_name.replace("____", wrapper);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::path::PathBuf;
|
use std::path::{Path, PathBuf};
|
||||||
use std::process;
|
use std::process;
|
||||||
|
|
||||||
use self::utils::{is_ci, is_ci_opt, Compiler};
|
use self::utils::{is_ci, is_ci_opt, Compiler};
|
||||||
@ -105,7 +105,7 @@ pub(crate) fn main() {
|
|||||||
std::env::var("HOST_TRIPLE")
|
std::env::var("HOST_TRIPLE")
|
||||||
.ok()
|
.ok()
|
||||||
.or_else(|| config::get_value("host"))
|
.or_else(|| config::get_value("host"))
|
||||||
.unwrap_or_else(|| rustc_info::get_host_triple()),
|
.unwrap_or_else(|| rustc_info::get_host_triple(Path::new("rustc"))),
|
||||||
);
|
);
|
||||||
let target_triple = std::env::var("TARGET_TRIPLE")
|
let target_triple = std::env::var("TARGET_TRIPLE")
|
||||||
.ok()
|
.ok()
|
||||||
@ -187,7 +187,7 @@ pub(crate) fn main() {
|
|||||||
&bootstrap_host_compiler,
|
&bootstrap_host_compiler,
|
||||||
target_triple,
|
target_triple,
|
||||||
);
|
);
|
||||||
bench::benchmark(&dirs);
|
bench::benchmark(&dirs, &bootstrap_host_compiler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,9 @@ pub(crate) fn get_rustc_version(rustc: &Path) -> String {
|
|||||||
String::from_utf8(version_info).unwrap()
|
String::from_utf8(version_info).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_host_triple() -> String {
|
pub(crate) fn get_host_triple(rustc: &Path) -> String {
|
||||||
let version_info =
|
let version_info =
|
||||||
Command::new("rustc").stderr(Stdio::inherit()).args(&["-vV"]).output().unwrap().stdout;
|
Command::new(rustc).stderr(Stdio::inherit()).args(&["-vV"]).output().unwrap().stdout;
|
||||||
String::from_utf8(version_info)
|
String::from_utf8(version_info)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.lines()
|
.lines()
|
||||||
@ -73,8 +73,8 @@ pub(crate) fn get_default_sysroot(rustc: &Path) -> PathBuf {
|
|||||||
Path::new(String::from_utf8(default_sysroot).unwrap().trim()).to_owned()
|
Path::new(String::from_utf8(default_sysroot).unwrap().trim()).to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_file_name(crate_name: &str, crate_type: &str) -> String {
|
pub(crate) fn get_file_name(rustc: &Path, crate_name: &str, crate_type: &str) -> String {
|
||||||
let file_name = Command::new("rustc")
|
let file_name = Command::new(rustc)
|
||||||
.stderr(Stdio::inherit())
|
.stderr(Stdio::inherit())
|
||||||
.args(&[
|
.args(&[
|
||||||
"--crate-name",
|
"--crate-name",
|
||||||
|
Loading…
Reference in New Issue
Block a user