| OLD | NEW |
| 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 import re | 5 import re |
| 6 | 6 |
| 7 from slave import recipe_api | 7 from slave import recipe_api |
| 8 from slave import recipe_util | 8 from slave import recipe_util |
| 9 | 9 |
| 10 from . import builders | 10 from . import builders |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 "MAJOR=37\nMINOR=0\nBUILD=2021\nPATCH=0\n"))).stdout | 106 "MAJOR=37\nMINOR=0\nBUILD=2021\nPATCH=0\n"))).stdout |
| 107 return self.version | 107 return self.version |
| 108 | 108 |
| 109 def set_build_properties(self, props): | 109 def set_build_properties(self, props): |
| 110 self._build_properties = props | 110 self._build_properties = props |
| 111 | 111 |
| 112 def add_builders(self, builders): | 112 def add_builders(self, builders): |
| 113 """Adds builders to our builder map""" | 113 """Adds builders to our builder map""" |
| 114 self._builders.update(builders) | 114 self._builders.update(builders) |
| 115 | 115 |
| 116 def configure_bot(self, builders_dict, additional_configs=None): |
| 117 """Sets up the configurations and gclient to be ready for bot update. |
| 118 |
| 119 Returns a tuple of (buildername, bot_config) for subsequent use in |
| 120 the recipe. |
| 121 """ |
| 122 additional_configs = additional_configs or [] |
| 123 |
| 124 # TODO: crbug.com/358481 . The build_config should probably be a property |
| 125 # passed in from slaves.cfg, but that doesn't exist today, so we need a |
| 126 # lookup mechanism to map bot name to build_config. |
| 127 mastername = self.m.properties.get('mastername') |
| 128 buildername = self.m.properties.get('buildername') |
| 129 master_dict = builders_dict.get(mastername, {}) |
| 130 bot_config = master_dict.get('builders', {}).get(buildername) |
| 131 |
| 132 self.set_config('chromium', **bot_config.get('chromium_config_kwargs', {})) |
| 133 |
| 134 for c in bot_config.get('chromium_apply_config', []): |
| 135 self.apply_config(c) |
| 136 |
| 137 for c in additional_configs: |
| 138 self.apply_config(c) |
| 139 |
| 140 # Note that we have to call gclient.set_config() and apply_config() *after* |
| 141 # calling chromium.set_config(), above, because otherwise the chromium |
| 142 # call would reset the gclient config to its defaults. |
| 143 self.m.gclient.set_config('chromium') |
| 144 for c in bot_config.get('gclient_apply_config', []): |
| 145 self.m.gclient.apply_config(c) |
| 146 |
| 147 if bot_config.get('set_component_rev'): |
| 148 # If this is a component build and the main revision is e.g. blink, |
| 149 # webrtc, or v8, the custom deps revision of this component must be |
| 150 # dynamically set to either: |
| 151 # (1) 'revision' from the waterfall, or |
| 152 # (2) 'HEAD' for forced builds with unspecified 'revision'. |
| 153 component_rev = self.m.properties.get('revision') or 'HEAD' |
| 154 dep = bot_config.get('set_component_rev') |
| 155 self.m.gclient.c.revisions[dep['name']] = dep['rev_str'] % component_rev |
| 156 |
| 157 if self.m.tryserver.is_tryserver: |
| 158 self.m.step.auto_resolve_conflicts = True |
| 159 |
| 160 return (buildername, bot_config) |
| 161 |
| 116 def compile(self, targets=None, name=None, | 162 def compile(self, targets=None, name=None, |
| 117 force_clobber=False, **kwargs): | 163 force_clobber=False, **kwargs): |
| 118 """Return a compile.py invocation.""" | 164 """Return a compile.py invocation.""" |
| 119 targets = targets or self.c.compile_py.default_targets.as_jsonish() | 165 targets = targets or self.c.compile_py.default_targets.as_jsonish() |
| 120 assert isinstance(targets, (list, tuple)) | 166 assert isinstance(targets, (list, tuple)) |
| 121 | 167 |
| 122 args = [ | 168 args = [ |
| 123 '--target', self.c.build_config_fs, | 169 '--target', self.c.build_config_fs, |
| 124 '--src-dir', self.m.path['checkout'], | 170 '--src-dir', self.m.path['checkout'], |
| 125 ] | 171 ] |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 def get_compile_targets_for_scripts(self): | 721 def get_compile_targets_for_scripts(self): |
| 676 return self.m.python( | 722 return self.m.python( |
| 677 name='get compile targets for scripts', | 723 name='get compile targets for scripts', |
| 678 script=self.m.path['checkout'].join( | 724 script=self.m.path['checkout'].join( |
| 679 'testing', 'scripts', 'get_compile_targets.py'), | 725 'testing', 'scripts', 'get_compile_targets.py'), |
| 680 args=[ | 726 args=[ |
| 681 '--output', self.m.json.output(), | 727 '--output', self.m.json.output(), |
| 682 '--', | 728 '--', |
| 683 ] + self.get_common_args_for_scripts(), | 729 ] + self.get_common_args_for_scripts(), |
| 684 step_test_data=lambda: self.m.json.test_api.output({})) | 730 step_test_data=lambda: self.m.json.test_api.output({})) |
| OLD | NEW |