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

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

Issue 2292663002: add gn_android_flavor (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 | « infra/bots/recipe_modules/flavor/api.py ('k') | infra/bots/recipes/swarm_compile.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 import default_flavor
6
7 """GN Android flavor utils, used for building Skia for Android with GN."""
8 class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils):
9 def supported(self):
10 return 'GN_Android' == self.m.vars.builder_cfg.get('extra_config', '')
11
12 def compile(self, unused_target, **kwargs):
13 compiler = self.m.vars.builder_cfg.get('compiler')
14 configuration = self.m.vars.builder_cfg.get('configuration')
15 os = self.m.vars.builder_cfg.get('os')
16 target_arch = self.m.vars.builder_cfg.get('target_arch')
17
18 assert compiler == 'Clang' # At this rate we might not ever support GCC.
19
20 compiler_prefix = ''
21 ccache = self.m.run.ccache()
22 if ccache:
23 compiler_prefix = ccache
24
25 ndk_asset = 'android_ndk_linux' if os == 'Ubuntu' else 'android_ndk_darwin'
26
27 quote = lambda x: '"%s"' % x
28 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in {
29 'compiler_prefix': quote(compiler_prefix),
30 'is_debug': 'true' if configuration == 'Debug' else 'false',
31 'ndk': quote(self.m.vars.slave_dir.join(ndk_asset)),
32 'target_cpu': quote(target_arch),
33 }.iteritems())
34
35 run = lambda title, cmd: self.m.run(self.m.step, title, cmd=cmd,
36 cwd=self.m.vars.skia_dir, **kwargs)
37
38 run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')])
39 run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args])
40 run('ninja', ['ninja', '-C', self.out_dir])
OLDNEW
« no previous file with comments | « infra/bots/recipe_modules/flavor/api.py ('k') | infra/bots/recipes/swarm_compile.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698