@@ -42,6 +42,7 @@ pub struct Builder<'a> {
42
42
cache : Cache ,
43
43
stack : RefCell < Vec < Box < Any > > > ,
44
44
time_spent_on_dependencies : Cell < Duration > ,
45
+ pub paths : Vec < PathBuf > ,
45
46
}
46
47
47
48
impl < ' a > Deref for Builder < ' a > {
@@ -351,6 +352,7 @@ impl<'a> Builder<'a> {
351
352
cache : Cache :: new ( ) ,
352
353
stack : RefCell :: new ( Vec :: new ( ) ) ,
353
354
time_spent_on_dependencies : Cell :: new ( Duration :: new ( 0 , 0 ) ) ,
355
+ paths : vec ! [ ] ,
354
356
} ;
355
357
356
358
let builder = & builder;
@@ -367,7 +369,7 @@ impl<'a> Builder<'a> {
367
369
Some ( help)
368
370
}
369
371
370
- pub fn run ( build : & Build ) {
372
+ pub fn new ( build : & Build ) -> Builder {
371
373
let ( kind, paths) = match build. config . cmd {
372
374
Subcommand :: Build { ref paths } => ( Kind :: Build , & paths[ ..] ) ,
373
375
Subcommand :: Check { ref paths } => ( Kind :: Check , & paths[ ..] ) ,
@@ -379,28 +381,27 @@ impl<'a> Builder<'a> {
379
381
Subcommand :: Clean { .. } => panic ! ( ) ,
380
382
} ;
381
383
382
- if let Some ( path) = paths. get ( 0 ) {
383
- if path == Path :: new ( "nonexistent/path/to/trigger/cargo/metadata" ) {
384
- return ;
385
- }
386
- }
387
-
388
384
let builder = Builder {
389
385
build,
390
386
top_stage : build. config . stage . unwrap_or ( 2 ) ,
391
387
kind,
392
388
cache : Cache :: new ( ) ,
393
389
stack : RefCell :: new ( Vec :: new ( ) ) ,
394
390
time_spent_on_dependencies : Cell :: new ( Duration :: new ( 0 , 0 ) ) ,
391
+ paths : paths. to_owned ( ) ,
395
392
} ;
396
393
397
394
if kind == Kind :: Dist {
398
- assert ! ( !build . config. test_miri, "Do not distribute with miri enabled.\n \
395
+ assert ! ( !builder . config. test_miri, "Do not distribute with miri enabled.\n \
399
396
The distributed libraries would include all MIR (increasing binary size).
400
397
The distributed MIR would include validation statements." ) ;
401
398
}
402
399
403
- StepDescription :: run ( & Builder :: get_step_descriptions ( builder. kind ) , & builder, paths) ;
400
+ builder
401
+ }
402
+
403
+ pub fn execute_cli ( & self ) {
404
+ StepDescription :: run ( & Builder :: get_step_descriptions ( self . kind ) , self , & self . paths ) ;
404
405
}
405
406
406
407
pub fn default_doc ( & self , paths : Option < & [ PathBuf ] > ) {
0 commit comments