1
Fork 0

Merge commit 'e9d1a0a7b0' into sync_cg_clif-2022-08-24

This commit is contained in:
bjorn3 2022-08-24 18:40:58 +02:00
commit 7b9c8c8781
46 changed files with 2292 additions and 1259 deletions

View file

@ -2,11 +2,15 @@ use std::env;
use std::path::PathBuf;
use std::process;
use self::utils::is_ci;
mod abi_checker;
mod build_backend;
mod build_sysroot;
mod config;
mod prepare;
mod rustc_info;
mod tests;
mod utils;
fn usage() {
@ -15,6 +19,9 @@ fn usage() {
eprintln!(
" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]"
);
eprintln!(
" ./y.rs test [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]"
);
}
macro_rules! arg_error {
@ -25,11 +32,13 @@ macro_rules! arg_error {
}};
}
#[derive(PartialEq, Debug)]
enum Command {
Build,
Test,
}
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Debug)]
pub(crate) enum SysrootKind {
None,
Clif,
@ -42,16 +51,22 @@ pub fn main() {
// The target dir is expected in the default location. Guard against the user changing it.
env::set_var("CARGO_TARGET_DIR", "target");
if is_ci() {
// Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
env::set_var("CARGO_BUILD_INCREMENTAL", "false");
}
let mut args = env::args().skip(1);
let command = match args.next().as_deref() {
Some("prepare") => {
if args.next().is_some() {
arg_error!("./x.rs prepare doesn't expect arguments");
arg_error!("./y.rs prepare doesn't expect arguments");
}
prepare::prepare();
process::exit(0);
}
Some("build") => Command::Build,
Some("test") => Command::Test,
Some(flag) if flag.starts_with('-') => arg_error!("Expected command found flag {}", flag),
Some(command) => arg_error!("Unknown command {}", command),
None => {
@ -117,12 +132,35 @@ pub fn main() {
let cg_clif_build_dir =
build_backend::build_backend(channel, &host_triple, use_unstable_features);
build_sysroot::build_sysroot(
channel,
sysroot_kind,
&target_dir,
cg_clif_build_dir,
&host_triple,
&target_triple,
);
match command {
Command::Test => {
tests::run_tests(
channel,
sysroot_kind,
&target_dir,
&cg_clif_build_dir,
&host_triple,
&target_triple,
);
abi_checker::run(
channel,
sysroot_kind,
&target_dir,
&cg_clif_build_dir,
&host_triple,
&target_triple,
);
}
Command::Build => {
build_sysroot::build_sysroot(
channel,
sysroot_kind,
&target_dir,
&cg_clif_build_dir,
&host_triple,
&target_triple,
);
}
}
}