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 from slave import recipe_api | 5 from slave import recipe_api |
6 | 6 |
7 class ChromiumApi(recipe_api.RecipeApi): | 7 class ChromiumApi(recipe_api.RecipeApi): |
8 def get_config_defaults(self): | 8 def get_config_defaults(self): |
9 return { | 9 return { |
10 'HOST_PLATFORM': self.m.platform.name, | 10 'HOST_PLATFORM': self.m.platform.name, |
11 'HOST_ARCH': self.m.platform.arch, | 11 'HOST_ARCH': self.m.platform.arch, |
12 'HOST_BITS': self.m.platform.bits, | 12 'HOST_BITS': self.m.platform.bits, |
13 | 13 |
14 'TARGET_PLATFORM': self.m.platform.name, | 14 'TARGET_PLATFORM': self.m.platform.name, |
15 'TARGET_ARCH': self.m.platform.arch, | 15 'TARGET_ARCH': self.m.platform.arch, |
16 | 16 |
17 # This should probably default to the platform.bits, but right now this | 17 # NOTE: This is replicating logic which lives in |
18 # is the more expected configuration. | 18 # chrome/trunk/src/build/common.gypi, which is undesirable. The desired |
19 'TARGET_BITS': 32, | 19 # end-state is that all the configuration logic lives in one place |
| 20 # (in chromium/config.py), and the buildside gypfiles are as dumb as |
| 21 # possible. However, since the recipes need to accurately contain |
| 22 # {TARGET,HOST}_{BITS,ARCH,PLATFORM}, for use across many tools (of which |
| 23 # gyp is one tool), we're taking a small risk and replicating the logic |
| 24 # here. |
| 25 'TARGET_BITS': ( |
| 26 32 if self.m.platform.name in ('mac', 'win') |
| 27 else self.m.platform.bits), |
20 | 28 |
21 'BUILD_CONFIG': self.m.properties.get('build_config', 'Release') | 29 'BUILD_CONFIG': self.m.properties.get('build_config', 'Release') |
22 } | 30 } |
23 | 31 |
24 def compile(self, targets=None, name=None, abort_on_failure=True, **kwargs): | 32 def compile(self, targets=None, name=None, abort_on_failure=True, **kwargs): |
25 """Return a compile.py invocation.""" | 33 """Return a compile.py invocation.""" |
26 targets = targets or self.c.compile_py.default_targets.as_jsonish() | 34 targets = targets or self.c.compile_py.default_targets.as_jsonish() |
27 assert isinstance(targets, (list, tuple)) | 35 assert isinstance(targets, (list, tuple)) |
28 | 36 |
29 args = [ | 37 args = [ |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 spawn_dbus=spawn_dbus, | 154 spawn_dbus=spawn_dbus, |
147 env=env) | 155 env=env) |
148 | 156 |
149 def runhooks(self, **kwargs): | 157 def runhooks(self, **kwargs): |
150 """Run the build-configuration hooks for chromium.""" | 158 """Run the build-configuration hooks for chromium.""" |
151 env = kwargs.get('env', {}) | 159 env = kwargs.get('env', {}) |
152 env.update(self.c.gyp_env.as_jsonish()) | 160 env.update(self.c.gyp_env.as_jsonish()) |
153 kwargs['env'] = env | 161 kwargs['env'] = env |
154 return self.m.gclient.runhooks(**kwargs) | 162 return self.m.gclient.runhooks(**kwargs) |
155 | 163 |
OLD | NEW |