diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2020-09-18 12:44:25 +0200 |
|---|---|---|
| committer | Pietro Albini <pietro@pietroalbini.org> | 2020-09-18 17:32:37 +0200 |
| commit | 0917b2123fff6cf5357b5edd5db6d675313ab8bd (patch) | |
| tree | b04ddbadadf831049a61bc583381ce23224472a7 /src | |
| parent | b9af3e30a9e34e4fe353e7e5c42103851f9c8f79 (diff) | |
| download | rust-0917b2123fff6cf5357b5edd5db6d675313ab8bd.tar.gz rust-0917b2123fff6cf5357b5edd5db6d675313ab8bd.zip | |
build-manifest: move PkgType into the versions module
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/build-manifest/src/main.rs | 35 | ||||
| -rw-r--r-- | src/tools/build-manifest/src/versions.rs | 27 |
2 files changed, 31 insertions, 31 deletions
diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index ff9ee67763b..7a1878f749e 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -4,8 +4,10 @@ //! via `x.py dist hash-and-sign`; the cmdline arguments are set up //! by rustbuild (in `src/bootstrap/dist.rs`). -use serde::Serialize; +mod versions; +use crate::versions::PkgType; +use serde::Serialize; use std::collections::BTreeMap; use std::collections::HashMap; use std::env; @@ -336,35 +338,6 @@ fn main() { .build(); } -enum PkgType { - RustSrc, - Cargo, - Rls, - RustAnalyzer, - Clippy, - Rustfmt, - LlvmTools, - Miri, - Other, -} - -impl PkgType { - fn from_component(component: &str) -> Self { - use PkgType::*; - match component { - "rust-src" => RustSrc, - "cargo" => Cargo, - "rls" | "rls-preview" => Rls, - "rust-analyzer" | "rust-analyzer-preview" => RustAnalyzer, - "clippy" | "clippy-preview" => Clippy, - "rustfmt" | "rustfmt-preview" => Rustfmt, - "llvm-tools" | "llvm-tools-preview" => LlvmTools, - "miri" | "miri-preview" => Miri, - _ => Other, - } - } -} - impl Builder { fn build(&mut self) { self.rust_version = self.version("rust", "x86_64-unknown-linux-gnu"); @@ -702,7 +675,7 @@ impl Builder { Rustfmt => format!("rustfmt-{}-{}.tar.gz", self.rustfmt_release, target), LlvmTools => format!("llvm-tools-{}-{}.tar.gz", self.llvm_tools_release, target), Miri => format!("miri-{}-{}.tar.gz", self.miri_release, target), - Other => format!("{}-{}-{}.tar.gz", component, self.rust_release, target), + Other(_) => format!("{}-{}-{}.tar.gz", component, self.rust_release, target), } } diff --git a/src/tools/build-manifest/src/versions.rs b/src/tools/build-manifest/src/versions.rs new file mode 100644 index 00000000000..044c04914b1 --- /dev/null +++ b/src/tools/build-manifest/src/versions.rs @@ -0,0 +1,27 @@ +pub(crate) enum PkgType { + RustSrc, + Cargo, + Rls, + RustAnalyzer, + Clippy, + Rustfmt, + LlvmTools, + Miri, + Other(String), +} + +impl PkgType { + pub(crate) fn from_component(component: &str) -> Self { + match component { + "rust-src" => PkgType::RustSrc, + "cargo" => PkgType::Cargo, + "rls" | "rls-preview" => PkgType::Rls, + "rust-analyzer" | "rust-analyzer-preview" => PkgType::RustAnalyzer, + "clippy" | "clippy-preview" => PkgType::Clippy, + "rustfmt" | "rustfmt-preview" => PkgType::Rustfmt, + "llvm-tools" | "llvm-tools-preview" => PkgType::LlvmTools, + "miri" | "miri-preview" => PkgType::Miri, + other => PkgType::Other(other.into()), + } + } +} |
