Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: tools/buildtools/update.py

Issue 3010023002: Reland: [infra] Roll clang toolchain forward (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/toolchain/mac/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2017 The Dart project authors. All rights reserved. 2 # Copyright 2017 The Dart project authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Pulls down tools required to build Dart.""" 6 """Pulls down tools required to build Dart."""
7 7
8 import os 8 import os
9 import subprocess 9 import subprocess
10 import shutil 10 import shutil
11 import sys 11 import sys
12 12
13 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) 13 THIS_DIR = os.path.abspath(os.path.dirname(__file__))
14 DART_ROOT = os.path.abspath(os.path.join(THIS_DIR, '..', '..')) 14 DART_ROOT = os.path.abspath(os.path.join(THIS_DIR, '..', '..'))
15 BUILDTOOLS = os.path.join(DART_ROOT, 'buildtools') 15 BUILDTOOLS = os.path.join(DART_ROOT, 'buildtools')
16 TOOLS_BUILDTOOLS = os.path.join(DART_ROOT, 'tools', 'buildtools') 16 TOOLS_BUILDTOOLS = os.path.join(DART_ROOT, 'tools', 'buildtools')
17 TOOLCHAIN = os.path.join(BUILDTOOLS, 'toolchain')
18 17
19 sys.path.insert(0, os.path.join(DART_ROOT, 'tools')) 18 sys.path.insert(0, os.path.join(DART_ROOT, 'tools'))
20 import find_depot_tools 19 import find_depot_tools
21 20
22 DEPOT_PATH = find_depot_tools.add_depot_tools_to_path() 21 DEPOT_PATH = find_depot_tools.add_depot_tools_to_path()
23 22
24 23
25 def Update(): 24 def Update():
26 path = os.path.join(BUILDTOOLS, 'update.sh') 25 path = os.path.join(BUILDTOOLS, 'update.sh')
27 command = ['/bin/bash', path, '--toolchain', '--gn'] 26 command = ['/bin/bash', path, '--clang', '--gn']
28 return subprocess.call(command, cwd=DART_ROOT) 27 return subprocess.call(command, cwd=DART_ROOT)
29 28
30 29
31 def UpdateGNOnWindows(): 30 def UpdateGNOnWindows():
32 sha1_file = os.path.join(BUILDTOOLS, 'win', 'gn.exe.sha1') 31 sha1_file = os.path.join(BUILDTOOLS, 'win', 'gn.exe.sha1')
33 downloader_script = os.path.join( 32 downloader_script = os.path.join(
34 DEPOT_PATH, 'download_from_google_storage.py') 33 DEPOT_PATH, 'download_from_google_storage.py')
35 download_cmd = [ 34 download_cmd = [
36 'python', 35 'python',
37 downloader_script, 36 downloader_script,
(...skipping 29 matching lines...) Expand all
67 output_dir 66 output_dir
68 ] 67 ]
69 return subprocess.call(download_cmd) 68 return subprocess.call(download_cmd)
70 69
71 70
72 # On Mac and Linux we copy clang-format to the place where git cl format 71 # On Mac and Linux we copy clang-format to the place where git cl format
73 # expects it to be. 72 # expects it to be.
74 def CopyClangFormat(): 73 def CopyClangFormat():
75 if sys.platform == 'darwin': 74 if sys.platform == 'darwin':
76 platform = 'darwin' 75 platform = 'darwin'
77 subdir = 'mac' 76 tools = 'mac'
77 toolchain = 'mac-x64'
78 elif sys.platform.startswith('linux'): 78 elif sys.platform.startswith('linux'):
79 platform = 'linux' 79 platform = 'linux'
80 subdir = 'linux64' 80 tools = 'linux64'
81 toolchain = 'linux-x64'
81 else: 82 else:
82 print 'Unknown platform: ' + sys.platform 83 print 'Unknown platform: ' + sys.platform
83 return 1 84 return 1
84 85
85 clang_format = os.path.join( 86 clang_format = os.path.join(
86 TOOLCHAIN, 'clang+llvm-x86_64-' + platform, 'bin', 'clang-format') 87 BUILDTOOLS, toolchain, 'clang', 'bin', 'clang-format')
87 dest = os.path.join(BUILDTOOLS, subdir, 'clang-format') 88 dest = os.path.join(BUILDTOOLS, tools, 'clang-format')
88 shutil.copy2(clang_format, dest) 89 shutil.copy2(clang_format, dest)
89 return 0 90 return 0
90 91
91 92
92 def main(argv): 93 def main(argv):
93 if sys.platform.startswith('win'): 94 if sys.platform.startswith('win'):
94 result = UpdateGNOnWindows() 95 result = UpdateGNOnWindows()
95 if result != 0: 96 if result != 0:
96 return result 97 return result
97 return UpdateClangFormatOnWindows() 98 return UpdateClangFormatOnWindows()
98 if Update() != 0: 99 if Update() != 0:
99 return 1 100 return 1
100 return CopyClangFormat() 101 return CopyClangFormat()
101 102
102 103
103 if __name__ == '__main__': 104 if __name__ == '__main__':
104 sys.exit(main(sys.argv)) 105 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/toolchain/mac/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698