diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-10-26 15:52:24 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-10-26 18:09:06 +0200 |
commit | 4943d4268acc357364a45a1367bc641ed639dccd (patch) | |
tree | d94ec1e7030179f3ea440ead5e6316e3e19262d0 /bin/bootstrap.py | |
parent | 4e1887c8f496528081214446ea055a10be8e5b86 (diff) | |
download | justbuild-4943d4268acc357364a45a1367bc641ed639dccd.tar.gz |
bootstrap: Support building bootstrap_just in parallel
Diffstat (limited to 'bin/bootstrap.py')
-rwxr-xr-x | bin/bootstrap.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/bin/bootstrap.py b/bin/bootstrap.py index 098662d7..41b91e49 100755 --- a/bin/bootstrap.py +++ b/bin/bootstrap.py @@ -24,9 +24,12 @@ import tempfile import platform from pathlib import Path +from concurrent.futures import ThreadPoolExecutor # path within the repository (constants) +DEBUG = os.environ.get("DEBUG") + REPOS = "etc/repos.json" BOOTSTRAP_CC = ["clang++", "-std=c++20", "-DBOOTSTRAP_BUILD_TOOL"] MAIN_MODULE = "" @@ -238,11 +241,12 @@ def bootstrap(): if f.endswith(".cpp"): cpp_files.append(os.path.join(root, f)) object_files = [] - for f in cpp_files: - obj_file_name = f[:-len(".cpp")] + ".o" - object_files.append(obj_file_name) - cmd = BOOTSTRAP_CC + flags + ["-c", f, "-o", obj_file_name] - run(cmd, cwd=src_wrkdir) + with ThreadPoolExecutor(max_workers=1 if DEBUG else None) as ts: + for f in cpp_files: + obj_file_name = f[:-len(".cpp")] + ".o" + object_files.append(obj_file_name) + cmd = BOOTSTRAP_CC + flags + ["-c", f, "-o", obj_file_name] + ts.submit(run, cmd, cwd=src_wrkdir) bootstrap_just = os.path.join(WRKDIR, "bootstrap-just") cmd = BOOTSTRAP_CC + ["-o", bootstrap_just ] + object_files + dep_flags["link"] @@ -264,7 +268,7 @@ def bootstrap(): "--dump-artifacts-to-build", TO_BUILD, MAIN_MODULE, MAIN_TARGET ], cwd=src_wrkdir) - if "DEBUG" in os.environ: + if DEBUG: traverser = "./bin/bootstrap-traverser.py" else: traverser = "./bin/parallel-bootstrap-traverser.py" |