Move xtask flags around outide the generated section

This commit is contained in:
Laurențiu Nicola 2024-03-23 11:35:32 +02:00
parent e265e3d518
commit 84d38c7e94
2 changed files with 60 additions and 57 deletions

View File

@ -235,6 +235,7 @@ pub struct RunTests {
#[derive(Debug)]
pub struct RustcTests {
pub rustc_repo: PathBuf,
pub filter: Option<String>,
}

View File

@ -81,35 +81,6 @@ pub enum XtaskCmd {
Codegen(Codegen),
}
#[derive(Debug)]
pub struct Codegen {
pub check: bool,
pub codegen_type: Option<CodegenType>,
}
#[derive(Debug, Default)]
pub enum CodegenType {
#[default]
All,
Grammar,
AssistsDocTests,
DiagnosticsDocs,
LintDefinitions,
}
impl FromStr for CodegenType {
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"all" => Ok(Self::All),
"grammar" => Ok(Self::Grammar),
"assists-doc-tests" => Ok(Self::AssistsDocTests),
"diagnostics-docs" => Ok(Self::DiagnosticsDocs),
"lints-definitions" => Ok(Self::LintDefinitions),
_ => Err("Invalid option".to_owned()),
}
}
}
#[derive(Debug)]
pub struct Install {
pub client: bool,
@ -145,6 +116,65 @@ pub struct PublishReleaseNotes {
pub dry_run: bool,
}
#[derive(Debug)]
pub struct Metrics {
pub measurement_type: Option<MeasurementType>,
}
#[derive(Debug)]
pub struct Bb {
pub suffix: String,
}
#[derive(Debug)]
pub struct Codegen {
pub codegen_type: Option<CodegenType>,
pub check: bool,
}
impl Xtask {
#[allow(dead_code)]
pub fn from_env_or_exit() -> Self {
Self::from_env_or_exit_()
}
#[allow(dead_code)]
pub fn from_env() -> xflags::Result<Self> {
Self::from_env_()
}
#[allow(dead_code)]
pub fn from_vec(args: Vec<std::ffi::OsString>) -> xflags::Result<Self> {
Self::from_vec_(args)
}
}
// generated end
#[derive(Debug, Default)]
pub enum CodegenType {
#[default]
All,
Grammar,
AssistsDocTests,
DiagnosticsDocs,
LintDefinitions,
}
impl FromStr for CodegenType {
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"all" => Ok(Self::All),
"grammar" => Ok(Self::Grammar),
"assists-doc-tests" => Ok(Self::AssistsDocTests),
"diagnostics-docs" => Ok(Self::DiagnosticsDocs),
"lints-definitions" => Ok(Self::LintDefinitions),
_ => Err("Invalid option".to_owned()),
}
}
}
#[derive(Debug)]
pub enum MeasurementType {
Build,
@ -185,34 +215,6 @@ impl AsRef<str> for MeasurementType {
}
}
#[derive(Debug)]
pub struct Metrics {
pub measurement_type: Option<MeasurementType>,
}
#[derive(Debug)]
pub struct Bb {
pub suffix: String,
}
impl Xtask {
#[allow(dead_code)]
pub fn from_env_or_exit() -> Self {
Self::from_env_or_exit_()
}
#[allow(dead_code)]
pub fn from_env() -> xflags::Result<Self> {
Self::from_env_()
}
#[allow(dead_code)]
pub fn from_vec(args: Vec<std::ffi::OsString>) -> xflags::Result<Self> {
Self::from_vec_(args)
}
}
// generated end
impl Install {
pub(crate) fn server(&self) -> Option<ServerOpt> {
if self.client && !self.server {