Chromium Code Reviews| 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 BaseAndroidApi(recipe_api.RecipeApi): | 7 class BaseAndroidApi(recipe_api.RecipeApi): |
| 8 def __init__(self, **kwargs): | 8 def __init__(self, **kwargs): |
| 9 super(BaseAndroidApi, self).__init__(**kwargs) | 9 super(BaseAndroidApi, self).__init__(**kwargs) |
| 10 self._env = {} | 10 self._env = {} |
| 11 | 11 |
| 12 def envsetup(self): | 12 def envsetup(self): |
| 13 """Use envsetup.sh to read environment variables to use for Android. | 13 """Use envsetup.sh to read environment variables to use for Android. |
| 14 | 14 |
| 15 This environment will be used for runhooks, compile and test_runner with the | 15 This environment will be used for runhooks, compile and test_runner with the |
| 16 exception for the GYP_* variables, which are excluded to avoid confusion | 16 exception for the GYP_* variables, which are excluded to avoid confusion |
| 17 with settings in the chromium recipe module config. | 17 with settings in the chromium recipe module config. |
| 18 """ | 18 """ |
| 19 envsetup_cmd = [self.m.path.checkout('build', 'android', 'envsetup.sh')] | 19 envsetup_cmd = [self.m.path.checkout('build', 'android', 'envsetup.sh')] |
| 20 if self.target_arch: | |
| 21 envsetup_cmd += ['--target-arch=%s' % self.target_arch] | |
| 22 | 20 |
| 23 cmd = ([self.m.path.build('scripts', 'slave', 'env_dump.py'), | 21 cmd = ([self.m.path.build('scripts', 'slave', 'env_dump.py'), |
| 24 '--output-json', self.m.json.output()] + envsetup_cmd) | 22 '--output-json', self.m.json.output()] + envsetup_cmd) |
| 25 yield self.m.step('envsetup', cmd, env=self._env) | 23 yield self.m.step('envsetup', cmd, env=self._env) |
| 26 | 24 |
| 27 env_diff = self.m.step_history.last_step().json.output | 25 env_diff = self.m.step_history.last_step().json.output |
| 28 self._env.update((k, v) for k, v in env_diff.iteritems() | 26 self._env.update((k, v) for k, v in env_diff.iteritems() |
| 29 if not k.startswith('GYP_')) | 27 if not k.startswith('GYP_')) |
| 30 | 28 |
| 31 @property | 29 @property |
| 32 def target_arch(self): | 30 def target_arch(self): |
|
iannucci
2014/02/19 21:54:20
This method may be able to go away, but I'm assumi
Nico
2014/02/19 22:00:51
Looks like presubmit is still happy if I delete th
| |
| 33 """Convert from recipe arch to Android architecture string.""" | 31 """Convert from recipe arch to Android architecture string.""" |
| 34 return { | 32 return { |
| 35 'intel': 'x86', | 33 'intel': 'x86', |
| 36 'arm': 'arm', | 34 'arm': 'arm', |
| 37 'mips': 'mips', | 35 'mips': 'mips', |
| 38 }.get(self.m.chromium.c.TARGET_ARCH, '') | 36 }.get(self.m.chromium.c.TARGET_ARCH, '') |
| 39 | 37 |
| 40 def runhooks(self): | 38 def runhooks(self): |
| 41 return self.m.chromium.runhooks(env=self._env) | 39 return self.m.chromium.runhooks(env=self._env) |
| 42 | 40 |
| 43 def compile(self): | 41 def compile(self): |
| 44 return self.m.chromium.compile(env=self._env) | 42 return self.m.chromium.compile(env=self._env) |
| 45 | 43 |
| 46 def test_runner(self, test): | 44 def test_runner(self, test): |
| 47 script = self.m.path.checkout('build', 'android', 'test_runner.py') | 45 script = self.m.path.checkout('build', 'android', 'test_runner.py') |
| 48 args = ['gtest', '-s', test, '--verbose'] | 46 args = ['gtest', '-s', test, '--verbose'] |
| 49 if self.m.chromium.c.BUILD_CONFIG == 'Release': | 47 if self.m.chromium.c.BUILD_CONFIG == 'Release': |
| 50 args += ['--release'] | 48 args += ['--release'] |
| 51 return self.m.python(test, script, args, env=self._env) | 49 return self.m.python(test, script, args, env=self._env) |
| OLD | NEW |