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

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

Issue 2300173002: GN: expunge all environment variables that have no effect on GN (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 6
7 """GN Android flavor utils, used for building Skia for Android with GN.""" 7 """GN Android flavor utils, used for building Skia for Android with GN."""
8 class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils): 8 class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils):
9 def supported(self): 9 def supported(self):
10 return 'GN_Android' == self.m.vars.builder_cfg.get('extra_config', '') 10 return 'GN_Android' == self.m.vars.builder_cfg.get('extra_config', '')
11 11
12 def _run(self, title, cmd):
13 path = self.m.vars.default_env['PATH']
14 self.m.vars.default_env = {'PATH': path}
15 self.m.run(self.m.step, title, cmd=cmd, cwd=self.m.vars.skia_dir, env={})
16
12 def compile(self, unused_target, **kwargs): 17 def compile(self, unused_target, **kwargs):
13 compiler = self.m.vars.builder_cfg.get('compiler') 18 compiler = self.m.vars.builder_cfg.get('compiler')
14 configuration = self.m.vars.builder_cfg.get('configuration') 19 configuration = self.m.vars.builder_cfg.get('configuration')
15 os = self.m.vars.builder_cfg.get('os') 20 os = self.m.vars.builder_cfg.get('os')
16 target_arch = self.m.vars.builder_cfg.get('target_arch') 21 target_arch = self.m.vars.builder_cfg.get('target_arch')
17 22
18 assert compiler == 'Clang' # At this rate we might not ever support GCC. 23 assert compiler == 'Clang' # At this rate we might not ever support GCC.
19 24
20 compiler_prefix = '' 25 compiler_prefix = ''
21 extra_cflags = [] 26 extra_cflags = []
22 ccache = self.m.run.ccache() 27 ccache = self.m.run.ccache()
23 if ccache: 28 if ccache:
24 compiler_prefix = ccache 29 compiler_prefix = ccache
25 extra_cflags.append('-Qunused-arguments') 30 extra_cflags.append('-Qunused-arguments')
26 31
27 ndk_asset = 'android_ndk_linux' if os == 'Ubuntu' else 'android_ndk_darwin' 32 ndk_asset = 'android_ndk_linux' if os == 'Ubuntu' else 'android_ndk_darwin'
28 33
29 quote = lambda x: '"%s"' % x 34 quote = lambda x: '"%s"' % x
30 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted({ 35 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted({
31 'compiler_prefix': quote(compiler_prefix), 36 'compiler_prefix': quote(compiler_prefix),
32 'extra_cflags': quote(' '.join(extra_cflags)), 37 'extra_cflags': quote(' '.join(extra_cflags)),
33 'is_debug': 'true' if configuration == 'Debug' else 'false', 38 'is_debug': 'true' if configuration == 'Debug' else 'false',
34 'ndk': quote(self.m.vars.slave_dir.join(ndk_asset)), 39 'ndk': quote(self.m.vars.slave_dir.join(ndk_asset)),
35 'target_cpu': quote(target_arch), 40 'target_cpu': quote(target_arch),
36 }.iteritems())) 41 }.iteritems()))
37 42
38 run = lambda title, cmd: self.m.run(self.m.step, title, cmd=cmd, 43 self._run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')])
39 cwd=self.m.vars.skia_dir, **kwargs) 44 self._run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args])
40 45 self._run('ninja', ['ninja', '-C', self.out_dir])
41 run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')])
42 run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args])
43 run('ninja', ['ninja', '-C', self.out_dir])
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