mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Put all temporary build artifacts in build/
This commit is contained in:
parent
5e97a3951d
commit
e75dfef4d4
@ -9,7 +9,7 @@ use super::SysrootKind;
|
|||||||
pub(crate) static ABI_CAFE_REPO: GitRepo =
|
pub(crate) static ABI_CAFE_REPO: GitRepo =
|
||||||
GitRepo::github("Gankra", "abi-cafe", "4c6dc8c9c687e2b3a760ff2176ce236872b37212", "abi-cafe");
|
GitRepo::github("Gankra", "abi-cafe", "4c6dc8c9c687e2b3a760ff2176ce236872b37212", "abi-cafe");
|
||||||
|
|
||||||
static ABI_CAFE: CargoProject = CargoProject::git(&ABI_CAFE_REPO, ".");
|
static ABI_CAFE: CargoProject = CargoProject::git(&ABI_CAFE_REPO, ".", "abi_cafe");
|
||||||
|
|
||||||
pub(crate) fn run(
|
pub(crate) fn run(
|
||||||
channel: &str,
|
channel: &str,
|
||||||
|
@ -4,7 +4,7 @@ use std::path::PathBuf;
|
|||||||
use super::rustc_info::get_file_name;
|
use super::rustc_info::get_file_name;
|
||||||
use super::utils::{is_ci, CargoProject, Compiler};
|
use super::utils::{is_ci, CargoProject, Compiler};
|
||||||
|
|
||||||
static CG_CLIF: CargoProject = CargoProject::local(".");
|
static CG_CLIF: CargoProject = CargoProject::local(".", "cg_clif");
|
||||||
|
|
||||||
pub(crate) fn build_backend(
|
pub(crate) fn build_backend(
|
||||||
channel: &str,
|
channel: &str,
|
||||||
@ -43,8 +43,7 @@ pub(crate) fn build_backend(
|
|||||||
super::utils::spawn_and_wait(cmd);
|
super::utils::spawn_and_wait(cmd);
|
||||||
|
|
||||||
CG_CLIF
|
CG_CLIF
|
||||||
.source_dir()
|
.target_dir()
|
||||||
.join("target")
|
|
||||||
.join(host_triple)
|
.join(host_triple)
|
||||||
.join(channel)
|
.join(channel)
|
||||||
.join(get_file_name("rustc_codegen_cranelift", "dylib"))
|
.join(get_file_name("rustc_codegen_cranelift", "dylib"))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::Path;
|
||||||
use std::process::{self, Command};
|
use std::process::{self, Command};
|
||||||
|
|
||||||
use super::rustc_info::{get_file_name, get_rustc_version, get_wrapper_file_name};
|
use super::rustc_info::{get_file_name, get_rustc_version, get_wrapper_file_name};
|
||||||
@ -40,7 +40,7 @@ pub(crate) fn build_sysroot(
|
|||||||
|
|
||||||
let mut build_cargo_wrapper_cmd = Command::new("rustc");
|
let mut build_cargo_wrapper_cmd = Command::new("rustc");
|
||||||
build_cargo_wrapper_cmd
|
build_cargo_wrapper_cmd
|
||||||
.arg(PathBuf::from("scripts").join(format!("{wrapper}.rs")))
|
.arg(Path::new("scripts").join(format!("{wrapper}.rs")))
|
||||||
.arg("-o")
|
.arg("-o")
|
||||||
.arg(dist_dir.join(wrapper_name))
|
.arg(dist_dir.join(wrapper_name))
|
||||||
.arg("-g");
|
.arg("-g");
|
||||||
@ -149,7 +149,7 @@ pub(crate) fn build_sysroot(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static STANDARD_LIBRARY: CargoProject = CargoProject::local("build_sysroot");
|
static STANDARD_LIBRARY: CargoProject = CargoProject::local("build_sysroot", "build_sysroot");
|
||||||
|
|
||||||
fn build_clif_sysroot_for_triple(
|
fn build_clif_sysroot_for_triple(
|
||||||
channel: &str,
|
channel: &str,
|
||||||
@ -176,7 +176,7 @@ fn build_clif_sysroot_for_triple(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let build_dir = Path::new("build_sysroot").join("target").join(triple).join(channel);
|
let build_dir = STANDARD_LIBRARY.target_dir().join(triple).join(channel);
|
||||||
|
|
||||||
if !super::config::get_bool("keep_sysroot") {
|
if !super::config::get_bool("keep_sysroot") {
|
||||||
// Cleanup the deps dir, but keep build scripts and the incremental cache for faster
|
// Cleanup the deps dir, but keep build scripts and the incremental cache for faster
|
||||||
@ -207,10 +207,7 @@ fn build_clif_sysroot_for_triple(
|
|||||||
spawn_and_wait(build_cmd);
|
spawn_and_wait(build_cmd);
|
||||||
|
|
||||||
// Copy all relevant files to the sysroot
|
// Copy all relevant files to the sysroot
|
||||||
for entry in
|
for entry in fs::read_dir(build_dir.join("deps")).unwrap() {
|
||||||
fs::read_dir(Path::new("build_sysroot/target").join(triple).join(channel).join("deps"))
|
|
||||||
.unwrap()
|
|
||||||
{
|
|
||||||
let entry = entry.unwrap();
|
let entry = entry.unwrap();
|
||||||
if let Some(ext) = entry.path().extension() {
|
if let Some(ext) = entry.path().extension() {
|
||||||
if ext == "rmeta" || ext == "d" || ext == "dSYM" || ext == "clif" {
|
if ext == "rmeta" || ext == "d" || ext == "dSYM" || ext == "clif" {
|
||||||
|
@ -49,13 +49,14 @@ pub fn main() {
|
|||||||
env::set_var("CG_CLIF_DISPLAY_CG_TIME", "1");
|
env::set_var("CG_CLIF_DISPLAY_CG_TIME", "1");
|
||||||
env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
|
env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
|
||||||
|
|
||||||
|
std::fs::create_dir_all("build").unwrap();
|
||||||
|
|
||||||
{
|
{
|
||||||
// Make sure we always explicitly specify the target dir
|
// Make sure we always explicitly specify the target dir
|
||||||
let target = "build/target_dir_should_be_set_explicitly";
|
let target = "build/target_dir_should_be_set_explicitly";
|
||||||
env::set_var("CARGO_TARGET_DIR", target);
|
env::set_var("CARGO_TARGET_DIR", target);
|
||||||
std::fs::create_dir_all("build").unwrap();
|
|
||||||
let _ = std::fs::remove_file(target);
|
let _ = std::fs::remove_file(target);
|
||||||
let file = std::fs::File::create(target).unwrap();
|
std::fs::File::create(target).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_ci() {
|
if is_ci() {
|
||||||
|
@ -35,9 +35,7 @@ pub(crate) fn prepare() {
|
|||||||
.join(&host_compiler.triple)
|
.join(&host_compiler.triple)
|
||||||
.join("debug")
|
.join("debug")
|
||||||
.join(get_file_name("main", "bin")),
|
.join(get_file_name("main", "bin")),
|
||||||
super::tests::SIMPLE_RAYTRACER_REPO
|
Path::new("build").join(get_file_name("raytracer_cg_llvm", "bin")),
|
||||||
.source_dir()
|
|
||||||
.join(get_file_name("raytracer_cg_llvm", "bin")),
|
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -223,12 +223,12 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
|
|||||||
pub(crate) static RAND_REPO: GitRepo =
|
pub(crate) static RAND_REPO: GitRepo =
|
||||||
GitRepo::github("rust-random", "rand", "0f933f9c7176e53b2a3c7952ded484e1783f0bf1", "rand");
|
GitRepo::github("rust-random", "rand", "0f933f9c7176e53b2a3c7952ded484e1783f0bf1", "rand");
|
||||||
|
|
||||||
static RAND: CargoProject = CargoProject::git(&RAND_REPO, ".");
|
static RAND: CargoProject = CargoProject::git(&RAND_REPO, ".", "rand");
|
||||||
|
|
||||||
pub(crate) static REGEX_REPO: GitRepo =
|
pub(crate) static REGEX_REPO: GitRepo =
|
||||||
GitRepo::github("rust-lang", "regex", "341f207c1071f7290e3f228c710817c280c8dca1", "regex");
|
GitRepo::github("rust-lang", "regex", "341f207c1071f7290e3f228c710817c280c8dca1", "regex");
|
||||||
|
|
||||||
static REGEX: CargoProject = CargoProject::git(®EX_REPO, ".");
|
static REGEX: CargoProject = CargoProject::git(®EX_REPO, ".", "regex");
|
||||||
|
|
||||||
pub(crate) static PORTABLE_SIMD_REPO: GitRepo = GitRepo::github(
|
pub(crate) static PORTABLE_SIMD_REPO: GitRepo = GitRepo::github(
|
||||||
"rust-lang",
|
"rust-lang",
|
||||||
@ -237,7 +237,7 @@ pub(crate) static PORTABLE_SIMD_REPO: GitRepo = GitRepo::github(
|
|||||||
"portable-simd",
|
"portable-simd",
|
||||||
);
|
);
|
||||||
|
|
||||||
static PORTABLE_SIMD: CargoProject = CargoProject::git(&PORTABLE_SIMD_REPO, ".");
|
static PORTABLE_SIMD: CargoProject = CargoProject::git(&PORTABLE_SIMD_REPO, ".", "portable_simd");
|
||||||
|
|
||||||
pub(crate) static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
|
pub(crate) static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
|
||||||
"ebobby",
|
"ebobby",
|
||||||
@ -246,10 +246,11 @@ pub(crate) static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
|
|||||||
"<none>",
|
"<none>",
|
||||||
);
|
);
|
||||||
|
|
||||||
pub(crate) static SIMPLE_RAYTRACER: CargoProject = CargoProject::git(&SIMPLE_RAYTRACER_REPO, ".");
|
pub(crate) static SIMPLE_RAYTRACER: CargoProject =
|
||||||
|
CargoProject::git(&SIMPLE_RAYTRACER_REPO, ".", "simple_raytracer");
|
||||||
|
|
||||||
static LIBCORE_TESTS: CargoProject =
|
static LIBCORE_TESTS: CargoProject =
|
||||||
CargoProject::local("build_sysroot/sysroot_src/library/core/tests");
|
CargoProject::local("build_sysroot/sysroot_src/library/core/tests", "core_tests");
|
||||||
|
|
||||||
const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
||||||
TestCase::new("test.rust-random/rand", &|runner| {
|
TestCase::new("test.rust-random/rand", &|runner| {
|
||||||
@ -276,7 +277,6 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.join("dist")
|
.join("dist")
|
||||||
.join(get_wrapper_file_name("cargo-clif", "bin"));
|
.join(get_wrapper_file_name("cargo-clif", "bin"));
|
||||||
let source_dir = SIMPLE_RAYTRACER.source_dir();
|
|
||||||
let manifest_path = SIMPLE_RAYTRACER.manifest_path();
|
let manifest_path = SIMPLE_RAYTRACER.manifest_path();
|
||||||
let target_dir = SIMPLE_RAYTRACER.target_dir();
|
let target_dir = SIMPLE_RAYTRACER.target_dir();
|
||||||
|
|
||||||
@ -303,17 +303,15 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
|||||||
spawn_and_wait(bench_compile);
|
spawn_and_wait(bench_compile);
|
||||||
|
|
||||||
eprintln!("[BENCH RUN] ebobby/simple-raytracer");
|
eprintln!("[BENCH RUN] ebobby/simple-raytracer");
|
||||||
fs::copy(target_dir.join("debug").join("main"), source_dir.join("raytracer_cg_clif"))
|
fs::copy(
|
||||||
.unwrap();
|
target_dir.join("debug").join("main"),
|
||||||
|
Path::new("build").join("raytracer_cg_clif"),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let mut bench_run = hyperfine_command(
|
let mut bench_run =
|
||||||
0,
|
hyperfine_command(0, run_runs, None, "./raytracer_cg_llvm", "./raytracer_cg_clif");
|
||||||
run_runs,
|
bench_run.current_dir(Path::new("build"));
|
||||||
None,
|
|
||||||
&source_dir.join("raytracer_cg_llvm").display().to_string(),
|
|
||||||
&source_dir.join("raytracer_cg_clif").display().to_string(),
|
|
||||||
);
|
|
||||||
bench_run.current_dir(SIMPLE_RAYTRACER.source_dir());
|
|
||||||
spawn_and_wait(bench_run);
|
spawn_and_wait(bench_run);
|
||||||
} else {
|
} else {
|
||||||
spawn_and_wait(SIMPLE_RAYTRACER.clean(&runner.target_compiler.cargo));
|
spawn_and_wait(SIMPLE_RAYTRACER.clean(&runner.target_compiler.cargo));
|
||||||
@ -449,7 +447,7 @@ pub(crate) fn run_tests(
|
|||||||
&target_triple,
|
&target_triple,
|
||||||
);
|
);
|
||||||
|
|
||||||
let _ = fs::remove_dir_all(Path::new("target").join("out"));
|
let _ = fs::remove_dir_all(Path::new("build").join("example"));
|
||||||
runner.run_testsuite(NO_SYSROOT_SUITE);
|
runner.run_testsuite(NO_SYSROOT_SUITE);
|
||||||
} else {
|
} else {
|
||||||
eprintln!("[SKIP] no_sysroot tests");
|
eprintln!("[SKIP] no_sysroot tests");
|
||||||
@ -495,8 +493,8 @@ impl TestRunner {
|
|||||||
let root_dir = env::current_dir().unwrap();
|
let root_dir = env::current_dir().unwrap();
|
||||||
|
|
||||||
let mut out_dir = root_dir.clone();
|
let mut out_dir = root_dir.clone();
|
||||||
out_dir.push("target");
|
out_dir.push("build");
|
||||||
out_dir.push("out");
|
out_dir.push("example");
|
||||||
|
|
||||||
let is_native = host_triple == target_triple;
|
let is_native = host_triple == target_triple;
|
||||||
let jit_supported =
|
let jit_supported =
|
||||||
|
@ -51,15 +51,20 @@ enum CargoProjectSource {
|
|||||||
pub(crate) struct CargoProject {
|
pub(crate) struct CargoProject {
|
||||||
source: CargoProjectSource,
|
source: CargoProjectSource,
|
||||||
path: &'static str,
|
path: &'static str,
|
||||||
|
target: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CargoProject {
|
impl CargoProject {
|
||||||
pub(crate) const fn local(path: &'static str) -> CargoProject {
|
pub(crate) const fn local(path: &'static str, target: &'static str) -> CargoProject {
|
||||||
CargoProject { source: CargoProjectSource::Local, path }
|
CargoProject { source: CargoProjectSource::Local, path, target }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) const fn git(git_repo: &'static GitRepo, path: &'static str) -> CargoProject {
|
pub(crate) const fn git(
|
||||||
CargoProject { source: CargoProjectSource::GitRepo(git_repo), path }
|
git_repo: &'static GitRepo,
|
||||||
|
path: &'static str,
|
||||||
|
target: &'static str,
|
||||||
|
) -> CargoProject {
|
||||||
|
CargoProject { source: CargoProjectSource::GitRepo(git_repo), path, target }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn source_dir(&self) -> PathBuf {
|
pub(crate) fn source_dir(&self) -> PathBuf {
|
||||||
@ -75,12 +80,7 @@ impl CargoProject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn target_dir(&self) -> PathBuf {
|
pub(crate) fn target_dir(&self) -> PathBuf {
|
||||||
match self.source {
|
std::env::current_dir().unwrap().join("build").join(self.target)
|
||||||
CargoProjectSource::Local => std::env::current_dir().unwrap(),
|
|
||||||
CargoProjectSource::GitRepo(git_repo) => git_repo.source_dir(),
|
|
||||||
}
|
|
||||||
.join(self.path)
|
|
||||||
.join("target")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn base_cmd(&self, command: &str, cargo: &Path) -> Command {
|
fn base_cmd(&self, command: &str, cargo: &Path) -> Command {
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
rm -rf build_sysroot/{sysroot_src/,target/,compiler-builtins/,rustc_version}
|
rm -rf build_sysroot/{sysroot_src/,target/,compiler-builtins/,rustc_version}
|
||||||
rm -rf target/ dist/ perf.data{,.old} y.bin
|
rm -rf target/ build/ dist/ perf.data{,.old} y.bin
|
||||||
rm -rf download/
|
rm -rf download/
|
||||||
|
|
||||||
# Kept for now in case someone updates their checkout of cg_clif before running clean_all.sh
|
# Kept for now in case someone updates their checkout of cg_clif before running clean_all.sh
|
||||||
# FIXME remove at some point in the future
|
# FIXME remove at some point in the future
|
||||||
rm -rf rand/ regex/ simple-raytracer/ portable-simd/ abi-checker/ abi-cafe/ build/
|
rm -rf rand/ regex/ simple-raytracer/ portable-simd/ abi-checker/ abi-cafe/
|
||||||
|
Loading…
Reference in New Issue
Block a user