Skip to content

Commit d14f82b

Browse files
Auto merge of #144164 - ognevny:opt-dist-stage0-root, r=<try>
opt-dist: add an option for setting path to stage0 root in MSYS2 we have problems with stage0 for *-gnullvm hosts because prebuilt dist tarballs will be available starting from 1.90.0-beta. also this change helps to match bootstrap.toml config <!-- homu-ignore:start --> <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> --> <!-- homu-ignore:end --> r? Kobzol try-job: dist-x86_64-msvc try-job: dist-x86_64-linux
2 parents 6781992 + 0d8e7c1 commit d14f82b

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/tools/opt-dist/src/environment.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub struct Environment {
2828
run_tests: bool,
2929
fast_try_build: bool,
3030
build_llvm: bool,
31+
stage0_root: Option<Utf8PathBuf>,
3132
}
3233

3334
impl Environment {
@@ -56,17 +57,11 @@ impl Environment {
5657
}
5758

5859
pub fn cargo_stage_0(&self) -> Utf8PathBuf {
59-
self.build_artifacts()
60-
.join("stage0")
61-
.join("bin")
62-
.join(format!("cargo{}", executable_extension()))
60+
self.stage0().join("bin").join(format!("cargo{}", executable_extension()))
6361
}
6462

6563
pub fn rustc_stage_0(&self) -> Utf8PathBuf {
66-
self.build_artifacts()
67-
.join("stage0")
68-
.join("bin")
69-
.join(format!("rustc{}", executable_extension()))
64+
self.stage0().join("bin").join(format!("rustc{}", executable_extension()))
7065
}
7166

7267
pub fn rustc_stage_2(&self) -> Utf8PathBuf {
@@ -116,6 +111,10 @@ impl Environment {
116111
pub fn build_llvm(&self) -> bool {
117112
self.build_llvm
118113
}
114+
115+
pub fn stage0(&self) -> Utf8PathBuf {
116+
self.stage0_root.clone().unwrap_or_else(|| self.build_artifacts().join("stage0"))
117+
}
119118
}
120119

121120
/// What is the extension of binary executables on this platform?

src/tools/opt-dist/src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ enum EnvironmentCmd {
107107
/// in bootstrap.toml via `build.build-dir` option
108108
#[arg(long, default_value = "build")]
109109
build_dir: Utf8PathBuf,
110+
111+
/// Path to custom stage0 root
112+
#[arg(long)]
113+
stage0_root: Option<Utf8PathBuf>,
110114
},
111115
/// Perform an optimized build on Linux CI, from inside Docker.
112116
LinuxCi {
@@ -144,6 +148,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
144148
run_tests,
145149
build_llvm,
146150
build_dir,
151+
stage0_root,
147152
} => {
148153
let env = EnvironmentBuilder::default()
149154
.host_tuple(target_triple)
@@ -160,6 +165,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
160165
.run_tests(run_tests)
161166
.fast_try_build(is_fast_try_build)
162167
.build_llvm(build_llvm)
168+
.stage0_root(stage0_root)
163169
.build()?;
164170

165171
(env, shared.build_args)

0 commit comments

Comments
 (0)