OLD | NEW |
| (Empty) |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 from slave import recipe_api | |
6 | |
7 class BaseAndroidApi(recipe_api.RecipeApi): | |
8 def __init__(self, **kwargs): | |
9 super(BaseAndroidApi, self).__init__(**kwargs) | |
10 self._env = {} | |
11 | |
12 def envsetup(self): | |
13 """Use envsetup.sh to read environment variables to use for Android. | |
14 | |
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 | |
17 with settings in the chromium recipe module config. | |
18 """ | |
19 envsetup_cmd = [self.m.path['checkout'].join('build', 'android', | |
20 'envsetup.sh')] | |
21 | |
22 cmd = ([self.m.path['build'].join('scripts', 'slave', 'env_dump.py'), | |
23 '--output-json', self.m.json.output()] + envsetup_cmd) | |
24 result = self.m.step('envsetup', cmd, env=self._env) | |
25 | |
26 env_diff = result.json.output | |
27 self._env.update((k, v) for k, v in env_diff.iteritems() | |
28 if not k.startswith('GYP_')) | |
29 | |
30 def runhooks(self): | |
31 self.m.chromium.runhooks(env=self._env) | |
32 | |
33 def compile(self): | |
34 self.m.chromium.compile(env=self._env) | |
35 | |
36 def test_runner(self, test): | |
37 script = self.m.path['checkout'].join('build', 'android', 'test_runner.py') | |
38 args = ['gtest', '-s', test, '--verbose'] | |
39 if self.m.chromium.c.BUILD_CONFIG == 'Release': | |
40 args += ['--release'] | |
41 self.m.python(test, script, args, env=self._env) | |
OLD | NEW |