Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 from recipe_engine import recipe_api | 5 from recipe_engine import recipe_api |
| 6 from . import builders | |
| 7 | |
| 6 | 8 |
| 7 class LibyuvApi(recipe_api.RecipeApi): | 9 class LibyuvApi(recipe_api.RecipeApi): |
| 10 BUILDERS = builders.BUILDERS | |
| 11 RECIPE_CONFIGS = builders.RECIPE_CONFIGS | |
| 12 | |
| 8 def __init__(self, **kwargs): | 13 def __init__(self, **kwargs): |
| 9 super(LibyuvApi, self).__init__(**kwargs) | 14 super(LibyuvApi, self).__init__(**kwargs) |
| 15 | |
| 16 | |
| 17 def apply_bot_config(self, builders, recipe_configs, perf_config=None): | |
| 18 mastername = self.m.properties.get('mastername') | |
|
kjellander_chromium
2016/09/01 11:52:20
This is mostly a slimmed down version copied from
| |
| 19 buildername = self.m.properties.get('buildername') | |
| 20 master_dict = builders.get(mastername, {}) | |
| 21 | |
| 22 self.bot_config = master_dict.get('builders', {}).get(buildername) | |
| 23 assert self.bot_config, ('Unrecognized builder name "%r" for master "%r".' % | |
| 24 (buildername, mastername)) | |
| 25 | |
| 26 self.bot_type = self.bot_config['bot_type'] | |
| 27 recipe_config_name = self.bot_config['recipe_config'] | |
| 28 self.recipe_config = recipe_configs.get(recipe_config_name) | |
| 29 assert self.recipe_config, ( | |
| 30 'Cannot find recipe_config "%s" for builder "%r".' % | |
| 31 (recipe_config_name, buildername)) | |
| 32 | |
| 33 chromium_kwargs = self.bot_config.get('chromium_config_kwargs', {}) | |
| 34 | |
| 35 self.m.chromium.set_config(self.recipe_config['chromium_config'], | |
| 36 **chromium_kwargs) | |
| 37 self.m.gclient.set_config(self.recipe_config['gclient_config']) | |
| 38 | |
| 39 # Support applying configs both at the bot and the recipe config level. | |
| 40 for c in self.bot_config.get('chromium_apply_config', []): | |
| 41 self.m.chromium.apply_config(c) | |
| 42 for c in self.bot_config.get('gclient_apply_config', []): | |
| 43 self.m.gclient.apply_config(c) | |
| 44 | |
| 45 if self.m.tryserver.is_tryserver: | |
| 46 self.m.chromium.apply_config('trybot_flavor') | |
| 47 | |
| 48 @property | |
| 49 def should_build(self): | |
| 50 return self.bot_type in ('builder', 'builder_tester') | |
| 51 | |
| 52 @property | |
| 53 def should_test(self): | |
| 54 return self.bot_type in ('tester', 'builder_tester') | |
| OLD | NEW |