@@ -42,6 +42,7 @@ pub struct Builder<'a> {
4242 cache : Cache ,
4343 stack : RefCell < Vec < Box < Any > > > ,
4444 time_spent_on_dependencies : Cell < Duration > ,
45+ pub paths : Vec < PathBuf > ,
4546}
4647
4748impl < ' a > Deref for Builder < ' a > {
@@ -351,6 +352,7 @@ impl<'a> Builder<'a> {
351352 cache : Cache :: new ( ) ,
352353 stack : RefCell :: new ( Vec :: new ( ) ) ,
353354 time_spent_on_dependencies : Cell :: new ( Duration :: new ( 0 , 0 ) ) ,
355+ paths : vec ! [ ] ,
354356 } ;
355357
356358 let builder = & builder;
@@ -367,7 +369,7 @@ impl<'a> Builder<'a> {
367369 Some ( help)
368370 }
369371
370- pub fn run ( build : & Build ) {
372+ pub fn new ( build : & Build ) -> Builder {
371373 let ( kind, paths) = match build. config . cmd {
372374 Subcommand :: Build { ref paths } => ( Kind :: Build , & paths[ ..] ) ,
373375 Subcommand :: Check { ref paths } => ( Kind :: Check , & paths[ ..] ) ,
@@ -379,28 +381,27 @@ impl<'a> Builder<'a> {
379381 Subcommand :: Clean { .. } => panic ! ( ) ,
380382 } ;
381383
382- if let Some ( path) = paths. get ( 0 ) {
383- if path == Path :: new ( "nonexistent/path/to/trigger/cargo/metadata" ) {
384- return ;
385- }
386- }
387-
388384 let builder = Builder {
389385 build,
390386 top_stage : build. config . stage . unwrap_or ( 2 ) ,
391387 kind,
392388 cache : Cache :: new ( ) ,
393389 stack : RefCell :: new ( Vec :: new ( ) ) ,
394390 time_spent_on_dependencies : Cell :: new ( Duration :: new ( 0 , 0 ) ) ,
391+ paths : paths. to_owned ( ) ,
395392 } ;
396393
397394 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 \
399396 The distributed libraries would include all MIR (increasing binary size).
400397 The distributed MIR would include validation statements." ) ;
401398 }
402399
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 ) ;
404405 }
405406
406407 pub fn default_doc ( & self , paths : Option < & [ PathBuf ] > ) {
0 commit comments