| Index: tools/buildtools/update.py
|
| diff --git a/tools/buildtools/update.py b/tools/buildtools/update.py
|
| index 6d676293aa43f3d1b1112c82f05cc6caa84c9e41..2f9b4b8a8b1aa591d02bbd503c3cc53e773bf902 100755
|
| --- a/tools/buildtools/update.py
|
| +++ b/tools/buildtools/update.py
|
| @@ -14,6 +14,7 @@ THIS_DIR = os.path.abspath(os.path.dirname(__file__))
|
| DART_ROOT = os.path.abspath(os.path.join(THIS_DIR, '..', '..'))
|
| BUILDTOOLS = os.path.join(DART_ROOT, 'buildtools')
|
| TOOLS_BUILDTOOLS = os.path.join(DART_ROOT, 'tools', 'buildtools')
|
| +TOOLCHAIN = os.path.join(BUILDTOOLS, 'toolchain')
|
|
|
| sys.path.insert(0, os.path.join(DART_ROOT, 'tools'))
|
| import find_depot_tools
|
| @@ -23,12 +24,14 @@ DEPOT_PATH = find_depot_tools.add_depot_tools_to_path()
|
|
|
| def Update():
|
| path = os.path.join(BUILDTOOLS, 'update.sh')
|
| - return subprocess.call(['/bin/bash', path, '--toolchain', '--gn'], cwd=DART_ROOT)
|
| + command = ['/bin/bash', path, '--toolchain', '--gn']
|
| + return subprocess.call(command, cwd=DART_ROOT)
|
|
|
|
|
| def UpdateGNOnWindows():
|
| sha1_file = os.path.join(BUILDTOOLS, 'win', 'gn.exe.sha1')
|
| - downloader_script = os.path.join(DEPOT_PATH, 'download_from_google_storage.py')
|
| + downloader_script = os.path.join(
|
| + DEPOT_PATH, 'download_from_google_storage.py')
|
| download_cmd = [
|
| 'python',
|
| downloader_script,
|
| @@ -47,7 +50,8 @@ def UpdateGNOnWindows():
|
| def UpdateClangFormatOnWindows():
|
| sha1_file = os.path.join(TOOLS_BUILDTOOLS, 'win', 'clang-format.exe.sha1')
|
| output_dir = os.path.join(BUILDTOOLS, 'win', 'clang-format.exe')
|
| - downloader_script = os.path.join(DEPOT_PATH, 'download_from_google_storage.py')
|
| + downloader_script = os.path.join(
|
| + DEPOT_PATH, 'download_from_google_storage.py')
|
| download_cmd = [
|
| 'python',
|
| downloader_script,
|
| @@ -65,13 +69,24 @@ def UpdateClangFormatOnWindows():
|
| return subprocess.call(download_cmd)
|
|
|
|
|
| -def CopyClangFormatScripts():
|
| - linux_script = os.path.join(TOOLS_BUILDTOOLS, 'linux64', 'clang-format')
|
| - mac_script = os.path.join(TOOLS_BUILDTOOLS, 'mac', 'clang-format')
|
| - linux_dest = os.path.join(BUILDTOOLS, 'linux64', 'clang-format')
|
| - mac_dest = os.path.join(BUILDTOOLS, 'mac', 'clang-format')
|
| - shutil.copy2(linux_script, linux_dest)
|
| - shutil.copy2(mac_script, mac_dest)
|
| +# On Mac and Linux we copy clang-format to the place where git cl format
|
| +# expects it to be.
|
| +def CopyClangFormat():
|
| + if sys.platform == 'darwin':
|
| + platform = 'darwin'
|
| + subdir = 'mac'
|
| + elif sys.platform.startswith('linux'):
|
| + platform = 'linux'
|
| + subdir = 'linux64'
|
| + else:
|
| + print 'Unknown platform: ' + sys.platform
|
| + return 1
|
| +
|
| + clang_format = os.path.join(
|
| + TOOLCHAIN, 'clang+llvm-x86_64-' + platform, 'bin', 'clang-format')
|
| + dest = os.path.join(BUILDTOOLS, subdir, 'clang-format')
|
| + shutil.copy2(clang_format, dest)
|
| + return 0
|
|
|
|
|
| def main(argv):
|
| @@ -80,8 +95,9 @@ def main(argv):
|
| if result != 0:
|
| return result
|
| return UpdateClangFormatOnWindows()
|
| - CopyClangFormatScripts()
|
| - return Update()
|
| + if Update() != 0:
|
| + return 1
|
| + return CopyClangFormat()
|
|
|
|
|
| if __name__ == '__main__':
|
|
|