diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-18 18:57:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-18 18:57:02 +0100 |
| commit | 3fb5d8e5ddbd2ec9c3b4bdac8d4c0c8f83bf5ae1 (patch) | |
| tree | 26b3a2d29ce2fc20cfaf92e77a6a2c7272ec6ced /src/bootstrap/builder.rs | |
| parent | 35a99eef32a2b7b9d8e77dde539f869e522d181f (diff) | |
| parent | fca829075fd76385ac6aa7bff957e7eebbf89ae1 (diff) | |
| download | rust-3fb5d8e5ddbd2ec9c3b4bdac8d4c0c8f83bf5ae1.tar.gz rust-3fb5d8e5ddbd2ec9c3b4bdac8d4c0c8f83bf5ae1.zip | |
Rollup merge of #96584 - bentongxyz:x-setup-h-v-should-work, r=jyn514
Fix `x setup -h -v` should work r? `@jyn514` I have to convert profile to path and back in order to remove special-casing in bootstrap. I also check for `dry_run` so that `config.toml` and/ or `.git/hooks/pre-push` will not be created if `--dry-run` is specified. Please help me see if this is ok, thanks alot!
Diffstat (limited to 'src/bootstrap/builder.rs')
| -rw-r--r-- | src/bootstrap/builder.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 3f551dc119b..1d37d68c1d4 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -19,6 +19,7 @@ use crate::flags::{Color, Subcommand}; use crate::install; use crate::native; use crate::run; +use crate::setup; use crate::test; use crate::tool::{self, SourceType}; use crate::util::{self, add_dylib_path, add_link_lib_path, exe, libdir, output, t}; @@ -433,8 +434,11 @@ impl<'a> ShouldRun<'a> { // single alias, which does not correspond to any on-disk path pub fn alias(mut self, alias: &str) -> Self { + // exceptional case for `Kind::Setup` because its `library` + // and `compiler` options would otherwise naively match with + // `compiler` and `library` folders respectively. assert!( - !self.builder.src.join(alias).exists(), + self.kind == Kind::Setup || !self.builder.src.join(alias).exists(), "use `builder.path()` for real paths: {}", alias ); @@ -758,8 +762,9 @@ impl<'a> Builder<'a> { run::CollectLicenseMetadata, run::GenerateCopyright, ), + Kind::Setup => describe!(setup::Profile), // These commands either don't use paths, or they're special-cased in Build::build() - Kind::Clean | Kind::Format | Kind::Setup => vec![], + Kind::Clean | Kind::Format => vec![], } } @@ -822,7 +827,11 @@ impl<'a> Builder<'a> { Subcommand::Install { ref paths } => (Kind::Install, &paths[..]), Subcommand::Run { ref paths, .. } => (Kind::Run, &paths[..]), Subcommand::Format { .. } => (Kind::Format, &[][..]), - Subcommand::Clean { .. } | Subcommand::Setup { .. } => { + Subcommand::Setup { profile: ref path } => ( + Kind::Setup, + path.as_ref().map_or([].as_slice(), |path| std::slice::from_ref(path)), + ), + Subcommand::Clean { .. } => { panic!() } }; |
