| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import copy | 5 import copy |
| 6 | 6 |
| 7 from recipe_engine import recipe_api | 7 from recipe_engine import recipe_api |
| 8 | 8 |
| 9 | 9 |
| 10 class iOSApi(recipe_api.RecipeApi): | 10 class iOSApi(recipe_api.RecipeApi): |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 self.package_repo_resource( | 206 self.package_repo_resource( |
| 207 'scripts', 'slave', 'ios', 'find_xcode.py'), | 207 'scripts', 'slave', 'ios', 'find_xcode.py'), |
| 208 '--json-file', self.m.json.output(), | 208 '--json-file', self.m.json.output(), |
| 209 '--version', self.__config['xcode version'], | 209 '--version', self.__config['xcode version'], |
| 210 ], step_test_data=lambda: self.m.json.test_api.output({})) | 210 ], step_test_data=lambda: self.m.json.test_api.output({})) |
| 211 | 211 |
| 212 cfg = self.m.chromium.make_config() | 212 cfg = self.m.chromium.make_config() |
| 213 | 213 |
| 214 if self.using_gyp: | 214 if self.using_gyp: |
| 215 cfg.gyp_env.GYP_CROSSCOMPILE = 1 | 215 cfg.gyp_env.GYP_CROSSCOMPILE = 1 |
| 216 cfg.gyp_env.GYP_DEFINES = copy.deepcopy(self.__config['GYP_DEFINES']) | 216 if isinstance(self.__config['GYP_DEFINES'], dict): |
| 217 cfg.gyp_env.GYP_DEFINES = copy.deepcopy(self.__config['GYP_DEFINES']) |
| 218 else: |
| 219 cfg.gyp_env.GYP_DEFINES = dict(v.split('=') for |
| 220 v in self.__config['GYP_DEFINES']) |
| 217 self.m.chromium.c = cfg | 221 self.m.chromium.c = cfg |
| 218 | 222 |
| 223 use_goma = (self.compiler == 'ninja' and |
| 224 (cfg.gyp_env.GYP_DEFINES.get('use_goma') == '1' or |
| 225 'use_goma=true' in self.__config['gn_args'])) |
| 226 if use_goma: |
| 227 # Make sure these chromium configs are applied consistently for the |
| 228 # rest of the recipe; they are needed in order for m.chromium.compile() |
| 229 # to work correctly. |
| 230 self.m.chromium.apply_config('ninja') |
| 231 self.m.chromium.apply_config('default_compiler') |
| 232 self.m.chromium.apply_config('goma') |
| 233 |
| 234 # apply_config('goma') sets the old (wrong) directory for goma in |
| 235 # chromium.c.compile_py.goma_dir, but calling ensure_goma() after |
| 236 # that fixes things, and makes sure that goma is actually |
| 237 # available as well. |
| 238 self.m.chromium.ensure_goma() |
| 239 |
| 219 def build(self, mb_config_path=None, suffix=None): | 240 def build(self, mb_config_path=None, suffix=None): |
| 220 """Builds from this bot's build config.""" | 241 """Builds from this bot's build config.""" |
| 221 assert self.__config is not None | 242 assert self.__config is not None |
| 222 | 243 |
| 223 suffix = ' (%s)' % suffix if suffix else '' | 244 suffix = ' (%s)' % suffix if suffix else '' |
| 224 | 245 |
| 225 if self.using_mb: | 246 if self.using_mb: |
| 226 self.m.chromium.c.project_generator.tool = 'mb' | 247 self.m.chromium.c.project_generator.tool = 'mb' |
| 227 | 248 |
| 228 # Add the default GYP_DEFINES. | 249 # Add the default GYP_DEFINES. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 test['skip'] = True | 340 test['skip'] = True |
| 320 | 341 |
| 321 if compile_targets: # pragma: no cover | 342 if compile_targets: # pragma: no cover |
| 322 cmd.extend(compile_targets) | 343 cmd.extend(compile_targets) |
| 323 else: | 344 else: |
| 324 return | 345 return |
| 325 | 346 |
| 326 use_goma = (self.compiler == 'ninja' and | 347 use_goma = (self.compiler == 'ninja' and |
| 327 ('use_goma=1' in gyp_defines or 'use_goma=true' in gn_args)) | 348 ('use_goma=1' in gyp_defines or 'use_goma=true' in gn_args)) |
| 328 if use_goma: | 349 if use_goma: |
| 329 if 'without patch' not in suffix: | |
| 330 # TODO(crbug.com/603641): | |
| 331 # Configs aren't deapplied, so we only want to apply these | |
| 332 # configs once. Really, we should refactor this so that we're | |
| 333 # not applying configs at all in build(), but rather do it | |
| 334 # in an earlier step. | |
| 335 self.m.chromium.apply_config('ninja') | |
| 336 self.m.chromium.apply_config('default_compiler') | |
| 337 self.m.chromium.apply_config('goma') | |
| 338 self.m.chromium.compile(targets=compile_targets, | 350 self.m.chromium.compile(targets=compile_targets, |
| 339 target=build_sub_path, | 351 target=build_sub_path, |
| 340 cwd=cwd) | 352 cwd=cwd) |
| 341 else: | 353 else: |
| 342 self.m.step('compile' + suffix, cmd, cwd=cwd) | 354 self.m.step('compile' + suffix, cmd, cwd=cwd) |
| 343 | 355 |
| 344 def test(self, *args): | 356 def test(self, *args): |
| 345 """Runs tests as instructed by this bot's build config. | 357 """Runs tests as instructed by this bot's build config. |
| 346 | 358 |
| 347 Args: | 359 Args: |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 self.configuration, | 498 self.configuration, |
| 487 'iossim', | 499 'iossim', |
| 488 ), | 500 ), |
| 489 'ninja': self.m.path.join( | 501 'ninja': self.m.path.join( |
| 490 'src', | 502 'src', |
| 491 build_dir, | 503 build_dir, |
| 492 '%s-%s' % (self.configuration, platform), | 504 '%s-%s' % (self.configuration, platform), |
| 493 'iossim', | 505 'iossim', |
| 494 ), | 506 ), |
| 495 }[self.compiler] | 507 }[self.compiler] |
| OLD | NEW |