@@ -27,7 +27,7 @@ use step;
27
27
28
28
/// Deserialized version of all flags for this compile.
29
29
pub struct Flags {
30
- pub verbose : bool ,
30
+ pub verbose : usize , // verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose
31
31
pub stage : Option < u32 > ,
32
32
pub keep_stage : Option < u32 > ,
33
33
pub build : String ,
@@ -37,6 +37,17 @@ pub struct Flags {
37
37
pub src : Option < PathBuf > ,
38
38
pub jobs : Option < u32 > ,
39
39
pub cmd : Subcommand ,
40
+ pub incremental : bool ,
41
+ }
42
+
43
+ impl Flags {
44
+ pub fn verbose ( & self ) -> bool {
45
+ self . verbose > 0
46
+ }
47
+
48
+ pub fn very_verbose ( & self ) -> bool {
49
+ self . verbose > 1
50
+ }
40
51
}
41
52
42
53
pub enum Subcommand {
@@ -63,7 +74,8 @@ pub enum Subcommand {
63
74
impl Flags {
64
75
pub fn parse ( args : & [ String ] ) -> Flags {
65
76
let mut opts = Options :: new ( ) ;
66
- opts. optflag ( "v" , "verbose" , "use verbose output" ) ;
77
+ opts. optflagmulti ( "v" , "verbose" , "use verbose output (-vv for very verbose)" ) ;
78
+ opts. optflag ( "i" , "incremental" , "use incremental compilation" ) ;
67
79
opts. optopt ( "" , "config" , "TOML configuration file for build" , "FILE" ) ;
68
80
opts. optopt ( "" , "build" , "build target of the stage0 compiler" , "BUILD" ) ;
69
81
opts. optmulti ( "" , "host" , "host targets to build" , "HOST" ) ;
@@ -256,8 +268,18 @@ To learn more about a subcommand, run `./x.py <command> -h`
256
268
}
257
269
} ) ;
258
270
271
+ let mut stage = m. opt_str ( "stage" ) . map ( |j| j. parse ( ) . unwrap ( ) ) ;
272
+
273
+ let incremental = m. opt_present ( "i" ) ;
274
+
275
+ if incremental {
276
+ if stage. is_none ( ) {
277
+ stage = Some ( 1 ) ;
278
+ }
279
+ }
280
+
259
281
Flags {
260
- verbose : m. opt_present ( "v" ) ,
282
+ verbose : m. opt_count ( "v" ) ,
261
283
stage : m. opt_str ( "stage" ) . map ( |j| j. parse ( ) . unwrap ( ) ) ,
262
284
keep_stage : m. opt_str ( "keep-stage" ) . map ( |j| j. parse ( ) . unwrap ( ) ) ,
263
285
build : m. opt_str ( "build" ) . unwrap_or_else ( || {
@@ -269,6 +291,7 @@ To learn more about a subcommand, run `./x.py <command> -h`
269
291
src : m. opt_str ( "src" ) . map ( PathBuf :: from) ,
270
292
jobs : m. opt_str ( "jobs" ) . map ( |j| j. parse ( ) . unwrap ( ) ) ,
271
293
cmd : cmd,
294
+ incremental : incremental,
272
295
}
273
296
}
274
297
}
0 commit comments