OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 default_flavor | 5 import default_flavor |
6 import subprocess | 6 import subprocess |
7 | 7 |
8 """GN Android flavor utils, used for building Skia for Android with GN.""" | 8 """GN Android flavor utils, used for building Skia for Android with GN.""" |
9 class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils): | 9 class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils): |
10 def __init__(self, m): | 10 def __init__(self, m): |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 'ndk': quote(self.m.vars.slave_dir.join(ndk_asset)), | 54 'ndk': quote(self.m.vars.slave_dir.join(ndk_asset)), |
55 'target_cpu': quote(target_arch), | 55 'target_cpu': quote(target_arch), |
56 }.iteritems())) | 56 }.iteritems())) |
57 | 57 |
58 self._run('fetch-gn', self.m.vars.skia_dir.join('bin', 'fetch-gn'), | 58 self._run('fetch-gn', self.m.vars.skia_dir.join('bin', 'fetch-gn'), |
59 infra_step=True) | 59 infra_step=True) |
60 self._run('gn gen', 'gn', 'gen', self.out_dir, '--args=' + gn_args) | 60 self._run('gn gen', 'gn', 'gen', self.out_dir, '--args=' + gn_args) |
61 self._run('ninja', 'ninja', '-C', self.out_dir) | 61 self._run('ninja', 'ninja', '-C', self.out_dir) |
62 | 62 |
63 def install(self): | 63 def install(self): |
64 self._adb('reboot', 'reboot') | |
65 self._adb('wait for device', 'wait-for-usb-device') | |
66 self._adb('mkdir /data/local/tmp/resources', | 64 self._adb('mkdir /data/local/tmp/resources', |
67 'shell', 'mkdir', '-p', '/data/local/tmp/resources') | 65 'shell', 'mkdir', '-p', '/data/local/tmp/resources') |
68 | 66 |
69 def cleanup_steps(self): | 67 def cleanup_steps(self): |
70 if self._ever_ran_adb: | 68 if self._ever_ran_adb: |
71 self._adb('TEMPORARY reboot', 'reboot') | 69 self._adb('reboot', 'reboot') |
72 self._adb('kill adb server', 'kill-server') | 70 self._adb('kill adb server', 'kill-server') |
73 | 71 |
74 def step(self, name, cmd, env=None, **kwargs): | 72 def step(self, name, cmd, env=None, **kwargs): |
75 app = self.m.vars.skia_out.join(self.m.vars.configuration, cmd[0]) | 73 app = self.m.vars.skia_out.join(self.m.vars.configuration, cmd[0]) |
76 self._adb('push %s' % cmd[0], | 74 self._adb('push %s' % cmd[0], |
77 'push', app, '/data/local/tmp') | 75 'push', app, '/data/local/tmp') |
78 | 76 |
79 sh = '%s.sh' % cmd[0] | 77 sh = '%s.sh' % cmd[0] |
80 self.m.run.writefile(self.m.vars.tmp_dir.join(sh), | 78 self.m.run.writefile(self.m.vars.tmp_dir.join(sh), |
81 'set -x; /data/local/tmp/%s; echo $? >/data/local/tmp/rc' % | 79 'set -x; /data/local/tmp/%s; echo $? >/data/local/tmp/rc' % |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 def read_file_on_device(self, path): | 120 def read_file_on_device(self, path): |
123 return self._adb('read %s' % path, | 121 return self._adb('read %s' % path, |
124 'shell', 'cat', path, stdout=self.m.raw_io.output()).stdout | 122 'shell', 'cat', path, stdout=self.m.raw_io.output()).stdout |
125 | 123 |
126 def remove_file_on_device(self, path): | 124 def remove_file_on_device(self, path): |
127 self._adb('rm %s' % path, 'shell', 'rm', '-f', path) | 125 self._adb('rm %s' % path, 'shell', 'rm', '-f', path) |
128 | 126 |
129 def create_clean_device_dir(self, path): | 127 def create_clean_device_dir(self, path): |
130 self._adb('rm %s' % path, 'shell', 'rm', '-rf', path) | 128 self._adb('rm %s' % path, 'shell', 'rm', '-rf', path) |
131 self._adb('mkdir %s' % path, 'shell', 'mkdir', '-p', path) | 129 self._adb('mkdir %s' % path, 'shell', 'mkdir', '-p', path) |
OLD | NEW |