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') | 64 self._adb('reboot', 'reboot') |
borenet
2016/09/13 17:23:25
I recommend sleeping for at least 10s after issuin
| |
65 self._adb('wait for device', 'wait-for-usb-device') | 65 self._adb('wait for device', 'wait-for-usb-device') |
66 self.m.python.inline('wait for sys.boot_completed', """ | |
67 import subprocess | |
68 import sys | |
69 import time | |
borenet
2016/09/13 17:23:25
I recommend folding the "adb reboot", "sleep 10",
| |
70 time.sleep(30) | |
71 for attempt in range(30): | |
72 done = subprocess.check_output(['adb', 'shell', | |
73 'getprop', 'sys.boot_completed']) | |
borenet
2016/09/13 17:23:25
Might want to try/catch this in case weird things
| |
74 if done.strip() == '1': | |
75 sys.exit(0) | |
76 time.sleep(1) | |
77 sys.exit(1) | |
78 """, infra_step=True) | |
66 self._adb('TEMPORARY clear /data/local/tmp', | 79 self._adb('TEMPORARY clear /data/local/tmp', |
67 'shell', 'rm', '-rf', '/data/local/tmp/*') | 80 'shell', 'rm', '-rf', '/data/local/tmp/*') |
68 self._adb('mkdir /data/local/tmp/resources', | 81 self._adb('mkdir /data/local/tmp/resources', |
69 'shell', 'mkdir', '-p', '/data/local/tmp/resources') | 82 'shell', 'mkdir', '-p', '/data/local/tmp/resources') |
70 | 83 |
71 def cleanup_steps(self): | 84 def cleanup_steps(self): |
72 if self._ever_ran_adb: | 85 if self._ever_ran_adb: |
73 self._adb('TEMPORARY clear /data/local/tmp', | 86 self._adb('TEMPORARY clear /data/local/tmp', |
74 'shell', 'rm', '-rf', '/data/local/tmp/*') | 87 'shell', 'rm', '-rf', '/data/local/tmp/*') |
75 self._adb('TEMPORARY reboot', 'reboot') | 88 self._adb('TEMPORARY reboot', 'reboot') |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 def read_file_on_device(self, path): | 139 def read_file_on_device(self, path): |
127 return self._adb('read %s' % path, | 140 return self._adb('read %s' % path, |
128 'shell', 'cat', path, stdout=self.m.raw_io.output()).stdout | 141 'shell', 'cat', path, stdout=self.m.raw_io.output()).stdout |
129 | 142 |
130 def remove_file_on_device(self, path): | 143 def remove_file_on_device(self, path): |
131 self._adb('rm %s' % path, 'shell', 'rm', '-f', path) | 144 self._adb('rm %s' % path, 'shell', 'rm', '-f', path) |
132 | 145 |
133 def create_clean_device_dir(self, path): | 146 def create_clean_device_dir(self, path): |
134 self._adb('rm %s' % path, 'shell', 'rm', '-rf', path) | 147 self._adb('rm %s' % path, 'shell', 'rm', '-rf', path) |
135 self._adb('mkdir %s' % path, 'shell', 'mkdir', '-p', path) | 148 self._adb('mkdir %s' % path, 'shell', 'mkdir', '-p', path) |
OLD | NEW |