OLD | NEW |
---|---|
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 | 5 |
6 import android_devices | 6 import android_devices |
7 import copy | 7 import copy |
8 import default_flavor | 8 import default_flavor |
9 | 9 |
10 | 10 |
11 """Appurify flavor utils, used for building and running tests in Appurify.""" | 11 """Appurify flavor utils, used for building and running tests in Appurify.""" |
12 | 12 |
13 | 13 |
14 class AppurifyFlavorUtils(default_flavor.DefaultFlavorUtils): | 14 class AppurifyFlavorUtils(default_flavor.DefaultFlavorUtils): |
15 def __init__(self, skia_api): | 15 def __init__(self, skia_api): |
16 super(AppurifyFlavorUtils, self).__init__(skia_api) | 16 super(AppurifyFlavorUtils, self).__init__(skia_api) |
17 self.device = self._skia_api.builder_spec['device_cfg'] | 17 self.device = self._skia_api.builder_spec['device_cfg'] |
18 slave_info = android_devices.SLAVE_INFO.get( | 18 slave_info = android_devices.SLAVE_INFO.get( |
19 self._skia_api.slave_name, | 19 self._skia_api.slave_name, |
20 android_devices.SLAVE_INFO['default']) | 20 android_devices.SLAVE_INFO['default']) |
21 self.android_tools = self._skia_api.m.path['slave_build'].join( | 21 self.android_tools = self._skia_api.m.path['slave_build'].join( |
22 'skia', 'platform_tools', 'android') | 22 'skia', 'platform_tools', 'android') |
23 self.android_bin = self.android_tools.join('bin') | 23 self.android_bin = self.android_tools.join('bin') |
24 self.apk_dir = self.android_tools.join('apps', 'visualbench', 'build', | 24 self.apk_dir = self.android_tools.join('apps', 'visualbench', 'build', |
25 'outputs', 'apk') | 25 'outputs', 'apk') |
26 self.assets_dir = self.android_tools.join('apps', 'visualbench', 'src', | |
27 'main', 'assets') | |
26 self._android_sdk_root = slave_info.android_sdk_root | 28 self._android_sdk_root = slave_info.android_sdk_root |
27 self._default_env = {'ANDROID_SDK_ROOT': self._android_sdk_root, | 29 self._default_env = {'ANDROID_SDK_ROOT': self._android_sdk_root, |
28 'ANDROID_HOME': self._android_sdk_root, | 30 'ANDROID_HOME': self._android_sdk_root, |
29 'SKIA_ANDROID_VERBOSE_SETUP': 1} | 31 'SKIA_ANDROID_VERBOSE_SETUP': 1} |
30 | 32 |
31 def step(self, name, cmd, env=None, **kwargs): | 33 def step(self, name, cmd, env=None, **kwargs): |
32 # Extract the json file name from the command; ignore the rest. | 34 # Extract the json file name from the command; ignore the rest. |
33 json_file = None | 35 json_file = None |
34 for i, arg in enumerate(cmd): | 36 for i, arg in enumerate(cmd): |
35 if str(arg) == '--outResultsFile': | 37 if str(arg) == '--outResultsFile': |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 self._skia_api.perf_data_dir.join(json_file)) | 77 self._skia_api.perf_data_dir.join(json_file)) |
76 return result | 78 return result |
77 | 79 |
78 def compile(self, target): | 80 def compile(self, target): |
79 """Build the given target.""" | 81 """Build the given target.""" |
80 env = dict(self._default_env) | 82 env = dict(self._default_env) |
81 ccache = self._skia_api.ccache() | 83 ccache = self._skia_api.ccache() |
82 if ccache: | 84 if ccache: |
83 env['ANDROID_MAKE_CCACHE'] = ccache | 85 env['ANDROID_MAKE_CCACHE'] = ccache |
84 | 86 |
87 # Write the nanobench flags to a file inside the APK. | |
88 self.create_clean_host_dir(self.assets_dir) | |
89 self._skia_api._writefile(self.assets_dir.join('nanobench_flags.txt'), | |
90 ' '.join(self._skia_api.nanobench_flags)) | |
borenet
2015/08/31 20:20:30
This puts the nanobench_flags.txt file in the Visu
| |
91 | |
85 cmd = [self.android_bin.join('android_ninja'), target, '-d', self.device] | 92 cmd = [self.android_bin.join('android_ninja'), target, '-d', self.device] |
86 self._skia_api.run(self._skia_api.m.step, 'build %s' % target, cmd=cmd, | 93 self._skia_api.run(self._skia_api.m.step, 'build %s' % target, cmd=cmd, |
87 env=env, cwd=self._skia_api.m.path['checkout']) | 94 env=env, cwd=self._skia_api.m.path['checkout']) |
OLD | NEW |