mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Restructure ci
modules (#13101)
# Objective - Currently all `ci` commands are in the `subcommands` module. This is problematic when you want to implement actually subcommands (such as `cargo r -p ci -- doc check`). - All command modules include the `_command` suffix, which is redundant. ## Solution - Move `commands` modules into root crate folder. - Merge contents of `commands/mod.rs` into `main.rs`. - Move `commands::subcommands` module into `commands` module. - Remove the `_command` suffix from all `commands::subcommands` modules.
This commit is contained in:
parent
5b899b48f5
commit
9c17fc2d8d
19 changed files with 78 additions and 79 deletions
|
@ -1,5 +1,5 @@
|
||||||
use crate::commands::prepare::{Flag, Prepare, PreparedCommand};
|
use crate::commands;
|
||||||
use crate::commands::subcommands;
|
use crate::prepare::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
|
|
||||||
/// The CI command line tool for Bevy.
|
/// The CI command line tool for Bevy.
|
||||||
|
@ -62,17 +62,17 @@ impl CI {
|
||||||
None => {
|
None => {
|
||||||
// Note that we are running the subcommands directly rather than using any aliases
|
// Note that we are running the subcommands directly rather than using any aliases
|
||||||
let mut cmds = vec![];
|
let mut cmds = vec![];
|
||||||
cmds.append(&mut subcommands::FormatCommand::default().prepare(sh, flags));
|
cmds.append(&mut commands::FormatCommand::default().prepare(sh, flags));
|
||||||
cmds.append(&mut subcommands::ClippyCommand::default().prepare(sh, flags));
|
cmds.append(&mut commands::ClippyCommand::default().prepare(sh, flags));
|
||||||
cmds.append(&mut subcommands::TestCommand::default().prepare(sh, flags));
|
cmds.append(&mut commands::TestCommand::default().prepare(sh, flags));
|
||||||
cmds.append(&mut subcommands::TestCheckCommand::default().prepare(sh, flags));
|
cmds.append(&mut commands::TestCheckCommand::default().prepare(sh, flags));
|
||||||
cmds.append(&mut subcommands::DocCheckCommand::default().prepare(sh, flags));
|
cmds.append(&mut commands::DocCheckCommand::default().prepare(sh, flags));
|
||||||
cmds.append(&mut subcommands::DocTestCommand::default().prepare(sh, flags));
|
cmds.append(&mut commands::DocTestCommand::default().prepare(sh, flags));
|
||||||
cmds.append(&mut subcommands::CompileCheckCommand::default().prepare(sh, flags));
|
cmds.append(&mut commands::CompileCheckCommand::default().prepare(sh, flags));
|
||||||
cmds.append(&mut subcommands::CfgCheckCommand::default().prepare(sh, flags));
|
cmds.append(&mut commands::CfgCheckCommand::default().prepare(sh, flags));
|
||||||
cmds.append(&mut subcommands::CompileFailCommand::default().prepare(sh, flags));
|
cmds.append(&mut commands::CompileFailCommand::default().prepare(sh, flags));
|
||||||
cmds.append(&mut subcommands::BenchCheckCommand::default().prepare(sh, flags));
|
cmds.append(&mut commands::BenchCheckCommand::default().prepare(sh, flags));
|
||||||
cmds.append(&mut subcommands::ExampleCheckCommand::default().prepare(sh, flags));
|
cmds.append(&mut commands::ExampleCheckCommand::default().prepare(sh, flags));
|
||||||
cmds
|
cmds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,21 +84,21 @@ impl CI {
|
||||||
#[argh(subcommand)]
|
#[argh(subcommand)]
|
||||||
enum Commands {
|
enum Commands {
|
||||||
// Aliases (subcommands that run other subcommands)
|
// Aliases (subcommands that run other subcommands)
|
||||||
Lints(subcommands::LintsCommand),
|
Lints(commands::LintsCommand),
|
||||||
Doc(subcommands::DocCommand),
|
Doc(commands::DocCommand),
|
||||||
Compile(subcommands::CompileCommand),
|
Compile(commands::CompileCommand),
|
||||||
// Actual subcommands
|
// Actual subcommands
|
||||||
Format(subcommands::FormatCommand),
|
Format(commands::FormatCommand),
|
||||||
Clippy(subcommands::ClippyCommand),
|
Clippy(commands::ClippyCommand),
|
||||||
Test(subcommands::TestCommand),
|
Test(commands::TestCommand),
|
||||||
TestCheck(subcommands::TestCheckCommand),
|
TestCheck(commands::TestCheckCommand),
|
||||||
DocCheck(subcommands::DocCheckCommand),
|
DocCheck(commands::DocCheckCommand),
|
||||||
DocTest(subcommands::DocTestCommand),
|
DocTest(commands::DocTestCommand),
|
||||||
CompileCheck(subcommands::CompileCheckCommand),
|
CompileCheck(commands::CompileCheckCommand),
|
||||||
CfgCheck(subcommands::CfgCheckCommand),
|
CfgCheck(commands::CfgCheckCommand),
|
||||||
CompileFail(subcommands::CompileFailCommand),
|
CompileFail(commands::CompileFailCommand),
|
||||||
BenchCheck(subcommands::BenchCheckCommand),
|
BenchCheck(commands::BenchCheckCommand),
|
||||||
ExampleCheck(subcommands::ExampleCheckCommand),
|
ExampleCheck(commands::ExampleCheckCommand),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Prepare for Commands {
|
impl Prepare for Commands {
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
use xshell::cmd;
|
use xshell::cmd;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
use xshell::cmd;
|
use xshell::cmd;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
use xshell::cmd;
|
use xshell::cmd;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::commands::subcommands::{
|
use crate::commands::{
|
||||||
BenchCheckCommand, CompileCheckCommand, CompileFailCommand, ExampleCheckCommand,
|
BenchCheckCommand, CompileCheckCommand, CompileFailCommand, ExampleCheckCommand,
|
||||||
TestCheckCommand,
|
TestCheckCommand,
|
||||||
};
|
};
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
|
|
||||||
/// Alias for running the `compile-fail`, `bench-check`, `example-check`, `compile-check`, and `test-check` subcommands.
|
/// Alias for running the `compile-fail`, `bench-check`, `example-check`, `compile-check`, and `test-check` subcommands.
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
use xshell::cmd;
|
use xshell::cmd;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
use xshell::cmd;
|
use xshell::cmd;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::commands::subcommands::{DocCheckCommand, DocTestCommand};
|
use crate::commands::{DocCheckCommand, DocTestCommand};
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
|
|
||||||
/// Alias for running the `doc-test` and `doc-check` subcommands.
|
/// Alias for running the `doc-test` and `doc-check` subcommands.
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
use xshell::cmd;
|
use xshell::cmd;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
use xshell::cmd;
|
use xshell::cmd;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
use xshell::cmd;
|
use xshell::cmd;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
use xshell::cmd;
|
use xshell::cmd;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::commands::subcommands::{ClippyCommand, FormatCommand};
|
use crate::commands::{ClippyCommand, FormatCommand};
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
|
|
||||||
/// Alias for running the `format` and `clippy` subcommands.
|
/// Alias for running the `format` and `clippy` subcommands.
|
|
@ -1,6 +1,29 @@
|
||||||
pub(crate) use ci::*;
|
pub(crate) use bench_check::*;
|
||||||
use prepare::*;
|
pub(crate) use cfg_check::*;
|
||||||
|
pub(crate) use clippy::*;
|
||||||
|
pub(crate) use compile::*;
|
||||||
|
pub(crate) use compile_check::*;
|
||||||
|
pub(crate) use compile_fail::*;
|
||||||
|
pub(crate) use doc::*;
|
||||||
|
pub(crate) use doc_check::*;
|
||||||
|
pub(crate) use doc_test::*;
|
||||||
|
pub(crate) use example_check::*;
|
||||||
|
pub(crate) use format::*;
|
||||||
|
pub(crate) use lints::*;
|
||||||
|
pub(crate) use test::*;
|
||||||
|
pub(crate) use test_check::*;
|
||||||
|
|
||||||
mod ci;
|
mod bench_check;
|
||||||
mod prepare;
|
mod cfg_check;
|
||||||
mod subcommands;
|
mod clippy;
|
||||||
|
mod compile;
|
||||||
|
mod compile_check;
|
||||||
|
mod compile_fail;
|
||||||
|
mod doc;
|
||||||
|
mod doc_check;
|
||||||
|
mod doc_test;
|
||||||
|
mod example_check;
|
||||||
|
mod format;
|
||||||
|
mod lints;
|
||||||
|
mod test;
|
||||||
|
mod test_check;
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
pub(crate) use bench_check_command::*;
|
|
||||||
pub(crate) use cfg_check_command::*;
|
|
||||||
pub(crate) use clippy_command::*;
|
|
||||||
pub(crate) use compile_check_command::*;
|
|
||||||
pub(crate) use compile_command::*;
|
|
||||||
pub(crate) use compile_fail_command::*;
|
|
||||||
pub(crate) use doc_check_command::*;
|
|
||||||
pub(crate) use doc_command::*;
|
|
||||||
pub(crate) use doc_test_command::*;
|
|
||||||
pub(crate) use example_check_command::*;
|
|
||||||
pub(crate) use format_command::*;
|
|
||||||
pub(crate) use lints_command::*;
|
|
||||||
pub(crate) use test_check_command::*;
|
|
||||||
pub(crate) use test_command::*;
|
|
||||||
|
|
||||||
mod bench_check_command;
|
|
||||||
mod cfg_check_command;
|
|
||||||
mod clippy_command;
|
|
||||||
mod compile_check_command;
|
|
||||||
mod compile_command;
|
|
||||||
mod compile_fail_command;
|
|
||||||
mod doc_check_command;
|
|
||||||
mod doc_command;
|
|
||||||
mod doc_test_command;
|
|
||||||
mod example_check_command;
|
|
||||||
mod format_command;
|
|
||||||
mod lints_command;
|
|
||||||
mod test_check_command;
|
|
||||||
mod test_command;
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
use xshell::cmd;
|
use xshell::cmd;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::commands::{Flag, Prepare, PreparedCommand};
|
use crate::{Flag, Prepare, PreparedCommand};
|
||||||
use argh::FromArgs;
|
use argh::FromArgs;
|
||||||
use xshell::cmd;
|
use xshell::cmd;
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
//! CI script used for Bevy.
|
//! CI script used for Bevy.
|
||||||
|
|
||||||
|
mod ci;
|
||||||
mod commands;
|
mod commands;
|
||||||
|
mod prepare;
|
||||||
|
|
||||||
|
pub(crate) use self::ci::*;
|
||||||
|
pub(crate) use self::prepare::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
argh::from_env::<commands::CI>().run();
|
argh::from_env::<CI>().run();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue