Improve --help performance for x.py
Since compiling the bootstrap command doesn't require any submodules, we can skip updating submodules when a --help command is passed in. On my machine, this saves 1 minute if the submodules are already downloaded, and 10 minutes if run on a clean repo. This commit also adds a message before compiling/downloading anything when a --help command is passed in, to tell the user WHY --help takes so long to complete. It also points the user to the bootstrap README.md for faster help. Finally, this fixes one warning message that still referenced using make instead of x.py, even though x.py is now the standard way of building rust.
This commit is contained in:
parent
6070d3e47e
commit
ffb6291cd0
@ -670,7 +670,7 @@ class RustBuild(object):
|
||||
self._download_url = 'https://dev-static.rust-lang.org'
|
||||
|
||||
|
||||
def bootstrap():
|
||||
def bootstrap(help_triggered):
|
||||
"""Configure, fetch, build and run the initial bootstrap"""
|
||||
parser = argparse.ArgumentParser(description='Build rust')
|
||||
parser.add_argument('--config')
|
||||
@ -708,7 +708,7 @@ def bootstrap():
|
||||
print(' and so in order to preserve your $HOME this will now')
|
||||
print(' use vendored sources by default. Note that if this')
|
||||
print(' does not work you should run a normal build first')
|
||||
print(' before running a command like `sudo make install`')
|
||||
print(' before running a command like `sudo ./x.py install`')
|
||||
|
||||
if build.use_vendored_sources:
|
||||
if not os.path.exists('.cargo'):
|
||||
@ -734,7 +734,10 @@ def bootstrap():
|
||||
if 'dev' in data:
|
||||
build.set_dev_environment()
|
||||
|
||||
build.update_submodules()
|
||||
# No help text depends on submodules. This check saves ~1 minute of git commands, even if
|
||||
# all the submodules are present and downloaded!
|
||||
if not help_triggered:
|
||||
build.update_submodules()
|
||||
|
||||
# Fetch/build the bootstrap
|
||||
build.build = args.build or build.build_triple()
|
||||
@ -760,7 +763,13 @@ def main():
|
||||
help_triggered = (
|
||||
'-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
|
||||
try:
|
||||
bootstrap()
|
||||
# If the user is asking for help, let them know that the whole download-and-build
|
||||
# process has to happen before anything is printed out.
|
||||
if help_triggered:
|
||||
print("NOTE: Downloading and compiling bootstrap requirements before processing")
|
||||
print(" --help command. See src/bootstrap/README.md for help with common")
|
||||
print(" commands.")
|
||||
bootstrap(help_triggered)
|
||||
if not help_triggered:
|
||||
print("Build completed successfully in {}".format(
|
||||
format_build_time(time() - start_time)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user