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') | 64 self._adb('wait for device', 'wait-for-usb-device') |
borenet
2016/09/13 18:04:52
If we think we have to wait here, we might as well
mtklein
2016/09/13 18:20:54
Good point. Let's try no wait at all (PS 4), and
mtklein
2016/09/13 18:23:26
err, PS 5, which is PS 4 rebased.
borenet
2016/09/13 18:30:24
SGTM
| |
66 self._adb('TEMPORARY clear /data/local/tmp', | |
67 'shell', 'rm', '-rf', '/data/local/tmp/*') | |
68 self._adb('mkdir /data/local/tmp/resources', | 65 self._adb('mkdir /data/local/tmp/resources', |
69 'shell', 'mkdir', '-p', '/data/local/tmp/resources') | 66 'shell', 'mkdir', '-p', '/data/local/tmp/resources') |
70 | 67 |
71 def cleanup_steps(self): | 68 def cleanup_steps(self): |
72 if self._ever_ran_adb: | 69 if self._ever_ran_adb: |
73 self._adb('TEMPORARY clear /data/local/tmp', | 70 self._adb('reboot', 'reboot') |
borenet
2016/09/13 18:04:52
To be clear, we're rebooting and not waiting for t
mtklein
2016/09/13 18:20:54
Right, seems to work okay. If it doesn't, I'll pu
borenet
2016/09/13 18:30:24
SGTM. I think it'll be fine, my only concern would
| |
74 'shell', 'rm', '-rf', '/data/local/tmp/*') | |
75 self._adb('TEMPORARY reboot', 'reboot') | |
76 self._adb('kill adb server', 'kill-server') | 71 self._adb('kill adb server', 'kill-server') |
77 | 72 |
78 def step(self, name, cmd, env=None, **kwargs): | 73 def step(self, name, cmd, env=None, **kwargs): |
79 app = self.m.vars.skia_out.join(self.m.vars.configuration, cmd[0]) | 74 app = self.m.vars.skia_out.join(self.m.vars.configuration, cmd[0]) |
80 self._adb('push %s' % cmd[0], | 75 self._adb('push %s' % cmd[0], |
81 'push', app, '/data/local/tmp') | 76 'push', app, '/data/local/tmp') |
82 | 77 |
83 sh = '%s.sh' % cmd[0] | 78 sh = '%s.sh' % cmd[0] |
84 self.m.run.writefile(self.m.vars.tmp_dir.join(sh), | 79 self.m.run.writefile(self.m.vars.tmp_dir.join(sh), |
85 'set -x; /data/local/tmp/%s; echo $? >/data/local/tmp/rc' % | 80 'set -x; /data/local/tmp/%s; echo $? >/data/local/tmp/rc' % |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 def read_file_on_device(self, path): | 121 def read_file_on_device(self, path): |
127 return self._adb('read %s' % path, | 122 return self._adb('read %s' % path, |
128 'shell', 'cat', path, stdout=self.m.raw_io.output()).stdout | 123 'shell', 'cat', path, stdout=self.m.raw_io.output()).stdout |
129 | 124 |
130 def remove_file_on_device(self, path): | 125 def remove_file_on_device(self, path): |
131 self._adb('rm %s' % path, 'shell', 'rm', '-f', path) | 126 self._adb('rm %s' % path, 'shell', 'rm', '-f', path) |
132 | 127 |
133 def create_clean_device_dir(self, path): | 128 def create_clean_device_dir(self, path): |
134 self._adb('rm %s' % path, 'shell', 'rm', '-rf', path) | 129 self._adb('rm %s' % path, 'shell', 'rm', '-rf', path) |
135 self._adb('mkdir %s' % path, 'shell', 'mkdir', '-p', path) | 130 self._adb('mkdir %s' % path, 'shell', 'mkdir', '-p', path) |
OLD | NEW |