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

Side by Side Diff: build/mac_toolchain.py

Issue 2950933003: mac: Roll hermetic toolchain to Xcode 8.3.2. (Closed)
Patch Set: Add comment. Created 3 years, 6 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/mac/should_use_hermetic_xcode.py ('k') | build_overrides/build.gni » ('j') | 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 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium 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 """ 6 """
7 If should_use_hermetic_xcode.py emits "1", and the current toolchain is out of 7 If should_use_hermetic_xcode.py emits "1", and the current toolchain is out of
8 date: 8 date:
9 * Downloads the hermetic mac toolchain 9 * Downloads the hermetic mac toolchain
10 * Requires gsutil to be configured. 10 * Requires gsutil to be configured.
11 * Accepts the license. 11 * Accepts the license.
12 * If xcode-select and xcodebuild are not passwordless in sudoers, requires 12 * If xcode-select and xcodebuild are not passwordless in sudoers, requires
13 user interaction. 13 user interaction.
14 """ 14 """
15 15
16 import os 16 import os
17 import platform
17 import plistlib 18 import plistlib
18 import shutil 19 import shutil
19 import subprocess 20 import subprocess
20 import sys 21 import sys
21 import tarfile 22 import tarfile
22 import time 23 import time
23 import tempfile 24 import tempfile
24 import urllib2 25 import urllib2
25 26
26 # This can be changed after running /build/package_mac_toolchain.py. 27 # This can be changed after running /build/package_mac_toolchain.py.
27 MAC_TOOLCHAIN_VERSION = '5B1008' 28 MAC_TOOLCHAIN_VERSION = '8E2002'
28 MAC_TOOLCHAIN_SUB_REVISION = 3 29 MAC_TOOLCHAIN_SUB_REVISION = 3
29 MAC_TOOLCHAIN_VERSION = '%s-%s' % (MAC_TOOLCHAIN_VERSION, 30 MAC_TOOLCHAIN_VERSION = '%s-%s' % (MAC_TOOLCHAIN_VERSION,
30 MAC_TOOLCHAIN_SUB_REVISION) 31 MAC_TOOLCHAIN_SUB_REVISION)
32 # The toolchain will not be downloaded if the minimum OS version is not met.
33 # 16 is the major version number for macOS 10.12.
34 MAC_MINIMUM_OS_VERSION = 16
35
31 IOS_TOOLCHAIN_VERSION = '8C1002' 36 IOS_TOOLCHAIN_VERSION = '8C1002'
32 IOS_TOOLCHAIN_SUB_REVISION = 1 37 IOS_TOOLCHAIN_SUB_REVISION = 1
33 IOS_TOOLCHAIN_VERSION = '%s-%s' % (IOS_TOOLCHAIN_VERSION, 38 IOS_TOOLCHAIN_VERSION = '%s-%s' % (IOS_TOOLCHAIN_VERSION,
34 IOS_TOOLCHAIN_SUB_REVISION) 39 IOS_TOOLCHAIN_SUB_REVISION)
35 40
36 # Absolute path to src/ directory. 41 # Absolute path to src/ directory.
37 REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 42 REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
38 43
39 # Absolute path to a file with gclient solutions. 44 # Absolute path to a file with gclient solutions.
40 GCLIENT_CONFIG = os.path.join(os.path.dirname(REPO_ROOT), '.gclient') 45 GCLIENT_CONFIG = os.path.join(os.path.dirname(REPO_ROOT), '.gclient')
41 46
42 BASE_DIR = os.path.abspath(os.path.dirname(__file__)) 47 BASE_DIR = os.path.abspath(os.path.dirname(__file__))
43 TOOLCHAIN_BUILD_DIR = os.path.join(BASE_DIR, '%s_files', 'Xcode.app') 48 TOOLCHAIN_BUILD_DIR = os.path.join(BASE_DIR, '%s_files', 'Xcode.app')
44 STAMP_FILE = os.path.join(BASE_DIR, '%s_files', 'toolchain_build_revision') 49 STAMP_FILE = os.path.join(BASE_DIR, '%s_files', 'toolchain_build_revision')
45 TOOLCHAIN_URL = 'gs://chrome-mac-sdk/' 50 TOOLCHAIN_URL = 'gs://chrome-mac-sdk/'
46 51
52
53 def PlatformMeetsHermeticXcodeRequirements(target_os):
54 if target_os == 'ios':
55 return True
56 return int(platform.release().split('.')[0]) >= MAC_MINIMUM_OS_VERSION
57
58
47 def GetPlatforms(): 59 def GetPlatforms():
48 default_target_os = ["mac"] 60 default_target_os = ["mac"]
49 try: 61 try:
50 env = {} 62 env = {}
51 execfile(GCLIENT_CONFIG, env, env) 63 execfile(GCLIENT_CONFIG, env, env)
52 return env.get('target_os', default_target_os) 64 return env.get('target_os', default_target_os)
53 except: 65 except:
54 pass 66 pass
55 return default_target_os 67 return default_target_os
56 68
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 print 'Exception %s' % e 237 print 'Exception %s' % e
226 print 'Exiting.' 238 print 'Exiting.'
227 return 1 239 return 1
228 240
229 241
230 def main(): 242 def main():
231 if sys.platform != 'darwin': 243 if sys.platform != 'darwin':
232 return 0 244 return 0
233 245
234 for target_os in GetPlatforms(): 246 for target_os in GetPlatforms():
247 if not PlatformMeetsHermeticXcodeRequirements(target_os):
248 print 'OS version does not support toolchain.'
249 continue
250
235 if target_os == 'ios': 251 if target_os == 'ios':
236 default_version = IOS_TOOLCHAIN_VERSION 252 default_version = IOS_TOOLCHAIN_VERSION
237 toolchain_filename = 'ios-toolchain-%s.tgz' 253 toolchain_filename = 'ios-toolchain-%s.tgz'
238 else: 254 else:
239 default_version = MAC_TOOLCHAIN_VERSION 255 default_version = MAC_TOOLCHAIN_VERSION
240 toolchain_filename = 'toolchain-%s.tgz' 256 toolchain_filename = 'toolchain-%s.tgz'
241 257
242 return_value = DownloadHermeticBuild( 258 return_value = DownloadHermeticBuild(
243 target_os, default_version, toolchain_filename) 259 target_os, default_version, toolchain_filename)
244 if return_value: 260 if return_value:
245 return return_value 261 return return_value
246 262
247 return 0 263 return 0
248 264
249 265
250 if __name__ == '__main__': 266 if __name__ == '__main__':
251 sys.exit(main()) 267 sys.exit(main())
OLDNEW
« no previous file with comments | « build/mac/should_use_hermetic_xcode.py ('k') | build_overrides/build.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698