Index: infra/bots/recipe_modules/skia/gn_flavor.py |
diff --git a/infra/bots/recipe_modules/skia/gn_flavor.py b/infra/bots/recipe_modules/skia/gn_flavor.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3cb4099d574e4284b94cc82b015984a38e1498bf |
--- /dev/null |
+++ b/infra/bots/recipe_modules/skia/gn_flavor.py |
@@ -0,0 +1,31 @@ |
+# Copyright 2016 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import default_flavor |
+ |
+"""GN flavor utils, used for building Skia with GN.""" |
+ |
+class GNFlavorUtils(default_flavor.DefaultFlavorUtils): |
+ def compile(self, target): |
+ """Build Skia with GN.""" |
+ # Get the gn executable. |
+ fetch_gn= self._skia_api.skia_dir.join('bin', 'fetch_gn') |
+ self._skia_api.run(self._skia_api.m.step, 'fetch-gn', cmd=[fetch_gn], |
+ cwd=self._skia_api.m.path['checkout']) |
borenet
2016/07/27 19:51:37
Prefer cwd=self._skia_api.skia_dir here and below.
jcgregorio
2016/07/27 20:01:01
Done.
|
+ |
+ is_debug = 'is_debug=' + ( |
+ 'true' if self.configuration == 'Debug' else 'false' |
borenet
2016/07/27 19:51:37
Does self.configuration exist? It might need to b
jcgregorio
2016/07/27 20:01:01
Done.
|
+ ) |
borenet
2016/07/27 19:51:37
Indent?
jcgregorio
2016/07/27 20:01:01
Did in a different way.
|
+ gn_args = [is_debug] |
+ out_dir = 'out/%d' % self.configuration |
+ # Run gn gen out/BUILDTYPE --args="is_debug=true" |
+ gn_gen = ['gn', 'gen', out_dir, '--args=%s' % ' '.join(gn_args)] |
borenet
2016/07/27 19:51:37
It may not matter yet, but if it's "gn.exe" on win
jcgregorio
2016/07/27 20:01:01
Fixed.
|
+ self._skia_api.run(self._skia_api.m.step, 'gn_gen', cmd=gn_gen, |
+ cwd=self._skia_api.m.path['checkout']) |
+ |
+ # Run ninja |
+ ninja_cmd = ['ninja', '-C', out_dir, 'skia'], |
+ self._skia_api.run(self._skia_api.m.step, 'compile %s' % target, |
+ cmd=ninja_cmd, |
+ cwd=self._skia_api.m.path['checkout']) |