Skip to content

Commit 45b29a5

Browse files
authored
Merge pull request #101 from elichai/2020-07-rustc-dev
Add rustc-dev component option
2 parents 15c3be9 + 8360c6b commit 45b29a5

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
@@ -89,6 +89,9 @@ struct Opts {
8989
#[structopt(long = "with-src", help = "Download rust-src [default: no download]")]
9090
with_src: bool,
9191

92+
#[structopt(long = "with-dev", help = "Download rustc-dev [default: no download]")]
93+
with_dev: bool,
94+
9295
#[structopt(
9396
long = "test-dir",
9497
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)