Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: infra/bots/recipe_modules/flavor/gn_android_flavor.py

Issue 2329943004: Mark infra steps as infra_step in GN recipe flavors. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | infra/bots/recipe_modules/flavor/gn_flavor.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
26 26
27 def _run(self, title, *cmd, **kwargs): 27 def _run(self, title, *cmd, **kwargs):
28 self.m.vars.default_env = {k: v for (k,v) 28 self.m.vars.default_env = {k: v for (k,v)
29 in self.m.vars.default_env.iteritems() 29 in self.m.vars.default_env.iteritems()
30 if k in ['PATH']} 30 if k in ['PATH']}
31 return self.m.run(self.m.step, title, cmd=list(cmd), 31 return self.m.run(self.m.step, title, cmd=list(cmd),
32 cwd=self.m.vars.skia_dir, env={}, **kwargs) 32 cwd=self.m.vars.skia_dir, env={}, **kwargs)
33 33
34 def _adb(self, title, *cmd, **kwargs): 34 def _adb(self, title, *cmd, **kwargs):
35 self._ever_ran_adb = True 35 self._ever_ran_adb = True
36 # The only non-infra adb call (check rc) happens to not use _adb().
37 if 'infra_step' not in kwargs:
38 kwargs['infra_step'] = True
36 return self._run(title, 'adb', *cmd, **kwargs) 39 return self._run(title, 'adb', *cmd, **kwargs)
37 40
38 def compile(self, unused_target, **kwargs): 41 def compile(self, unused_target, **kwargs):
39 compiler = self.m.vars.builder_cfg.get('compiler') 42 compiler = self.m.vars.builder_cfg.get('compiler')
40 configuration = self.m.vars.builder_cfg.get('configuration') 43 configuration = self.m.vars.builder_cfg.get('configuration')
41 os = self.m.vars.builder_cfg.get('os') 44 os = self.m.vars.builder_cfg.get('os')
42 target_arch = self.m.vars.builder_cfg.get('target_arch') 45 target_arch = self.m.vars.builder_cfg.get('target_arch')
43 46
44 assert compiler == 'Clang' # At this rate we might not ever support GCC. 47 assert compiler == 'Clang' # At this rate we might not ever support GCC.
45 48
46 ndk_asset = 'android_ndk_linux' if os == 'Ubuntu' else 'android_ndk_darwin' 49 ndk_asset = 'android_ndk_linux' if os == 'Ubuntu' else 'android_ndk_darwin'
47 50
48 quote = lambda x: '"%s"' % x 51 quote = lambda x: '"%s"' % x
49 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted({ 52 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted({
50 'is_debug': 'true' if configuration == 'Debug' else 'false', 53 'is_debug': 'true' if configuration == 'Debug' else 'false',
51 'ndk': quote(self.m.vars.slave_dir.join(ndk_asset)), 54 'ndk': quote(self.m.vars.slave_dir.join(ndk_asset)),
52 'target_cpu': quote(target_arch), 55 'target_cpu': quote(target_arch),
53 }.iteritems())) 56 }.iteritems()))
54 57
55 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)
56 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)
57 self._run('ninja', 'ninja', '-C', self.out_dir) 61 self._run('ninja', 'ninja', '-C', self.out_dir)
58 62
59 def install(self): 63 def install(self):
60 self._adb('reboot', 'reboot') 64 self._adb('reboot', 'reboot')
61 self._adb('wait for device', 'wait-for-usb-device') 65 self._adb('wait for device', 'wait-for-usb-device')
62 self._adb('TEMPORARY clear /data/local/tmp', 66 self._adb('TEMPORARY clear /data/local/tmp',
63 'shell', 'rm', '-rf', '/data/local/tmp/*') 67 'shell', 'rm', '-rf', '/data/local/tmp/*')
64 self._adb('mkdir /data/local/tmp/resources', 68 self._adb('mkdir /data/local/tmp/resources',
65 'shell', 'mkdir', '-p', '/data/local/tmp/resources') 69 'shell', 'mkdir', '-p', '/data/local/tmp/resources')
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 def read_file_on_device(self, path): 126 def read_file_on_device(self, path):
123 return self._adb('read %s' % path, 127 return self._adb('read %s' % path,
124 'shell', 'cat', path, stdout=self.m.raw_io.output()).stdout 128 'shell', 'cat', path, stdout=self.m.raw_io.output()).stdout
125 129
126 def remove_file_on_device(self, path): 130 def remove_file_on_device(self, path):
127 self._adb('rm %s' % path, 'shell', 'rm', '-f', path) 131 self._adb('rm %s' % path, 'shell', 'rm', '-f', path)
128 132
129 def create_clean_device_dir(self, path): 133 def create_clean_device_dir(self, path):
130 self._adb('rm %s' % path, 'shell', 'rm', '-rf', path) 134 self._adb('rm %s' % path, 'shell', 'rm', '-rf', path)
131 self._adb('mkdir %s' % path, 'shell', 'mkdir', '-p', path) 135 self._adb('mkdir %s' % path, 'shell', 'mkdir', '-p', path)
OLDNEW
« no previous file with comments | « no previous file | infra/bots/recipe_modules/flavor/gn_flavor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698