Introduce Dirs type to avoid hard coding src and dest locations
This commit is contained in:
parent
4529979330
commit
82b2d8e418
8 changed files with 207 additions and 158 deletions
|
|
@ -2,6 +2,7 @@ use std::path::Path;
|
|||
|
||||
use super::build_sysroot;
|
||||
use super::config;
|
||||
use super::path::Dirs;
|
||||
use super::prepare::GitRepo;
|
||||
use super::utils::{spawn_and_wait, CargoProject, Compiler};
|
||||
use super::SysrootKind;
|
||||
|
|
@ -14,6 +15,7 @@ static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "
|
|||
pub(crate) fn run(
|
||||
channel: &str,
|
||||
sysroot_kind: SysrootKind,
|
||||
dirs: &Dirs,
|
||||
cg_clif_dylib: &Path,
|
||||
host_triple: &str,
|
||||
target_triple: &str,
|
||||
|
|
@ -29,19 +31,26 @@ pub(crate) fn run(
|
|||
}
|
||||
|
||||
eprintln!("Building sysroot for abi-cafe");
|
||||
build_sysroot::build_sysroot(channel, sysroot_kind, cg_clif_dylib, host_triple, target_triple);
|
||||
build_sysroot::build_sysroot(
|
||||
dirs,
|
||||
channel,
|
||||
sysroot_kind,
|
||||
cg_clif_dylib,
|
||||
host_triple,
|
||||
target_triple,
|
||||
);
|
||||
|
||||
eprintln!("Running abi-cafe");
|
||||
|
||||
let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"];
|
||||
|
||||
let mut cmd = ABI_CAFE.run(&Compiler::host());
|
||||
let mut cmd = ABI_CAFE.run(&Compiler::host(), dirs);
|
||||
cmd.arg("--");
|
||||
cmd.arg("--pairs");
|
||||
cmd.args(pairs);
|
||||
cmd.arg("--add-rustc-codegen-backend");
|
||||
cmd.arg(format!("cgclif:{}", cg_clif_dylib.display()));
|
||||
cmd.current_dir(ABI_CAFE.source_dir());
|
||||
cmd.current_dir(ABI_CAFE.source_dir(dirs));
|
||||
|
||||
spawn_and_wait(cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use super::path::RelPath;
|
||||
use super::path::{Dirs, RelPath};
|
||||
use super::rustc_info::get_file_name;
|
||||
use super::utils::{is_ci, CargoProject, Compiler};
|
||||
|
||||
static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
|
||||
|
||||
pub(crate) fn build_backend(
|
||||
dirs: &Dirs,
|
||||
channel: &str,
|
||||
host_triple: &str,
|
||||
use_unstable_features: bool,
|
||||
) -> PathBuf {
|
||||
let mut cmd = CG_CLIF.build(&Compiler::host());
|
||||
let mut cmd = CG_CLIF.build(&Compiler::host(), dirs);
|
||||
|
||||
cmd.env("CARGO_BUILD_INCREMENTAL", "true"); // Force incr comp even in release mode
|
||||
|
||||
|
|
@ -44,7 +45,7 @@ pub(crate) fn build_backend(
|
|||
super::utils::spawn_and_wait(cmd);
|
||||
|
||||
CG_CLIF
|
||||
.target_dir()
|
||||
.target_dir(dirs)
|
||||
.join(host_triple)
|
||||
.join(channel)
|
||||
.join(get_file_name("rustc_codegen_cranelift", "dylib"))
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::fs;
|
|||
use std::path::Path;
|
||||
use std::process::{self, Command};
|
||||
|
||||
use super::path::RelPath;
|
||||
use super::path::{Dirs, RelPath};
|
||||
use super::rustc_info::{get_file_name, get_rustc_version, get_wrapper_file_name};
|
||||
use super::utils::{spawn_and_wait, try_hard_link, CargoProject, Compiler};
|
||||
use super::SysrootKind;
|
||||
|
|
@ -13,6 +13,7 @@ static LIB_DIR: RelPath = RelPath::DIST.join("lib");
|
|||
static RUSTLIB_DIR: RelPath = LIB_DIR.join("rustlib");
|
||||
|
||||
pub(crate) fn build_sysroot(
|
||||
dirs: &Dirs,
|
||||
channel: &str,
|
||||
sysroot_kind: SysrootKind,
|
||||
cg_clif_dylib_src: &Path,
|
||||
|
|
@ -21,9 +22,9 @@ pub(crate) fn build_sysroot(
|
|||
) {
|
||||
eprintln!("[BUILD] sysroot {:?}", sysroot_kind);
|
||||
|
||||
DIST_DIR.ensure_fresh();
|
||||
BIN_DIR.ensure_exists();
|
||||
LIB_DIR.ensure_exists();
|
||||
DIST_DIR.ensure_fresh(dirs);
|
||||
BIN_DIR.ensure_exists(dirs);
|
||||
LIB_DIR.ensure_exists(dirs);
|
||||
|
||||
// Copy the backend
|
||||
let cg_clif_dylib_path = if cfg!(windows) {
|
||||
|
|
@ -33,7 +34,7 @@ pub(crate) fn build_sysroot(
|
|||
} else {
|
||||
LIB_DIR
|
||||
}
|
||||
.to_path()
|
||||
.to_path(dirs)
|
||||
.join(get_file_name("rustc_codegen_cranelift", "dylib"));
|
||||
try_hard_link(cg_clif_dylib_src, &cg_clif_dylib_path);
|
||||
|
||||
|
|
@ -43,17 +44,17 @@ pub(crate) fn build_sysroot(
|
|||
|
||||
let mut build_cargo_wrapper_cmd = Command::new("rustc");
|
||||
build_cargo_wrapper_cmd
|
||||
.arg(RelPath::SCRIPTS.to_path().join(&format!("{wrapper}.rs")))
|
||||
.arg(RelPath::SCRIPTS.to_path(dirs).join(&format!("{wrapper}.rs")))
|
||||
.arg("-o")
|
||||
.arg(DIST_DIR.to_path().join(wrapper_name))
|
||||
.arg(DIST_DIR.to_path(dirs).join(wrapper_name))
|
||||
.arg("-g");
|
||||
spawn_and_wait(build_cargo_wrapper_cmd);
|
||||
}
|
||||
|
||||
let default_sysroot = super::rustc_info::get_default_sysroot();
|
||||
|
||||
let host_rustlib_lib = RUSTLIB_DIR.to_path().join(host_triple).join("lib");
|
||||
let target_rustlib_lib = RUSTLIB_DIR.to_path().join(target_triple).join("lib");
|
||||
let host_rustlib_lib = RUSTLIB_DIR.to_path(dirs).join(host_triple).join("lib");
|
||||
let target_rustlib_lib = RUSTLIB_DIR.to_path(dirs).join(target_triple).join("lib");
|
||||
fs::create_dir_all(&host_rustlib_lib).unwrap();
|
||||
fs::create_dir_all(&target_rustlib_lib).unwrap();
|
||||
|
||||
|
|
@ -114,7 +115,7 @@ pub(crate) fn build_sysroot(
|
|||
}
|
||||
}
|
||||
SysrootKind::Clif => {
|
||||
build_clif_sysroot_for_triple(channel, host_triple, &cg_clif_dylib_path, None);
|
||||
build_clif_sysroot_for_triple(dirs, channel, host_triple, &cg_clif_dylib_path, None);
|
||||
|
||||
if host_triple != target_triple {
|
||||
// When cross-compiling it is often necessary to manually pick the right linker
|
||||
|
|
@ -123,7 +124,13 @@ pub(crate) fn build_sysroot(
|
|||
} else {
|
||||
None
|
||||
};
|
||||
build_clif_sysroot_for_triple(channel, target_triple, &cg_clif_dylib_path, linker);
|
||||
build_clif_sysroot_for_triple(
|
||||
dirs,
|
||||
channel,
|
||||
target_triple,
|
||||
&cg_clif_dylib_path,
|
||||
linker,
|
||||
);
|
||||
}
|
||||
|
||||
// Copy std for the host to the lib dir. This is necessary for the jit mode to find
|
||||
|
|
@ -132,7 +139,7 @@ pub(crate) fn build_sysroot(
|
|||
let file = file.unwrap().path();
|
||||
let filename = file.file_name().unwrap().to_str().unwrap();
|
||||
if filename.contains("std-") && !filename.contains(".rlib") {
|
||||
try_hard_link(&file, LIB_DIR.to_path().join(file.file_name().unwrap()));
|
||||
try_hard_link(&file, LIB_DIR.to_path(dirs).join(file.file_name().unwrap()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -145,12 +152,13 @@ pub(crate) static SYSROOT_SRC: RelPath = RelPath::BUILD_SYSROOT.join("sysroot_sr
|
|||
static STANDARD_LIBRARY: CargoProject = CargoProject::new(&RelPath::BUILD_SYSROOT, "build_sysroot");
|
||||
|
||||
fn build_clif_sysroot_for_triple(
|
||||
dirs: &Dirs,
|
||||
channel: &str,
|
||||
triple: &str,
|
||||
cg_clif_dylib_path: &Path,
|
||||
linker: Option<&str>,
|
||||
) {
|
||||
match fs::read_to_string(SYSROOT_RUSTC_VERSION.to_path()) {
|
||||
match fs::read_to_string(SYSROOT_RUSTC_VERSION.to_path(dirs)) {
|
||||
Err(e) => {
|
||||
eprintln!("Failed to get rustc version for patched sysroot source: {}", e);
|
||||
eprintln!("Hint: Try `./y.rs prepare` to patch the sysroot source");
|
||||
|
|
@ -168,7 +176,7 @@ fn build_clif_sysroot_for_triple(
|
|||
}
|
||||
}
|
||||
|
||||
let build_dir = STANDARD_LIBRARY.target_dir().join(triple).join(channel);
|
||||
let build_dir = STANDARD_LIBRARY.target_dir(dirs).join(triple).join(channel);
|
||||
|
||||
if !super::config::get_bool("keep_sysroot") {
|
||||
// Cleanup the deps dir, but keep build scripts and the incremental cache for faster
|
||||
|
|
@ -181,7 +189,7 @@ fn build_clif_sysroot_for_triple(
|
|||
// Build sysroot
|
||||
let mut rustflags = "-Zforce-unstable-if-unmarked -Cpanic=abort".to_string();
|
||||
rustflags.push_str(&format!(" -Zcodegen-backend={}", cg_clif_dylib_path.to_str().unwrap()));
|
||||
rustflags.push_str(&format!(" --sysroot={}", DIST_DIR.to_path().to_str().unwrap()));
|
||||
rustflags.push_str(&format!(" --sysroot={}", DIST_DIR.to_path(dirs).to_str().unwrap()));
|
||||
if channel == "release" {
|
||||
rustflags.push_str(" -Zmir-opt-level=3");
|
||||
}
|
||||
|
|
@ -191,7 +199,7 @@ fn build_clif_sysroot_for_triple(
|
|||
}
|
||||
let mut compiler = Compiler::with_triple(triple.to_owned());
|
||||
compiler.rustflags = rustflags;
|
||||
let mut build_cmd = STANDARD_LIBRARY.build(&compiler);
|
||||
let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs);
|
||||
if channel == "release" {
|
||||
build_cmd.arg("--release");
|
||||
}
|
||||
|
|
@ -210,7 +218,7 @@ fn build_clif_sysroot_for_triple(
|
|||
};
|
||||
try_hard_link(
|
||||
entry.path(),
|
||||
RUSTLIB_DIR.to_path().join(triple).join("lib").join(entry.file_name()),
|
||||
RUSTLIB_DIR.to_path(dirs).join(triple).join("lib").join(entry.file_name()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
|
||||
use self::utils::is_ci;
|
||||
|
|
@ -17,12 +16,8 @@ mod utils;
|
|||
fn usage() {
|
||||
eprintln!("Usage:");
|
||||
eprintln!(" ./y.rs prepare");
|
||||
eprintln!(
|
||||
" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--dist-dir DIR] [--no-unstable-features]"
|
||||
);
|
||||
eprintln!(
|
||||
" ./y.rs test [--debug] [--sysroot none|clif|llvm] [--dist-dir DIR] [--no-unstable-features]"
|
||||
);
|
||||
eprintln!(" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--no-unstable-features]");
|
||||
eprintln!(" ./y.rs test [--debug] [--sysroot none|clif|llvm] [--no-unstable-features]");
|
||||
}
|
||||
|
||||
macro_rules! arg_error {
|
||||
|
|
@ -50,13 +45,22 @@ pub fn main() {
|
|||
env::set_var("CG_CLIF_DISPLAY_CG_TIME", "1");
|
||||
env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
|
||||
|
||||
std::fs::create_dir_all("build").unwrap();
|
||||
let current_dir = std::env::current_dir().unwrap();
|
||||
let dirs = path::Dirs {
|
||||
source_dir: current_dir.clone(),
|
||||
download_dir: current_dir.join("download"),
|
||||
build_dir: current_dir.join("build"),
|
||||
dist_dir: current_dir.join("dist"),
|
||||
};
|
||||
|
||||
path::RelPath::BUILD.ensure_exists(&dirs);
|
||||
|
||||
{
|
||||
// Make sure we always explicitly specify the target dir
|
||||
let target = "build/target_dir_should_be_set_explicitly";
|
||||
env::set_var("CARGO_TARGET_DIR", target);
|
||||
let _ = std::fs::remove_file(target);
|
||||
let target =
|
||||
path::RelPath::BUILD.join("target_dir_should_be_set_explicitly").to_path(&dirs);
|
||||
env::set_var("CARGO_TARGET_DIR", &target);
|
||||
let _ = std::fs::remove_file(&target);
|
||||
std::fs::File::create(target).unwrap();
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +75,7 @@ pub fn main() {
|
|||
if args.next().is_some() {
|
||||
arg_error!("./y.rs prepare doesn't expect arguments");
|
||||
}
|
||||
prepare::prepare();
|
||||
prepare::prepare(&dirs);
|
||||
process::exit(0);
|
||||
}
|
||||
Some("build") => Command::Build,
|
||||
|
|
@ -84,17 +88,11 @@ pub fn main() {
|
|||
}
|
||||
};
|
||||
|
||||
let mut dist_dir = PathBuf::from("dist");
|
||||
let mut channel = "release";
|
||||
let mut sysroot_kind = SysrootKind::Clif;
|
||||
let mut use_unstable_features = true;
|
||||
while let Some(arg) = args.next().as_deref() {
|
||||
match arg {
|
||||
"--dist-dir" => {
|
||||
dist_dir = PathBuf::from(args.next().unwrap_or_else(|| {
|
||||
arg_error!("--dist-dir requires argument");
|
||||
}))
|
||||
}
|
||||
"--debug" => channel = "debug",
|
||||
"--sysroot" => {
|
||||
sysroot_kind = match args.next().as_deref() {
|
||||
|
|
@ -110,7 +108,6 @@ pub fn main() {
|
|||
arg => arg_error!("Unexpected argument {}", arg),
|
||||
}
|
||||
}
|
||||
dist_dir = std::env::current_dir().unwrap().join(dist_dir);
|
||||
|
||||
let host_triple = if let Ok(host_triple) = std::env::var("HOST_TRIPLE") {
|
||||
host_triple
|
||||
|
|
@ -131,15 +128,31 @@ pub fn main() {
|
|||
host_triple.clone()
|
||||
};
|
||||
|
||||
let cg_clif_dylib = build_backend::build_backend(channel, &host_triple, use_unstable_features);
|
||||
let cg_clif_dylib =
|
||||
build_backend::build_backend(&dirs, channel, &host_triple, use_unstable_features);
|
||||
match command {
|
||||
Command::Test => {
|
||||
tests::run_tests(channel, sysroot_kind, &cg_clif_dylib, &host_triple, &target_triple);
|
||||
tests::run_tests(
|
||||
&dirs,
|
||||
channel,
|
||||
sysroot_kind,
|
||||
&cg_clif_dylib,
|
||||
&host_triple,
|
||||
&target_triple,
|
||||
);
|
||||
|
||||
abi_cafe::run(channel, sysroot_kind, &cg_clif_dylib, &host_triple, &target_triple);
|
||||
abi_cafe::run(
|
||||
channel,
|
||||
sysroot_kind,
|
||||
&dirs,
|
||||
&cg_clif_dylib,
|
||||
&host_triple,
|
||||
&target_triple,
|
||||
);
|
||||
}
|
||||
Command::Build => {
|
||||
build_sysroot::build_sysroot(
|
||||
&dirs,
|
||||
channel,
|
||||
sysroot_kind,
|
||||
&cg_clif_dylib,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/*pub(crate) struct Paths {
|
||||
source_dir: PathBuf,
|
||||
download_dir: PathBuf,
|
||||
build_dir: PathBuf,
|
||||
dist_dir: PathBuf,
|
||||
}*/
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct Dirs {
|
||||
pub(crate) source_dir: PathBuf,
|
||||
pub(crate) download_dir: PathBuf,
|
||||
pub(crate) build_dir: PathBuf,
|
||||
pub(crate) dist_dir: PathBuf,
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
|
|
@ -18,14 +19,12 @@ pub(crate) enum PathBase {
|
|||
}
|
||||
|
||||
impl PathBase {
|
||||
fn to_path(self) -> PathBuf {
|
||||
// FIXME pass in all paths instead
|
||||
let current_dir = std::env::current_dir().unwrap();
|
||||
fn to_path(self, dirs: &Dirs) -> PathBuf {
|
||||
match self {
|
||||
PathBase::Source => current_dir,
|
||||
PathBase::Download => current_dir.join("download"),
|
||||
PathBase::Build => current_dir.join("build"),
|
||||
PathBase::Dist => current_dir.join("dist"),
|
||||
PathBase::Source => dirs.source_dir.clone(),
|
||||
PathBase::Download => dirs.download_dir.clone(),
|
||||
PathBase::Build => dirs.build_dir.clone(),
|
||||
PathBase::Dist => dirs.dist_dir.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -50,19 +49,19 @@ impl RelPath {
|
|||
RelPath::Join(self, suffix)
|
||||
}
|
||||
|
||||
pub(crate) fn to_path(&self) -> PathBuf {
|
||||
pub(crate) fn to_path(&self, dirs: &Dirs) -> PathBuf {
|
||||
match self {
|
||||
RelPath::Base(base) => base.to_path(),
|
||||
RelPath::Join(base, suffix) => base.to_path().join(suffix),
|
||||
RelPath::Base(base) => base.to_path(dirs),
|
||||
RelPath::Join(base, suffix) => base.to_path(dirs).join(suffix),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn ensure_exists(&self) {
|
||||
fs::create_dir_all(self.to_path()).unwrap();
|
||||
pub(crate) fn ensure_exists(&self, dirs: &Dirs) {
|
||||
fs::create_dir_all(self.to_path(dirs)).unwrap();
|
||||
}
|
||||
|
||||
pub(crate) fn ensure_fresh(&self) {
|
||||
let path = self.to_path();
|
||||
pub(crate) fn ensure_fresh(&self, dirs: &Dirs) {
|
||||
let path = self.to_path(dirs);
|
||||
if path.exists() {
|
||||
fs::remove_dir_all(&path).unwrap();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,66 +4,69 @@ use std::path::{Path, PathBuf};
|
|||
use std::process::Command;
|
||||
|
||||
use super::build_sysroot::{SYSROOT_RUSTC_VERSION, SYSROOT_SRC};
|
||||
use super::path::RelPath;
|
||||
use super::path::{Dirs, RelPath};
|
||||
use super::rustc_info::{get_file_name, get_rustc_path, get_rustc_version};
|
||||
use super::utils::{copy_dir_recursively, spawn_and_wait, Compiler};
|
||||
|
||||
pub(crate) fn prepare() {
|
||||
if RelPath::DOWNLOAD.to_path().exists() {
|
||||
std::fs::remove_dir_all(RelPath::DOWNLOAD.to_path()).unwrap();
|
||||
pub(crate) fn prepare(dirs: &Dirs) {
|
||||
if RelPath::DOWNLOAD.to_path(dirs).exists() {
|
||||
std::fs::remove_dir_all(RelPath::DOWNLOAD.to_path(dirs)).unwrap();
|
||||
}
|
||||
std::fs::create_dir_all(RelPath::DOWNLOAD.to_path()).unwrap();
|
||||
std::fs::create_dir_all(RelPath::DOWNLOAD.to_path(dirs)).unwrap();
|
||||
|
||||
prepare_sysroot();
|
||||
prepare_sysroot(dirs);
|
||||
|
||||
// FIXME maybe install this only locally?
|
||||
eprintln!("[INSTALL] hyperfine");
|
||||
Command::new("cargo").arg("install").arg("hyperfine").spawn().unwrap().wait().unwrap();
|
||||
|
||||
super::abi_cafe::ABI_CAFE_REPO.fetch();
|
||||
super::tests::RAND_REPO.fetch();
|
||||
super::tests::REGEX_REPO.fetch();
|
||||
super::tests::PORTABLE_SIMD_REPO.fetch();
|
||||
super::tests::SIMPLE_RAYTRACER_REPO.fetch();
|
||||
super::abi_cafe::ABI_CAFE_REPO.fetch(dirs);
|
||||
super::tests::RAND_REPO.fetch(dirs);
|
||||
super::tests::REGEX_REPO.fetch(dirs);
|
||||
super::tests::PORTABLE_SIMD_REPO.fetch(dirs);
|
||||
super::tests::SIMPLE_RAYTRACER_REPO.fetch(dirs);
|
||||
|
||||
eprintln!("[LLVM BUILD] simple-raytracer");
|
||||
let host_compiler = Compiler::host();
|
||||
let build_cmd = super::tests::SIMPLE_RAYTRACER.build(&host_compiler);
|
||||
let build_cmd = super::tests::SIMPLE_RAYTRACER.build(&host_compiler, dirs);
|
||||
spawn_and_wait(build_cmd);
|
||||
fs::copy(
|
||||
super::tests::SIMPLE_RAYTRACER
|
||||
.target_dir()
|
||||
.target_dir(dirs)
|
||||
.join(&host_compiler.triple)
|
||||
.join("debug")
|
||||
.join(get_file_name("main", "bin")),
|
||||
RelPath::BUILD.to_path().join(get_file_name("raytracer_cg_llvm", "bin")),
|
||||
RelPath::BUILD.to_path(dirs).join(get_file_name("raytracer_cg_llvm", "bin")),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn prepare_sysroot() {
|
||||
fn prepare_sysroot(dirs: &Dirs) {
|
||||
let rustc_path = get_rustc_path();
|
||||
let sysroot_src_orig = rustc_path.parent().unwrap().join("../lib/rustlib/src/rust");
|
||||
let sysroot_src = SYSROOT_SRC;
|
||||
|
||||
assert!(sysroot_src_orig.exists());
|
||||
|
||||
sysroot_src.ensure_fresh();
|
||||
fs::create_dir_all(sysroot_src.to_path().join("library")).unwrap();
|
||||
sysroot_src.ensure_fresh(dirs);
|
||||
fs::create_dir_all(sysroot_src.to_path(dirs).join("library")).unwrap();
|
||||
eprintln!("[COPY] sysroot src");
|
||||
copy_dir_recursively(&sysroot_src_orig.join("library"), &sysroot_src.to_path().join("library"));
|
||||
copy_dir_recursively(
|
||||
&sysroot_src_orig.join("library"),
|
||||
&sysroot_src.to_path(dirs).join("library"),
|
||||
);
|
||||
|
||||
let rustc_version = get_rustc_version();
|
||||
fs::write(SYSROOT_RUSTC_VERSION.to_path(), &rustc_version).unwrap();
|
||||
fs::write(SYSROOT_RUSTC_VERSION.to_path(dirs), &rustc_version).unwrap();
|
||||
|
||||
eprintln!("[GIT] init");
|
||||
let mut git_init_cmd = Command::new("git");
|
||||
git_init_cmd.arg("init").arg("-q").current_dir(sysroot_src.to_path());
|
||||
git_init_cmd.arg("init").arg("-q").current_dir(sysroot_src.to_path(dirs));
|
||||
spawn_and_wait(git_init_cmd);
|
||||
|
||||
init_git_repo(&sysroot_src.to_path());
|
||||
init_git_repo(&sysroot_src.to_path(dirs));
|
||||
|
||||
apply_patches("sysroot", &sysroot_src.to_path());
|
||||
apply_patches(dirs, "sysroot", &sysroot_src.to_path(dirs));
|
||||
}
|
||||
|
||||
pub(crate) struct GitRepo {
|
||||
|
|
@ -92,13 +95,19 @@ impl GitRepo {
|
|||
}
|
||||
}
|
||||
|
||||
fn fetch(&self) {
|
||||
fn fetch(&self, dirs: &Dirs) {
|
||||
match self.url {
|
||||
GitRepoUrl::Github { user, repo } => {
|
||||
clone_repo_shallow_github(&self.source_dir().to_path(), user, repo, self.rev);
|
||||
clone_repo_shallow_github(
|
||||
dirs,
|
||||
&self.source_dir().to_path(dirs),
|
||||
user,
|
||||
repo,
|
||||
self.rev,
|
||||
);
|
||||
}
|
||||
}
|
||||
apply_patches(self.patch_name, &self.source_dir().to_path());
|
||||
apply_patches(dirs, self.patch_name, &self.source_dir().to_path(dirs));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +126,7 @@ fn clone_repo(download_dir: &Path, repo: &str, rev: &str) {
|
|||
spawn_and_wait(checkout_cmd);
|
||||
}
|
||||
|
||||
fn clone_repo_shallow_github(download_dir: &Path, user: &str, repo: &str, rev: &str) {
|
||||
fn clone_repo_shallow_github(dirs: &Dirs, download_dir: &Path, user: &str, repo: &str, rev: &str) {
|
||||
if cfg!(windows) {
|
||||
// Older windows doesn't have tar or curl by default. Fall back to using git.
|
||||
clone_repo(download_dir, &format!("https://github.com/{}/{}.git", user, repo), rev);
|
||||
|
|
@ -125,8 +134,8 @@ fn clone_repo_shallow_github(download_dir: &Path, user: &str, repo: &str, rev: &
|
|||
}
|
||||
|
||||
let archive_url = format!("https://github.com/{}/{}/archive/{}.tar.gz", user, repo, rev);
|
||||
let archive_file = RelPath::DOWNLOAD.to_path().join(format!("{}.tar.gz", rev));
|
||||
let archive_dir = RelPath::DOWNLOAD.to_path().join(format!("{}-{}", repo, rev));
|
||||
let archive_file = RelPath::DOWNLOAD.to_path(dirs).join(format!("{}.tar.gz", rev));
|
||||
let archive_dir = RelPath::DOWNLOAD.to_path(dirs).join(format!("{}-{}", repo, rev));
|
||||
|
||||
eprintln!("[DOWNLOAD] {}/{} from {}", user, repo, archive_url);
|
||||
|
||||
|
|
@ -142,7 +151,7 @@ fn clone_repo_shallow_github(download_dir: &Path, user: &str, repo: &str, rev: &
|
|||
|
||||
// Unpack tar archive
|
||||
let mut unpack_cmd = Command::new("tar");
|
||||
unpack_cmd.arg("xf").arg(&archive_file).current_dir(RelPath::DOWNLOAD.to_path());
|
||||
unpack_cmd.arg("xf").arg(&archive_file).current_dir(RelPath::DOWNLOAD.to_path(dirs));
|
||||
spawn_and_wait(unpack_cmd);
|
||||
|
||||
// Rename unpacked dir to the expected name
|
||||
|
|
@ -168,8 +177,8 @@ fn init_git_repo(repo_dir: &Path) {
|
|||
spawn_and_wait(git_commit_cmd);
|
||||
}
|
||||
|
||||
fn get_patches(crate_name: &str) -> Vec<PathBuf> {
|
||||
let mut patches: Vec<_> = fs::read_dir(RelPath::PATCHES.to_path())
|
||||
fn get_patches(dirs: &Dirs, crate_name: &str) -> Vec<PathBuf> {
|
||||
let mut patches: Vec<_> = fs::read_dir(RelPath::PATCHES.to_path(dirs))
|
||||
.unwrap()
|
||||
.map(|entry| entry.unwrap().path())
|
||||
.filter(|path| path.extension() == Some(OsStr::new("patch")))
|
||||
|
|
@ -188,12 +197,12 @@ fn get_patches(crate_name: &str) -> Vec<PathBuf> {
|
|||
patches
|
||||
}
|
||||
|
||||
fn apply_patches(crate_name: &str, target_dir: &Path) {
|
||||
fn apply_patches(dirs: &Dirs, crate_name: &str, target_dir: &Path) {
|
||||
if crate_name == "<none>" {
|
||||
return;
|
||||
}
|
||||
|
||||
for patch in get_patches(crate_name) {
|
||||
for patch in get_patches(dirs, crate_name) {
|
||||
eprintln!(
|
||||
"[PATCH] {:?} <- {:?}",
|
||||
target_dir.file_name().unwrap(),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use super::build_sysroot;
|
||||
use super::config;
|
||||
use super::path::RelPath;
|
||||
use super::path::{Dirs, RelPath};
|
||||
use super::prepare::GitRepo;
|
||||
use super::rustc_info::{get_cargo_path, get_wrapper_file_name};
|
||||
use super::utils::{
|
||||
|
|
@ -256,16 +256,16 @@ static LIBCORE_TESTS: CargoProject =
|
|||
|
||||
const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
||||
TestCase::new("test.rust-random/rand", &|runner| {
|
||||
spawn_and_wait(RAND.clean(&runner.target_compiler.cargo));
|
||||
spawn_and_wait(RAND.clean(&runner.target_compiler.cargo, &runner.dirs));
|
||||
|
||||
if runner.is_native {
|
||||
eprintln!("[TEST] rust-random/rand");
|
||||
let mut test_cmd = RAND.test(&runner.target_compiler);
|
||||
let mut test_cmd = RAND.test(&runner.target_compiler, &runner.dirs);
|
||||
test_cmd.arg("--workspace");
|
||||
spawn_and_wait(test_cmd);
|
||||
} else {
|
||||
eprintln!("[AOT] rust-random/rand");
|
||||
let mut build_cmd = RAND.build(&runner.target_compiler);
|
||||
let mut build_cmd = RAND.build(&runner.target_compiler, &runner.dirs);
|
||||
build_cmd.arg("--workspace").arg("--tests");
|
||||
spawn_and_wait(build_cmd);
|
||||
}
|
||||
|
|
@ -275,10 +275,11 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
|||
|
||||
if runner.is_native {
|
||||
eprintln!("[BENCH COMPILE] ebobby/simple-raytracer");
|
||||
let cargo_clif =
|
||||
RelPath::DIST.to_path().join(get_wrapper_file_name("cargo-clif", "bin"));
|
||||
let manifest_path = SIMPLE_RAYTRACER.manifest_path();
|
||||
let target_dir = SIMPLE_RAYTRACER.target_dir();
|
||||
let cargo_clif = RelPath::DIST
|
||||
.to_path(&runner.dirs)
|
||||
.join(get_wrapper_file_name("cargo-clif", "bin"));
|
||||
let manifest_path = SIMPLE_RAYTRACER.manifest_path(&runner.dirs);
|
||||
let target_dir = SIMPLE_RAYTRACER.target_dir(&runner.dirs);
|
||||
|
||||
let clean_cmd = format!(
|
||||
"cargo clean --manifest-path {manifest_path} --target-dir {target_dir}",
|
||||
|
|
@ -305,54 +306,56 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
|||
eprintln!("[BENCH RUN] ebobby/simple-raytracer");
|
||||
fs::copy(
|
||||
target_dir.join("debug").join("main"),
|
||||
RelPath::BUILD.to_path().join("raytracer_cg_clif"),
|
||||
RelPath::BUILD.to_path(&runner.dirs).join("raytracer_cg_clif"),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let mut bench_run =
|
||||
hyperfine_command(0, run_runs, None, "./raytracer_cg_llvm", "./raytracer_cg_clif");
|
||||
bench_run.current_dir(RelPath::BUILD.to_path());
|
||||
bench_run.current_dir(RelPath::BUILD.to_path(&runner.dirs));
|
||||
spawn_and_wait(bench_run);
|
||||
} else {
|
||||
spawn_and_wait(SIMPLE_RAYTRACER.clean(&runner.target_compiler.cargo));
|
||||
spawn_and_wait(SIMPLE_RAYTRACER.clean(&runner.target_compiler.cargo, &runner.dirs));
|
||||
eprintln!("[BENCH COMPILE] ebobby/simple-raytracer (skipped)");
|
||||
eprintln!("[COMPILE] ebobby/simple-raytracer");
|
||||
spawn_and_wait(SIMPLE_RAYTRACER.build(&runner.target_compiler));
|
||||
spawn_and_wait(SIMPLE_RAYTRACER.build(&runner.target_compiler, &runner.dirs));
|
||||
eprintln!("[BENCH RUN] ebobby/simple-raytracer (skipped)");
|
||||
}
|
||||
}),
|
||||
TestCase::new("test.libcore", &|runner| {
|
||||
spawn_and_wait(LIBCORE_TESTS.clean(&runner.host_compiler.cargo));
|
||||
spawn_and_wait(LIBCORE_TESTS.clean(&runner.host_compiler.cargo, &runner.dirs));
|
||||
|
||||
if runner.is_native {
|
||||
spawn_and_wait(LIBCORE_TESTS.test(&runner.target_compiler));
|
||||
spawn_and_wait(LIBCORE_TESTS.test(&runner.target_compiler, &runner.dirs));
|
||||
} else {
|
||||
eprintln!("Cross-Compiling: Not running tests");
|
||||
let mut build_cmd = LIBCORE_TESTS.build(&runner.target_compiler);
|
||||
let mut build_cmd = LIBCORE_TESTS.build(&runner.target_compiler, &runner.dirs);
|
||||
build_cmd.arg("--tests");
|
||||
spawn_and_wait(build_cmd);
|
||||
}
|
||||
}),
|
||||
TestCase::new("test.regex-shootout-regex-dna", &|runner| {
|
||||
spawn_and_wait(REGEX.clean(&runner.target_compiler.cargo));
|
||||
spawn_and_wait(REGEX.clean(&runner.target_compiler.cargo, &runner.dirs));
|
||||
|
||||
// newer aho_corasick versions throw a deprecation warning
|
||||
let lint_rust_flags = format!("{} --cap-lints warn", runner.target_compiler.rustflags);
|
||||
|
||||
let mut build_cmd = REGEX.build(&runner.target_compiler);
|
||||
let mut build_cmd = REGEX.build(&runner.target_compiler, &runner.dirs);
|
||||
build_cmd.arg("--example").arg("shootout-regex-dna");
|
||||
build_cmd.env("RUSTFLAGS", lint_rust_flags.clone());
|
||||
spawn_and_wait(build_cmd);
|
||||
|
||||
if runner.is_native {
|
||||
let mut run_cmd = REGEX.run(&runner.target_compiler);
|
||||
let mut run_cmd = REGEX.run(&runner.target_compiler, &runner.dirs);
|
||||
run_cmd.arg("--example").arg("shootout-regex-dna");
|
||||
run_cmd.env("RUSTFLAGS", lint_rust_flags);
|
||||
|
||||
let input =
|
||||
fs::read_to_string(REGEX.source_dir().join("examples").join("regexdna-input.txt"))
|
||||
.unwrap();
|
||||
let expected_path = REGEX.source_dir().join("examples").join("regexdna-output.txt");
|
||||
let input = fs::read_to_string(
|
||||
REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-input.txt"),
|
||||
)
|
||||
.unwrap();
|
||||
let expected_path =
|
||||
REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-output.txt");
|
||||
let expected = fs::read_to_string(&expected_path).unwrap();
|
||||
|
||||
let output = spawn_and_wait_with_input(run_cmd, input);
|
||||
|
|
@ -366,7 +369,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
|||
|
||||
let output_matches = expected.lines().eq(output.lines());
|
||||
if !output_matches {
|
||||
let res_path = REGEX.source_dir().join("res.txt");
|
||||
let res_path = REGEX.source_dir(&runner.dirs).join("res.txt");
|
||||
fs::write(&res_path, &output).unwrap();
|
||||
|
||||
if cfg!(windows) {
|
||||
|
|
@ -386,13 +389,13 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
|||
}
|
||||
}),
|
||||
TestCase::new("test.regex", &|runner| {
|
||||
spawn_and_wait(REGEX.clean(&runner.host_compiler.cargo));
|
||||
spawn_and_wait(REGEX.clean(&runner.host_compiler.cargo, &runner.dirs));
|
||||
|
||||
// newer aho_corasick versions throw a deprecation warning
|
||||
let lint_rust_flags = format!("{} --cap-lints warn", runner.target_compiler.rustflags);
|
||||
|
||||
if runner.is_native {
|
||||
let mut run_cmd = REGEX.test(&runner.target_compiler);
|
||||
let mut run_cmd = REGEX.test(&runner.target_compiler, &runner.dirs);
|
||||
run_cmd.args([
|
||||
"--tests",
|
||||
"--",
|
||||
|
|
@ -406,21 +409,21 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
|||
spawn_and_wait(run_cmd);
|
||||
} else {
|
||||
eprintln!("Cross-Compiling: Not running tests");
|
||||
let mut build_cmd = REGEX.build(&runner.target_compiler);
|
||||
let mut build_cmd = REGEX.build(&runner.target_compiler, &runner.dirs);
|
||||
build_cmd.arg("--tests");
|
||||
build_cmd.env("RUSTFLAGS", lint_rust_flags.clone());
|
||||
spawn_and_wait(build_cmd);
|
||||
}
|
||||
}),
|
||||
TestCase::new("test.portable-simd", &|runner| {
|
||||
spawn_and_wait(PORTABLE_SIMD.clean(&runner.host_compiler.cargo));
|
||||
spawn_and_wait(PORTABLE_SIMD.clean(&runner.host_compiler.cargo, &runner.dirs));
|
||||
|
||||
let mut build_cmd = PORTABLE_SIMD.build(&runner.target_compiler);
|
||||
let mut build_cmd = PORTABLE_SIMD.build(&runner.target_compiler, &runner.dirs);
|
||||
build_cmd.arg("--all-targets");
|
||||
spawn_and_wait(build_cmd);
|
||||
|
||||
if runner.is_native {
|
||||
let mut test_cmd = PORTABLE_SIMD.test(&runner.target_compiler);
|
||||
let mut test_cmd = PORTABLE_SIMD.test(&runner.target_compiler, &runner.dirs);
|
||||
test_cmd.arg("-q");
|
||||
spawn_and_wait(test_cmd);
|
||||
}
|
||||
|
|
@ -428,16 +431,18 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
|||
];
|
||||
|
||||
pub(crate) fn run_tests(
|
||||
dirs: &Dirs,
|
||||
channel: &str,
|
||||
sysroot_kind: SysrootKind,
|
||||
cg_clif_dylib: &Path,
|
||||
host_triple: &str,
|
||||
target_triple: &str,
|
||||
) {
|
||||
let runner = TestRunner::new(host_triple.to_string(), target_triple.to_string());
|
||||
let runner = TestRunner::new(dirs.clone(), host_triple.to_string(), target_triple.to_string());
|
||||
|
||||
if config::get_bool("testsuite.no_sysroot") {
|
||||
build_sysroot::build_sysroot(
|
||||
dirs,
|
||||
channel,
|
||||
SysrootKind::None,
|
||||
cg_clif_dylib,
|
||||
|
|
@ -445,7 +450,7 @@ pub(crate) fn run_tests(
|
|||
&target_triple,
|
||||
);
|
||||
|
||||
BUILD_EXAMPLE_OUT_DIR.ensure_fresh();
|
||||
BUILD_EXAMPLE_OUT_DIR.ensure_fresh(dirs);
|
||||
runner.run_testsuite(NO_SYSROOT_SUITE);
|
||||
} else {
|
||||
eprintln!("[SKIP] no_sysroot tests");
|
||||
|
|
@ -456,6 +461,7 @@ pub(crate) fn run_tests(
|
|||
|
||||
if run_base_sysroot || run_extended_sysroot {
|
||||
build_sysroot::build_sysroot(
|
||||
dirs,
|
||||
channel,
|
||||
sysroot_kind,
|
||||
cg_clif_dylib,
|
||||
|
|
@ -480,19 +486,21 @@ pub(crate) fn run_tests(
|
|||
struct TestRunner {
|
||||
is_native: bool,
|
||||
jit_supported: bool,
|
||||
dirs: Dirs,
|
||||
host_compiler: Compiler,
|
||||
target_compiler: Compiler,
|
||||
}
|
||||
|
||||
impl TestRunner {
|
||||
pub fn new(host_triple: String, target_triple: String) -> Self {
|
||||
pub fn new(dirs: Dirs, host_triple: String, target_triple: String) -> Self {
|
||||
let is_native = host_triple == target_triple;
|
||||
let jit_supported =
|
||||
target_triple.contains("x86_64") && is_native && !host_triple.contains("windows");
|
||||
|
||||
let rustc_clif = RelPath::DIST.to_path().join(get_wrapper_file_name("rustc-clif", "bin"));
|
||||
let rustc_clif =
|
||||
RelPath::DIST.to_path(&dirs).join(get_wrapper_file_name("rustc-clif", "bin"));
|
||||
let rustdoc_clif =
|
||||
RelPath::DIST.to_path().join(get_wrapper_file_name("rustdoc-clif", "bin"));
|
||||
RelPath::DIST.to_path(&dirs).join(get_wrapper_file_name("rustdoc-clif", "bin"));
|
||||
|
||||
let mut rustflags = env::var("RUSTFLAGS").ok().unwrap_or("".to_string());
|
||||
let mut runner = vec![];
|
||||
|
|
@ -543,7 +551,7 @@ impl TestRunner {
|
|||
runner,
|
||||
};
|
||||
|
||||
Self { is_native, jit_supported, host_compiler, target_compiler }
|
||||
Self { is_native, jit_supported, dirs, host_compiler, target_compiler }
|
||||
}
|
||||
|
||||
pub fn run_testsuite(&self, tests: &[TestCase]) {
|
||||
|
|
@ -572,9 +580,9 @@ impl TestRunner {
|
|||
let mut cmd = Command::new(&self.target_compiler.rustc);
|
||||
cmd.args(self.target_compiler.rustflags.split_whitespace());
|
||||
cmd.arg("-L");
|
||||
cmd.arg(format!("crate={}", BUILD_EXAMPLE_OUT_DIR.to_path().display()));
|
||||
cmd.arg(format!("crate={}", BUILD_EXAMPLE_OUT_DIR.to_path(&self.dirs).display()));
|
||||
cmd.arg("--out-dir");
|
||||
cmd.arg(format!("{}", BUILD_EXAMPLE_OUT_DIR.to_path().display()));
|
||||
cmd.arg(format!("{}", BUILD_EXAMPLE_OUT_DIR.to_path(&self.dirs).display()));
|
||||
cmd.arg("-Cdebuginfo=2");
|
||||
cmd.args(args);
|
||||
cmd
|
||||
|
|
@ -599,7 +607,9 @@ impl TestRunner {
|
|||
full_cmd.extend(self.target_compiler.runner.iter().cloned());
|
||||
}
|
||||
|
||||
full_cmd.push(BUILD_EXAMPLE_OUT_DIR.to_path().join(name).to_str().unwrap().to_string());
|
||||
full_cmd.push(
|
||||
BUILD_EXAMPLE_OUT_DIR.to_path(&self.dirs).join(name).to_str().unwrap().to_string(),
|
||||
);
|
||||
|
||||
for arg in args.into_iter() {
|
||||
full_cmd.push(arg.to_string());
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use std::io::Write;
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::process::{self, Command, Stdio};
|
||||
|
||||
use super::path::RelPath;
|
||||
use super::path::{Dirs, RelPath};
|
||||
use super::rustc_info::{get_cargo_path, get_host_triple, get_rustc_path, get_rustdoc_path};
|
||||
|
||||
pub(crate) struct Compiler {
|
||||
|
|
@ -53,32 +53,32 @@ impl CargoProject {
|
|||
CargoProject { source: path, target }
|
||||
}
|
||||
|
||||
pub(crate) fn source_dir(&self) -> PathBuf {
|
||||
self.source.to_path()
|
||||
pub(crate) fn source_dir(&self, dirs: &Dirs) -> PathBuf {
|
||||
self.source.to_path(dirs)
|
||||
}
|
||||
|
||||
pub(crate) fn manifest_path(&self) -> PathBuf {
|
||||
self.source_dir().join("Cargo.toml")
|
||||
pub(crate) fn manifest_path(&self, dirs: &Dirs) -> PathBuf {
|
||||
self.source_dir(dirs).join("Cargo.toml")
|
||||
}
|
||||
|
||||
pub(crate) fn target_dir(&self) -> PathBuf {
|
||||
RelPath::BUILD.join(self.target).to_path()
|
||||
pub(crate) fn target_dir(&self, dirs: &Dirs) -> PathBuf {
|
||||
RelPath::BUILD.join(self.target).to_path(dirs)
|
||||
}
|
||||
|
||||
fn base_cmd(&self, command: &str, cargo: &Path) -> Command {
|
||||
fn base_cmd(&self, command: &str, cargo: &Path, dirs: &Dirs) -> Command {
|
||||
let mut cmd = Command::new(cargo);
|
||||
|
||||
cmd.arg(command)
|
||||
.arg("--manifest-path")
|
||||
.arg(self.manifest_path())
|
||||
.arg(self.manifest_path(dirs))
|
||||
.arg("--target-dir")
|
||||
.arg(self.target_dir());
|
||||
.arg(self.target_dir(dirs));
|
||||
|
||||
cmd
|
||||
}
|
||||
|
||||
fn build_cmd(&self, command: &str, compiler: &Compiler) -> Command {
|
||||
let mut cmd = self.base_cmd(command, &compiler.cargo);
|
||||
fn build_cmd(&self, command: &str, compiler: &Compiler, dirs: &Dirs) -> Command {
|
||||
let mut cmd = self.base_cmd(command, &compiler.cargo, dirs);
|
||||
|
||||
cmd.arg("--target").arg(&compiler.triple);
|
||||
|
||||
|
|
@ -97,32 +97,32 @@ impl CargoProject {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub(crate) fn fetch(&self, cargo: impl AsRef<Path>) -> Command {
|
||||
pub(crate) fn fetch(&self, cargo: impl AsRef<Path>, dirs: &Dirs) -> Command {
|
||||
let mut cmd = Command::new(cargo.as_ref());
|
||||
|
||||
cmd.arg("fetch").arg("--manifest-path").arg(self.manifest_path());
|
||||
cmd.arg("fetch").arg("--manifest-path").arg(self.manifest_path(dirs));
|
||||
|
||||
cmd
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub(crate) fn clean(&self, cargo: &Path) -> Command {
|
||||
self.base_cmd("clean", cargo)
|
||||
pub(crate) fn clean(&self, cargo: &Path, dirs: &Dirs) -> Command {
|
||||
self.base_cmd("clean", cargo, dirs)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub(crate) fn build(&self, compiler: &Compiler) -> Command {
|
||||
self.build_cmd("build", compiler)
|
||||
pub(crate) fn build(&self, compiler: &Compiler, dirs: &Dirs) -> Command {
|
||||
self.build_cmd("build", compiler, dirs)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub(crate) fn test(&self, compiler: &Compiler) -> Command {
|
||||
self.build_cmd("test", compiler)
|
||||
pub(crate) fn test(&self, compiler: &Compiler, dirs: &Dirs) -> Command {
|
||||
self.build_cmd("test", compiler, dirs)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub(crate) fn run(&self, compiler: &Compiler) -> Command {
|
||||
self.build_cmd("run", compiler)
|
||||
pub(crate) fn run(&self, compiler: &Compiler, dirs: &Dirs) -> Command {
|
||||
self.build_cmd("run", compiler, dirs)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue