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

Unified Diff: infra/bots/recipe_modules/flavor/gn_flavor.py

Issue 2229463002: GN: take over some exisiting bots (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: forget about 32-bit for now Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: infra/bots/recipe_modules/flavor/gn_flavor.py
diff --git a/infra/bots/recipe_modules/flavor/gn_flavor.py b/infra/bots/recipe_modules/flavor/gn_flavor.py
index 019967748b5a4bff39d45e9c783f1c789a17bd7c..82f6f66919d8b852c90da8b4ffa2fab719c4983a 100644
--- a/infra/bots/recipe_modules/flavor/gn_flavor.py
+++ b/infra/bots/recipe_modules/flavor/gn_flavor.py
@@ -6,50 +6,47 @@ import default_flavor
"""GN flavor utils, used for building Skia with GN."""
class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
- def compile(self, target, **kwargs):
- """Build Skia with GN."""
- # Get the gn executable.
- fetch_gn = self.m.vars.skia_dir.join('bin', 'fetch-gn')
- self.m.run(self.m.step, 'fetch-gn',
- cmd=[fetch_gn],
- cwd=self.m.vars.skia_dir,
- **kwargs)
+ def supported(self):
+ has = lambda s: s in self.m.vars.builder_name
borenet 2016/08/11 12:29:47 Please change this to target a specific portion of
+
+ return has('GN') or any([
+ has('Fast'),
+ has('-SK'),
+ ])
- is_debug = 'is_debug=true'
- if self.m.vars.configuration != 'Debug':
- is_debug = 'is_debug=false'
- gn_args = [is_debug]
+ def compile(self, unused_target, **kwargs):
+ """Build Skia with GN."""
+ has = lambda s: s in self.m.vars.builder_name
borenet 2016/08/11 12:29:47 Same here.
+ run = lambda title, cmd: self.m.run(self.m.step, title, cmd=cmd,
+ cwd=self.m.vars.skia_dir, **kwargs)
- is_clang = 'Clang' in self.m.vars.builder_name
- is_gcc = 'GCC' in self.m.vars.builder_name
+ gn_args = []
+ if not has('Debug'):
+ gn_args.append('is_debug=false')
cc, cxx = 'cc', 'c++'
- if is_clang:
+ cflags = []
+
+ if has('Clang'):
cc, cxx = 'clang', 'clang++'
- elif is_gcc:
+ elif has('GCC'):
cc, cxx = 'gcc', 'g++'
ccache = self.m.run.ccache()
if ccache:
cc, cxx = '%s %s' % (ccache, cc), '%s %s' % (ccache, cxx)
- if is_clang:
+ if has('Clang'):
# Stifle "argument unused during compilation: ..." warnings.
- stifle = '-Qunused-arguments'
- cc, cxx = '%s %s' % (cc, stifle), '%s %s' % (cxx, stifle)
-
- gn_args += [ 'cc="%s"' % cc, 'cxx="%s"' % cxx ]
-
- # Run gn gen.
- gn_exe = 'gn'
- if self.m.platform.is_win:
- gn_exe = 'gn.exe'
- gn_gen = [gn_exe, 'gen', self.out_dir, '--args=%s' % ' '.join(gn_args)]
- self.m.run(self.m.step, 'gn_gen', cmd=gn_gen,
- cwd=self.m.vars.skia_dir, **kwargs)
-
- # Run ninja.
- ninja_cmd = ['ninja', '-C', self.out_dir]
- self.m.run(self.m.step, 'compile %s' % target,
- cmd=ninja_cmd,
- cwd=self.m.vars.skia_dir,
- **kwargs)
+ cflags.append('-Qunused-arguments')
+
+ if has('Fast'):
+ cflags.extend(['-march=native', '-fomit-frame-pointer'])
+ if has('-SK'):
+ cflags.append('-D' + self.m.vars.builder_cfg['extra_config'])
+
+ cflags = ' '.join(cflags)
+ gn_args += [ 'cc="%s %s"' % (cc, cflags), 'cxx="%s %s"' % (cxx, cflags) ]
+
+ run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')])
+ run('gn gen', ['gn', 'gen', self.out_dir, '--args=%s' % ' '.join(gn_args)])
+ run('ninja', ['ninja', '-C', self.out_dir])

Powered by Google App Engine
This is Rietveld 408576698