OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 This file holds a list of reasons why a particular build needs to be clobbered | 7 This file holds a list of reasons why a particular build needs to be clobbered |
8 (or a list of 'landmines'). | 8 (or a list of 'landmines'). |
9 | 9 |
10 This script runs every build as a hook. If it detects that the build should | 10 This script runs every build as a hook. If it detects that the build should |
(...skipping 29 matching lines...) Expand all Loading... |
40 val.append(ret if ret is not None else default) | 40 val.append(ret if ret is not None else default) |
41 if logging.getLogger().isEnabledFor(logging.INFO): | 41 if logging.getLogger().isEnabledFor(logging.INFO): |
42 print '%s -> %r' % (func.__name__, val[0]) | 42 print '%s -> %r' % (func.__name__, val[0]) |
43 return val[0] | 43 return val[0] |
44 return inner | 44 return inner |
45 return memoizer | 45 return memoizer |
46 | 46 |
47 | 47 |
48 @memoize() | 48 @memoize() |
49 def IsWindows(): | 49 def IsWindows(): |
50 return sys.platform.startswith('win') or sys.platform == 'cygwin' | 50 return sys.platform in ['win32', 'cygwin'] |
51 | 51 |
52 | 52 |
53 @memoize() | 53 @memoize() |
54 def IsLinux(): | 54 def IsLinux(): |
55 return sys.platform.startswith('linux') | 55 return sys.platform.startswith('linux') |
56 | 56 |
57 | 57 |
58 @memoize() | 58 @memoize() |
59 def IsMac(): | 59 def IsMac(): |
60 return sys.platform.startswith('darwin') | 60 return sys.platform == 'darwin' |
61 | 61 |
62 | 62 |
63 @memoize() | 63 @memoize() |
64 def gyp_defines(): | 64 def gyp_defines(): |
65 """Parses and returns GYP_DEFINES env var as a dictionary.""" | 65 """Parses and returns GYP_DEFINES env var as a dictionary.""" |
66 return dict(arg.split('=', 1) | 66 return dict(arg.split('=', 1) |
67 for arg in shlex.split(os.environ.get('GYP_DEFINES', ''))) | 67 for arg in shlex.split(os.environ.get('GYP_DEFINES', ''))) |
68 | 68 |
69 | 69 |
70 @memoize() | 70 @memoize() |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return generator | 116 return generator |
117 else: | 117 else: |
118 if platform() == 'android': | 118 if platform() == 'android': |
119 # Good enough for now? Do any android bots use make? | 119 # Good enough for now? Do any android bots use make? |
120 return 'ninja' | 120 return 'ninja' |
121 elif platform() == 'ios': | 121 elif platform() == 'ios': |
122 return 'xcode' | 122 return 'xcode' |
123 elif IsWindows(): | 123 elif IsWindows(): |
124 return 'msvs' | 124 return 'msvs' |
125 elif IsLinux(): | 125 elif IsLinux(): |
126 return 'make' | 126 return 'ninja' |
127 elif IsMac(): | 127 elif IsMac(): |
128 return 'xcode' | 128 return 'xcode' |
129 else: | 129 else: |
130 assert False, 'Don\'t know what builder we\'re using!' | 130 assert False, 'Don\'t know what builder we\'re using!' |
131 | 131 |
132 | 132 |
133 def get_landmines(target): | 133 def get_landmines(target): |
134 """ | 134 """ |
135 ALL LANDMINES ARE DEFINED HERE. | 135 ALL LANDMINES ARE DEFINED HERE. |
136 target is 'Release' or 'Debug' | 136 target is 'Release' or 'Debug' |
(...skipping 23 matching lines...) Expand all Loading... |
160 r'c:\b\build\slave\win\build\src\out\Release' | 160 r'c:\b\build\slave\win\build\src\out\Release' |
161 '/mnt/data/b/build/slave/linux/build/src/out/Debug' | 161 '/mnt/data/b/build/slave/linux/build/src/out/Debug' |
162 '/b/build/slave/ios_rel_device/build/src/xcodebuild/Release-iphoneos' | 162 '/b/build/slave/ios_rel_device/build/src/xcodebuild/Release-iphoneos' |
163 | 163 |
164 Keep this function in sync with tools/build/scripts/slave/compile.py | 164 Keep this function in sync with tools/build/scripts/slave/compile.py |
165 """ | 165 """ |
166 ret = None | 166 ret = None |
167 if build_tool == 'xcode': | 167 if build_tool == 'xcode': |
168 ret = os.path.join(SRC_DIR, 'xcodebuild', | 168 ret = os.path.join(SRC_DIR, 'xcodebuild', |
169 target + ('-iphoneos' if is_iphone else '')) | 169 target + ('-iphoneos' if is_iphone else '')) |
170 elif build_tool == 'make': | 170 elif build_tool in ['make', 'ninja', 'ninja-ios']: # TODO: Remove ninja-ios. |
171 ret = os.path.join(SRC_DIR, 'out', target) | |
172 elif build_tool in ['ninja', 'ninja-ios']: | |
173 ret = os.path.join(SRC_DIR, 'out', target) | 171 ret = os.path.join(SRC_DIR, 'out', target) |
174 elif build_tool in ['msvs', 'vs', 'ib']: | 172 elif build_tool in ['msvs', 'vs', 'ib']: |
175 ret = os.path.join(SRC_DIR, 'build', target) | 173 ret = os.path.join(SRC_DIR, 'build', target) |
176 elif build_tool == 'scons': | 174 elif build_tool == 'scons': |
177 ret = os.path.join(SRC_DIR, 'sconsbuild', target) | 175 ret = os.path.join(SRC_DIR, 'sconsbuild', target) |
178 else: | 176 else: |
179 raise NotImplementedError('Unexpected GYP_GENERATORS (%s)' % build_tool) | 177 raise NotImplementedError('Unexpected GYP_GENERATORS (%s)' % build_tool) |
180 return os.path.abspath(ret) | 178 return os.path.abspath(ret) |
181 | 179 |
182 | 180 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 gyp_helper.apply_chromium_gyp_env() | 226 gyp_helper.apply_chromium_gyp_env() |
229 | 227 |
230 for target in ('Debug', 'Release', 'Debug_x64', 'Release_x64'): | 228 for target in ('Debug', 'Release', 'Debug_x64', 'Release_x64'): |
231 set_up_landmines(target) | 229 set_up_landmines(target) |
232 | 230 |
233 return 0 | 231 return 0 |
234 | 232 |
235 | 233 |
236 if __name__ == '__main__': | 234 if __name__ == '__main__': |
237 sys.exit(main()) | 235 sys.exit(main()) |
OLD | NEW |