Skip to content

Commit 8360c6b

Browse files
committed
Add rustc-dev component option
1 parent 176217a commit 8360c6b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ struct Opts {
9696
#[structopt(long = "with-src", help = "Download rust-src [default: no download]")]
9797
with_src: bool,
9898

99+
#[structopt(long = "with-dev", help = "Download rustc-dev [default: no download]")]
100+
with_dev: bool,
101+
99102
#[structopt(
100103
long = "test-dir",
101104
help = "Root directory for tests",

src/toolchains.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,28 @@ impl Toolchain {
259259
.map_err(InstallError::Download)?;
260260
}
261261

262+
if dl_params.install_dev {
263+
let filename = format!("rustc-dev-nightly-{}", self.host);
264+
download_tarball(
265+
&client,
266+
"rustc-dev",
267+
&format!("{}/{}/{}.tar", dl_params.url_prefix, location, filename,),
268+
Some(&PathBuf::from(&filename).join(format!("rustc-dev-{}", self.host))),
269+
tmpdir.path(),
270+
)
271+
.map_err(InstallError::Download)?;
272+
// llvm-tools-(preview) is currently required for using rustc-dev https://github.com/rust-lang/rust/issues/72594
273+
let filename = format!("llvm-tools-nightly-{}", self.host);
274+
download_tarball(
275+
&client,
276+
"llvm-tools",
277+
&format!("{}/{}/{}.tar", dl_params.url_prefix, location, filename,),
278+
Some(&PathBuf::from(&filename).join("llvm-tools-preview")),
279+
tmpdir.path(),
280+
)
281+
.map_err(InstallError::Download)?;
282+
}
283+
262284
fs::rename(tmpdir.into_path(), dest).map_err(InstallError::Move)?;
263285

264286
Ok(())
@@ -412,6 +434,7 @@ pub(crate) struct DownloadParams {
412434
tmp_dir: PathBuf,
413435
install_dir: PathBuf,
414436
install_src: bool,
437+
install_dev: bool,
415438
without_cargo: bool,
416439
force_install: bool,
417440
}
@@ -437,6 +460,7 @@ impl DownloadParams {
437460
tmp_dir: cfg.rustup_tmp_path.clone(),
438461
install_dir: cfg.toolchains_path.clone(),
439462
install_src: cfg.args.with_src,
463+
install_dev: cfg.args.with_dev,
440464
without_cargo: cfg.args.without_cargo,
441465
force_install: cfg.args.force_install,
442466
}

0 commit comments

Comments
 (0)