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

Side by Side Diff: infra/bots/recipe_modules/flavor/gn_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
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 flavor utils, used for building Skia with GN.""" 7 """GN flavor utils, used for building Skia with GN."""
8 class GNFlavorUtils(default_flavor.DefaultFlavorUtils): 8 class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
9 def supported(self): 9 def supported(self):
10 extra_config = self.m.vars.builder_cfg.get('extra_config', '') 10 extra_config = self.m.vars.builder_cfg.get('extra_config', '')
11 11
12 return any([ 12 return any([
13 extra_config == 'GN', 13 extra_config == 'GN',
14 extra_config == 'Fast', 14 extra_config == 'Fast',
15 extra_config.startswith('SK') 15 extra_config.startswith('SK')
16 ]) 16 ])
17 17
18 def _run(self, title, cmd):
19 path = self.m.vars.default_env['PATH']
20 self.m.vars.default_env = {'PATH': path}
21 self.m.run(self.m.step, title, cmd=cmd, cwd=self.m.vars.skia_dir)
22
18 def compile(self, unused_target, **kwargs): 23 def compile(self, unused_target, **kwargs):
19 """Build Skia with GN.""" 24 """Build Skia with GN."""
20 compiler = self.m.vars.builder_cfg.get('compiler', '') 25 compiler = self.m.vars.builder_cfg.get('compiler', '')
21 configuration = self.m.vars.builder_cfg.get('configuration', '') 26 configuration = self.m.vars.builder_cfg.get('configuration', '')
22 extra_config = self.m.vars.builder_cfg.get('extra_config', '') 27 extra_config = self.m.vars.builder_cfg.get('extra_config', '')
23 os = self.m.vars.builder_cfg.get('os', '') 28 os = self.m.vars.builder_cfg.get('os', '')
24 29
25 cc, cxx = 'cc', 'c++' 30 cc, cxx = 'cc', 'c++'
26 extra_cflags = [] 31 extra_cflags = []
27 32
(...skipping 20 matching lines...) Expand all
48 53
49 quote = lambda x: '"%s"' % x 54 quote = lambda x: '"%s"' % x
50 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted({ 55 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted({
51 'cc': quote(cc), 56 'cc': quote(cc),
52 'cxx': quote(cxx), 57 'cxx': quote(cxx),
53 'compiler_prefix': quote(compiler_prefix), 58 'compiler_prefix': quote(compiler_prefix),
54 'extra_cflags': quote(' '.join(extra_cflags)), 59 'extra_cflags': quote(' '.join(extra_cflags)),
55 'is_debug': 'true' if configuration == 'Debug' else 'false', 60 'is_debug': 'true' if configuration == 'Debug' else 'false',
56 }.iteritems())) 61 }.iteritems()))
57 62
58 run = lambda title, cmd: self.m.run(self.m.step, title, cmd=cmd, 63 self._run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')])
59 cwd=self.m.vars.skia_dir, **kwargs) 64 self._run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args])
60 65 self._run('ninja', ['ninja', '-C', self.out_dir])
61 run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')])
62 run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args])
63 run('ninja', ['ninja', '-C', self.out_dir])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698