@@ -314,7 +314,6 @@ def __init__(self):
314
314
self .build_dir = os .path .join (os .getcwd (), "build" )
315
315
self .clean = False
316
316
self .config_toml = ''
317
- self .printed = False
318
317
self .rust_root = os .path .abspath (os .path .join (__file__ , '../../..' ))
319
318
self .use_locked_deps = ''
320
319
self .use_vendored_sources = ''
@@ -336,7 +335,6 @@ def download_stage0(self):
336
335
if self .rustc ().startswith (self .bin_root ()) and \
337
336
(not os .path .exists (self .rustc ()) or
338
337
self .program_out_of_date (self .rustc_stamp ())):
339
- self .print_what_bootstrap_means ()
340
338
if os .path .exists (self .bin_root ()):
341
339
shutil .rmtree (self .bin_root ())
342
340
filename = "rust-std-{}-{}.tar.gz" .format (
@@ -354,7 +352,6 @@ def download_stage0(self):
354
352
if self .cargo ().startswith (self .bin_root ()) and \
355
353
(not os .path .exists (self .cargo ()) or
356
354
self .program_out_of_date (self .cargo_stamp ())):
357
- self .print_what_bootstrap_means ()
358
355
filename = "cargo-{}-{}.tar.gz" .format (cargo_channel , self .build )
359
356
self ._download_stage0_helper (filename , "cargo" )
360
357
self .fix_executable ("{}/bin/cargo" .format (self .bin_root ()))
@@ -555,23 +552,6 @@ def exe_suffix():
555
552
return '.exe'
556
553
return ''
557
554
558
- def print_what_bootstrap_means (self ):
559
- """Prints more information about the build system"""
560
- if hasattr (self , 'printed' ):
561
- return
562
- self .printed = True
563
- if os .path .exists (self .bootstrap_binary ()):
564
- return
565
- if '--help' not in sys .argv or len (sys .argv ) == 1 :
566
- return
567
-
568
- print ('info: the build system for Rust is written in Rust, so this' )
569
- print (' script is now going to download a stage0 rust compiler' )
570
- print (' and then compile the build system itself' )
571
- print ('' )
572
- print ('info: in the meantime you can read more about rustbuild at' )
573
- print (' src/bootstrap/README.md before the download finishes' )
574
-
575
555
def bootstrap_binary (self ):
576
556
"""Return the path of the boostrap binary
577
557
@@ -585,7 +565,6 @@ def bootstrap_binary(self):
585
565
586
566
def build_bootstrap (self ):
587
567
"""Build bootstrap"""
588
- self .print_what_bootstrap_means ()
589
568
build_dir = os .path .join (self .build_dir , "bootstrap" )
590
569
if self .clean and os .path .exists (build_dir ):
591
570
shutil .rmtree (build_dir )
@@ -670,8 +649,16 @@ def set_dev_environment(self):
670
649
self ._download_url = 'https://dev-static.rust-lang.org'
671
650
672
651
673
- def bootstrap ():
652
+ def bootstrap (help_triggered ):
674
653
"""Configure, fetch, build and run the initial bootstrap"""
654
+
655
+ # If the user is asking for help, let them know that the whole download-and-build
656
+ # process has to happen before anything is printed out.
657
+ if help_triggered :
658
+ print ("info: Downloading and building bootstrap before processing --help" )
659
+ print (" command. See src/bootstrap/README.md for help with common" )
660
+ print (" commands." )
661
+
675
662
parser = argparse .ArgumentParser (description = 'Build rust' )
676
663
parser .add_argument ('--config' )
677
664
parser .add_argument ('--build' )
@@ -708,7 +695,7 @@ def bootstrap():
708
695
print (' and so in order to preserve your $HOME this will now' )
709
696
print (' use vendored sources by default. Note that if this' )
710
697
print (' does not work you should run a normal build first' )
711
- print (' before running a command like `sudo make install`' )
698
+ print (' before running a command like `sudo ./x.py install`' )
712
699
713
700
if build .use_vendored_sources :
714
701
if not os .path .exists ('.cargo' ):
@@ -734,7 +721,10 @@ def bootstrap():
734
721
if 'dev' in data :
735
722
build .set_dev_environment ()
736
723
737
- build .update_submodules ()
724
+ # No help text depends on submodules. This check saves ~1 minute of git commands, even if
725
+ # all the submodules are present and downloaded!
726
+ if not help_triggered :
727
+ build .update_submodules ()
738
728
739
729
# Fetch/build the bootstrap
740
730
build .build = args .build or build .build_triple ()
@@ -760,7 +750,7 @@ def main():
760
750
help_triggered = (
761
751
'-h' in sys .argv ) or ('--help' in sys .argv ) or (len (sys .argv ) == 1 )
762
752
try :
763
- bootstrap ()
753
+ bootstrap (help_triggered )
764
754
if not help_triggered :
765
755
print ("Build completed successfully in {}" .format (
766
756
format_build_time (time () - start_time )))
0 commit comments