diff options
author | Sean Callanan <scallanan@apple.com> | 2017-07-31 21:50:00 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2017-07-31 21:50:00 +0000 |
commit | 558e52c1089519bc8a4188b806717cf1bfd13d24 (patch) | |
tree | 184effb3e9436d03499104751df6f768aebd9906 | |
parent | 038e28a5a71b63c145e6587eac3bfbf2a7ea1f44 (diff) | |
download | bcm5719-llvm-558e52c1089519bc8a4188b806717cf1bfd13d24.tar.gz bcm5719-llvm-558e52c1089519bc8a4188b806717cf1bfd13d24.zip |
[build-script] Bring in modernizations from downstream:
- Don't do any checks of the current SCM repository if the
llvm repositories are already there. Useful for bots.
- When symlinking, remove old symlinks.
- Support loading build-script as a library, not necessarily
under Xcode.
- Stringify args before passing them to subprocess.
llvm-svn: 309631
-rwxr-xr-x | lldb/scripts/Xcode/build-llvm.py | 31 | ||||
-rw-r--r-- | lldb/scripts/Xcode/lldbbuild.py | 9 |
2 files changed, 32 insertions, 8 deletions
diff --git a/lldb/scripts/Xcode/build-llvm.py b/lldb/scripts/Xcode/build-llvm.py index e2a46de1a16..4a18abefc85 100755 --- a/lldb/scripts/Xcode/build-llvm.py +++ b/lldb/scripts/Xcode/build-llvm.py @@ -14,7 +14,6 @@ from lldbbuild import * #### SETTINGS #### - def LLVM_HASH_INCLUDES_DIFFS(): return False @@ -42,7 +41,25 @@ def process_repo(r): 'ref': r["ref"] } +def fallback_repo(name): + return { + 'name': name, + 'vcs': None, + 'root': process_root(name), + 'url': None, + 'ref': None + } + +def dirs_exist(names): + for name in names: + if not os.path.isdir(process_root(name)): + return False + return True + def XCODE_REPOSITORIES(): + names = ["llvm", "clang", "ninja"] + if dirs_exist(names): + return [fallback_repo(n) for n in names] override = repo.get_override() if override: return [process_repo(r) for r in override] @@ -233,6 +250,8 @@ def should_build_llvm(): def do_symlink(source_path, link_path): print "Symlinking " + source_path + " to " + link_path + if os.path.islink(link_path): + os.remove(link_path) if not os.path.exists(link_path): os.symlink(source_path, link_path) @@ -433,8 +452,8 @@ def build_llvm_if_needed(): #### MAIN LOGIC #### -all_check_out_if_needed() -build_llvm_if_needed() -write_archives_txt() - -sys.exit(0) +if __name__ == "__main__": + all_check_out_if_needed() + build_llvm_if_needed() + write_archives_txt() + sys.exit(0) diff --git a/lldb/scripts/Xcode/lldbbuild.py b/lldb/scripts/Xcode/lldbbuild.py index 8496cfabf3d..e70fe1bf803 100644 --- a/lldb/scripts/Xcode/lldbbuild.py +++ b/lldb/scripts/Xcode/lldbbuild.py @@ -1,5 +1,6 @@ import os import subprocess +import sys #### UTILITIES #### @@ -14,7 +15,11 @@ def enum(*sequential, **named): def lldb_source_path(): - return os.environ.get('SRCROOT') + path = os.environ.get('SRCROOT') + if path: + return path + else: + return "./" def expected_llvm_build_path(): @@ -80,7 +85,7 @@ VCS = enum('git', def run_in_directory(args, path): - return subprocess.check_output(args, cwd=path) + return subprocess.check_output([str(arg) for arg in args], cwd=path) class Git: |