build-manifest: move PkgType into the versions module

This commit is contained in:
Pietro Albini 2020-09-18 12:44:25 +02:00
parent b9af3e30a9
commit 0917b2123f
No known key found for this signature in database
GPG Key ID: 3E06ABE80BAAF19C
2 changed files with 31 additions and 31 deletions

View File

@ -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),
}
}

View File

@ -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()),
}
}
}