File tree 3 files changed +43
-15
lines changed
3 files changed +43
-15
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,27 @@ implementation details, consumed by Propolis components.
41
41
to the ` propolis ` library
42
42
- viona-api: API (ioctls & structs) for the illumos viona driver
43
43
44
+ ## xtasks
45
+
46
+ Propolis uses the ` cargo xtask ` pattern in order to conveniently expose certain
47
+ tasks to developers.
48
+
49
+ - ` clippy ` : Run suite of clippy checks. This performs more than a simple
50
+ ` cargo clippy ` , since there are several combinations of feature flags which
51
+ must be checked.
52
+ - ` fmt ` : Check style according to ` rustfmt `
53
+ - ` license ` : Check (crudely) that files bear appropriate license headers
54
+ - ` phd ` : Run the PHD test suite
55
+ - ` style ` : Perform miscellaneous style checks
56
+ - ` prepush ` : Preform pre-push checks (` clippy ` , ` fmt ` , ` license ` , ` style ` ) in a
57
+ manner which resembles (but does not exactly match) how they are run in CI.
58
+ Running tests (unit, integration, or phd) are not included and are left to
59
+ the user.
60
+
61
+ It is recommended that developers run the ` prepush ` test before pushing a
62
+ branch which will be subsequently checked by CI. Doing so currently requires
63
+ an x86\_ 64 UNIX/Linux machine.
64
+
44
65
## License
45
66
46
67
Unless otherwise noted, all components are licensed under the [ Mozilla Public
Original file line number Diff line number Diff line change @@ -38,7 +38,11 @@ enum Cmds {
38
38
/// (Crudely) Check for appropriate license headers
39
39
License ,
40
40
/// Preform pre-push checks (clippy, license, fmt, etc)
41
- Prepush ,
41
+ Prepush {
42
+ /// Suppress non-essential output
43
+ #[ arg( short, long) ]
44
+ quiet : bool ,
45
+ } ,
42
46
/// Run the PHD test suite
43
47
Phd {
44
48
#[ clap( subcommand) ]
@@ -61,8 +65,8 @@ fn main() -> Result<()> {
61
65
Ok ( ( ) )
62
66
}
63
67
Cmds :: Phd { cmd } => cmd. run ( ) ,
64
- Cmds :: Prepush => {
65
- task_prepush:: cmd_prepush ( ) ?;
68
+ Cmds :: Prepush { quiet } => {
69
+ task_prepush:: cmd_prepush ( quiet ) ?;
66
70
67
71
println ! ( "Pre-push checks pass" ) ;
68
72
Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -6,19 +6,22 @@ use anyhow::{bail, Result};
6
6
7
7
use crate :: { task_clippy, task_fmt, task_license, task_style} ;
8
8
9
- pub ( crate ) fn cmd_prepush ( ) -> Result < ( ) > {
9
+ pub ( crate ) fn cmd_prepush ( quiet : bool ) -> Result < ( ) > {
10
10
let mut errs = Vec :: new ( ) ;
11
- if task_clippy:: cmd_clippy ( true , true ) . is_err ( ) {
12
- errs. push ( "clippy" ) ;
13
- }
14
- if task_fmt:: cmd_fmt ( ) . is_err ( ) {
15
- errs. push ( "fmt" ) ;
16
- }
17
- if task_license:: cmd_license ( ) . is_err ( ) {
18
- errs. push ( "license" ) ;
19
- }
20
- if task_style:: cmd_style ( ) . is_err ( ) {
21
- errs. push ( "style" ) ;
11
+ let checks: [ ( & str , & dyn Fn ( ) -> bool ) ; 4 ] = [
12
+ ( "clippy" , & || task_clippy:: cmd_clippy ( true , quiet) . is_err ( ) ) ,
13
+ ( "fmt" , & || task_fmt:: cmd_fmt ( ) . is_err ( ) ) ,
14
+ ( "license" , & || task_license:: cmd_license ( ) . is_err ( ) ) ,
15
+ ( "style" , & || task_style:: cmd_style ( ) . is_err ( ) ) ,
16
+ ] ;
17
+
18
+ for ( name, func) in checks {
19
+ if !quiet {
20
+ println ! ( "Checking {name}..." ) ;
21
+ }
22
+ if func ( ) {
23
+ errs. push ( name) ;
24
+ }
22
25
}
23
26
24
27
if !errs. is_empty ( ) {
You can’t perform that action at this time.
0 commit comments