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

Side by Side Diff: build/landmine_utils.py

Issue 2071463002: Simplify landmines code a bit now that all branches of all platforms are on ninja (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for reland Created 4 years, 4 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/get_landmines.py ('k') | build/landmines.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 import functools 6 import functools
7 import logging 7 import logging
8 import os 8 import os
9 import shlex 9 import shlex
10 import sys 10 import sys
(...skipping 29 matching lines...) Expand all
40 def IsMac(): 40 def IsMac():
41 return sys.platform == 'darwin' 41 return sys.platform == 'darwin'
42 42
43 43
44 @memoize() 44 @memoize()
45 def gyp_defines(): 45 def gyp_defines():
46 """Parses and returns GYP_DEFINES env var as a dictionary.""" 46 """Parses and returns GYP_DEFINES env var as a dictionary."""
47 return dict(arg.split('=', 1) 47 return dict(arg.split('=', 1)
48 for arg in shlex.split(os.environ.get('GYP_DEFINES', ''))) 48 for arg in shlex.split(os.environ.get('GYP_DEFINES', '')))
49 49
50
50 @memoize() 51 @memoize()
51 def gyp_generator_flags(): 52 def gyp_generator_flags():
52 """Parses and returns GYP_GENERATOR_FLAGS env var as a dictionary.""" 53 """Parses and returns GYP_GENERATOR_FLAGS env var as a dictionary."""
53 return dict(arg.split('=', 1) 54 return dict(arg.split('=', 1)
54 for arg in shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', ''))) 55 for arg in shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', '')))
55 56
57
56 @memoize() 58 @memoize()
57 def gyp_msvs_version(): 59 def gyp_msvs_version():
58 return os.environ.get('GYP_MSVS_VERSION', '') 60 return os.environ.get('GYP_MSVS_VERSION', '')
59 61
62
60 @memoize() 63 @memoize()
61 def distributor(): 64 def distributor():
62 """ 65 """
63 Returns a string which is the distributed build engine in use (if any). 66 Returns a string which is the distributed build engine in use (if any).
64 Possible values: 'goma', 'ib', '' 67 Possible values: 'goma', None
65 """ 68 """
66 if 'goma' in gyp_defines(): 69 if 'goma' in gyp_defines():
67 return 'goma' 70 return 'goma'
68 elif IsWindows():
69 if 'CHROME_HEADLESS' in os.environ:
70 return 'ib' # use (win and !goma and headless) as approximation of ib
71 71
72 72
73 @memoize() 73 @memoize()
74 def platform(): 74 def platform():
75 """ 75 """
76 Returns a string representing the platform this build is targetted for. 76 Returns a string representing the platform this build is targetted for.
77 Possible values: 'win', 'mac', 'linux', 'ios', 'android' 77 Possible values: 'win', 'mac', 'linux', 'ios', 'android'
78 """ 78 """
79 if 'OS' in gyp_defines(): 79 if 'OS' in gyp_defines():
80 if 'android' in gyp_defines()['OS']: 80 if 'android' in gyp_defines()['OS']:
81 return 'android' 81 return 'android'
82 else: 82 else:
83 return gyp_defines()['OS'] 83 return gyp_defines()['OS']
84 elif IsWindows(): 84 elif IsWindows():
85 return 'win' 85 return 'win'
86 elif IsLinux(): 86 elif IsLinux():
87 return 'linux' 87 return 'linux'
88 else: 88 else:
89 return 'mac' 89 return 'mac'
90
91
92 @memoize()
93 def builder():
94 """
95 Returns a string representing the build engine (not compiler) to use.
96 Possible values: 'make', 'ninja', 'xcode', 'msvs', 'scons'
97 """
98 if 'GYP_GENERATORS' in os.environ:
99 # for simplicity, only support the first explicit generator
100 generator = os.environ['GYP_GENERATORS'].split(',')[0]
101 if generator.endswith('-android'):
102 return generator.split('-')[0]
103 elif generator.endswith('-ninja'):
104 return 'ninja'
105 else:
106 return generator
107 else:
108 if platform() == 'android':
109 # Good enough for now? Do any android bots use make?
110 return 'ninja'
111 elif platform() == 'ios':
112 return 'xcode'
113 elif IsWindows():
114 return 'ninja'
115 elif IsLinux():
116 return 'ninja'
117 elif IsMac():
118 return 'ninja'
119 else:
120 assert False, 'Don\'t know what builder we\'re using!'
OLDNEW
« no previous file with comments | « build/get_landmines.py ('k') | build/landmines.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698