opt-dist: change build_dir field to be an actual build dir
make it configurable so users can set build.build-dir option in bootstrap.toml
This commit is contained in:
@@ -48,7 +48,7 @@ impl Environment {
|
||||
}
|
||||
|
||||
pub fn build_artifacts(&self) -> Utf8PathBuf {
|
||||
self.build_root().join("build").join(&self.host_tuple)
|
||||
self.build_root().join(&self.host_tuple)
|
||||
}
|
||||
|
||||
pub fn artifact_dir(&self) -> Utf8PathBuf {
|
||||
|
||||
@@ -99,7 +99,7 @@ pub struct Bootstrap {
|
||||
|
||||
impl Bootstrap {
|
||||
pub fn build(env: &Environment) -> Self {
|
||||
let metrics_path = env.build_root().join("build").join("metrics.json");
|
||||
let metrics_path = env.build_root().join("metrics.json");
|
||||
let cmd = cmd(&[
|
||||
env.python_binary(),
|
||||
env.checkout_path().join("x.py").as_str(),
|
||||
@@ -119,7 +119,7 @@ impl Bootstrap {
|
||||
}
|
||||
|
||||
pub fn dist(env: &Environment, dist_args: &[String]) -> Self {
|
||||
let metrics_path = env.build_root().join("build").join("metrics.json");
|
||||
let metrics_path = env.build_root().join("metrics.json");
|
||||
let args = dist_args.iter().map(|arg| arg.as_str()).collect::<Vec<_>>();
|
||||
let cmd = cmd(&args).env("RUST_BACKTRACE", "full");
|
||||
let mut cmd = add_shared_x_flags(env, cmd);
|
||||
|
||||
@@ -102,6 +102,11 @@ enum EnvironmentCmd {
|
||||
/// Will be LLVM built during the run?
|
||||
#[arg(long, default_value_t = true, action(clap::ArgAction::Set))]
|
||||
build_llvm: bool,
|
||||
|
||||
/// Set build artifacts dir. Relative to `checkout_dir`, should point to the directory set
|
||||
/// in bootstrap.toml via `build.build-dir` option
|
||||
#[arg(long, default_value = "build")]
|
||||
build_dir: Utf8PathBuf,
|
||||
},
|
||||
/// Perform an optimized build on Linux CI, from inside Docker.
|
||||
LinuxCi {
|
||||
@@ -138,6 +143,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
|
||||
shared,
|
||||
run_tests,
|
||||
build_llvm,
|
||||
build_dir,
|
||||
} => {
|
||||
let env = EnvironmentBuilder::default()
|
||||
.host_tuple(target_triple)
|
||||
@@ -145,7 +151,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
|
||||
.checkout_dir(checkout_dir.clone())
|
||||
.host_llvm_dir(llvm_dir)
|
||||
.artifact_dir(artifact_dir)
|
||||
.build_dir(checkout_dir)
|
||||
.build_dir(checkout_dir.join(build_dir))
|
||||
.prebuilt_rustc_perf(rustc_perf_checkout_dir)
|
||||
.shared_llvm(llvm_shared)
|
||||
.use_bolt(use_bolt)
|
||||
@@ -171,7 +177,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
|
||||
.checkout_dir(checkout_dir.clone())
|
||||
.host_llvm_dir(Utf8PathBuf::from("/rustroot"))
|
||||
.artifact_dir(Utf8PathBuf::from("/tmp/tmp-multistage/opt-artifacts"))
|
||||
.build_dir(checkout_dir.join("obj"))
|
||||
.build_dir(checkout_dir.join("obj").join("build"))
|
||||
.shared_llvm(true)
|
||||
// FIXME: Enable bolt for aarch64 once it's fixed upstream. Broken as of December 2024.
|
||||
.use_bolt(!is_aarch64)
|
||||
@@ -194,7 +200,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
|
||||
.checkout_dir(checkout_dir.clone())
|
||||
.host_llvm_dir(checkout_dir.join("citools").join("clang-rust"))
|
||||
.artifact_dir(checkout_dir.join("opt-artifacts"))
|
||||
.build_dir(checkout_dir)
|
||||
.build_dir(checkout_dir.join("build"))
|
||||
.shared_llvm(false)
|
||||
.use_bolt(false)
|
||||
.skipped_tests(vec![])
|
||||
|
||||
@@ -13,7 +13,7 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
|
||||
// and then use that extracted rustc as a stage0 compiler.
|
||||
// Then we run a subset of tests using that compiler, to have a basic smoke test which checks
|
||||
// whether the optimization pipeline hasn't broken something.
|
||||
let build_dir = env.build_root().join("build");
|
||||
let build_dir = env.build_root();
|
||||
let dist_dir = build_dir.join("dist");
|
||||
let unpacked_dist_dir = build_dir.join("unpacked-dist");
|
||||
std::fs::create_dir_all(&unpacked_dist_dir)?;
|
||||
|
||||
Reference in New Issue
Block a user