aboutsummaryrefslogtreecommitdiff
path: root/lldb/scripts/Xcode/lldbbuild.py
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/scripts/Xcode/lldbbuild.py
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadllvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/scripts/Xcode/lldbbuild.py')
-rw-r--r--lldb/scripts/Xcode/lldbbuild.py107
1 files changed, 74 insertions, 33 deletions
diff --git a/lldb/scripts/Xcode/lldbbuild.py b/lldb/scripts/Xcode/lldbbuild.py
index bb43315..9c087aa 100644
--- a/lldb/scripts/Xcode/lldbbuild.py
+++ b/lldb/scripts/Xcode/lldbbuild.py
@@ -3,7 +3,8 @@ import subprocess
#### UTILITIES ####
-def enum (*sequential, **named):
+
+def enum(*sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
return type('Enum', (), enums)
@@ -11,42 +12,53 @@ def enum (*sequential, **named):
#### INTERFACE TO THE XCODEPROJ ####
-def lldb_source_path ():
+
+def lldb_source_path():
return os.environ.get('SRCROOT')
-def expected_llvm_build_path ():
+
+def expected_llvm_build_path():
if build_type() == BuildType.Xcode:
return package_build_path()
else:
- return os.path.join(os.environ.get('LLDB_PATH_TO_LLVM_BUILD'), package_build_dir_name("llvm"))
+ return os.path.join(
+ os.environ.get('LLDB_PATH_TO_LLVM_BUILD'),
+ package_build_dir_name("llvm"))
+
-def archives_txt ():
+def archives_txt():
return os.path.join(expected_package_build_path(), "archives.txt")
-def expected_package_build_path ():
+
+def expected_package_build_path():
return os.path.abspath(os.path.join(expected_llvm_build_path(), ".."))
-def architecture ():
+
+def architecture():
platform_name = os.environ.get('RC_PLATFORM_NAME')
if not platform_name:
platform_name = os.environ.get('PLATFORM_NAME')
platform_arch = os.environ.get('ARCHS').split()[-1]
return platform_name + "-" + platform_arch
-def lldb_configuration ():
+
+def lldb_configuration():
return os.environ.get('CONFIGURATION')
-def llvm_configuration ():
+
+def llvm_configuration():
return os.environ.get('LLVM_CONFIGURATION')
-def llvm_build_dirtree ():
+
+def llvm_build_dirtree():
return os.environ.get('LLVM_BUILD_DIRTREE')
# Edit the code below when adding build styles.
BuildType = enum('Xcode') # (Debug,DebugClang,Release)
-def build_type ():
+
+def build_type():
return BuildType.Xcode
#### VCS UTILITIES ####
@@ -54,31 +66,48 @@ def build_type ():
VCS = enum('git',
'svn')
+
def run_in_directory(args, path):
return subprocess.check_output(args, cwd=path)
+
class Git:
- def __init__ (self, spec):
+
+ def __init__(self, spec):
self.spec = spec
- def status (self):
+
+ def status(self):
return run_in_directory(["git", "branch", "-v"], self.spec['root'])
- def diff (self):
+
+ def diff(self):
return run_in_directory(["git", "diff"], self.spec['root'])
- def check_out (self):
- run_in_directory(["git", "clone", "--depth=1", self.spec['url'], self.spec['root']], lldb_source_path())
+
+ def check_out(self):
+ run_in_directory(["git",
+ "clone",
+ "--depth=1",
+ self.spec['url'],
+ self.spec['root']],
+ lldb_source_path())
run_in_directory(["git", "fetch", "--all"], self.spec['root'])
- run_in_directory(["git", "checkout", self.spec['ref']], self.spec['root'])
+ run_in_directory(["git", "checkout", self.spec[
+ 'ref']], self.spec['root'])
+
class SVN:
- def __init__ (self, spec):
+
+ def __init__(self, spec):
self.spec = spec
- def status (self):
+
+ def status(self):
return run_in_directory(["svn", "info"], self.spec['root'])
- def diff (self):
+
+ def diff(self):
return run_in_directory(["svn", "diff"], self.spec['root'])
# TODO implement check_out
-def vcs (spec):
+
+def vcs(spec):
if spec['vcs'] == VCS.git:
return Git(spec)
elif spec['vcs'] == VCS.svn:
@@ -88,47 +117,59 @@ def vcs (spec):
#### SOURCE PATHS ####
-def llvm_source_path ():
+
+def llvm_source_path():
if build_type() == BuildType.Xcode:
return os.path.join(lldb_source_path(), "llvm")
-def clang_source_path ():
+
+def clang_source_path():
if build_type() == BuildType.Xcode:
return os.path.join(llvm_source_path(), "tools", "clang")
-def ninja_source_path ():
+
+def ninja_source_path():
if build_type() == BuildType.Xcode:
return os.path.join(lldb_source_path(), "ninja")
#### BUILD PATHS ####
-def packages ():
+
+def packages():
return ["llvm"]
-def package_build_dir_name (package):
+
+def package_build_dir_name(package):
return package + "-" + architecture()
-def expected_package_build_path_for (package):
+
+def expected_package_build_path_for(package):
if build_type() == BuildType.Xcode:
if package != "llvm":
- raise("On Xcode build, we only support the llvm package: requested {}".format(package))
+ raise "On Xcode build, we only support the llvm package: requested {}"
return package_build_path()
- return os.path.join(expected_package_build_path(), package_build_dir_name(package))
+ return os.path.join(
+ expected_package_build_path(),
+ package_build_dir_name(package))
-def expected_package_build_paths ():
+
+def expected_package_build_paths():
return [expected_package_build_path_for(package) for package in packages()]
-def library_path (build_path):
+
+def library_path(build_path):
return build_path + "/lib"
-def library_paths ():
+
+def library_paths():
if build_type() == BuildType.Xcode:
package_build_paths = [package_build_path()]
else:
package_build_paths = expected_package_build_paths()
return [library_path(build_path) for build_path in package_build_paths]
-def package_build_path ():
+
+def package_build_path():
return os.path.join(
llvm_build_dirtree(),
os.environ["LLVM_CONFIGURATION"],