return 'CMake' in builder_cfg.get('extra_config', '')
-def is_gn(builder_cfg):
- return 'GN' == builder_cfg.get('extra_config', '')
-
-
def is_ios(builder_cfg):
return ('iOS' in builder_cfg.get('extra_config', '') or
builder_cfg.get('os') == 'iOS')
class SkiaFlavorApi(recipe_api.RecipeApi):
def get_flavor(self, builder_cfg):
"""Return a flavor utils object specific to the given builder."""
+ gn = gn_flavor.GNFlavorUtils(self.m)
+ if gn.supported():
+ return gn
+
if is_android(builder_cfg):
return android_flavor.AndroidFlavorUtils(self.m)
elif is_cmake(builder_cfg):
return cmake_flavor.CMakeFlavorUtils(self.m)
- elif is_gn(builder_cfg):
- return gn_flavor.GNFlavorUtils(self.m)
elif is_ios(builder_cfg):
return ios_flavor.iOSFlavorUtils(self.m)
elif is_pdfium(builder_cfg):
"""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):
+ extra_config = self.m.vars.builder_cfg.get('extra_config', '')
+
+ return any([
+ extra_config == 'GN',
+ extra_config == 'Fast',
+ extra_config.startswith('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."""
+ compiler = self.m.vars.builder_cfg.get('compiler', '')
+ configuration = self.m.vars.builder_cfg.get('configuration', '')
+ extra_config = self.m.vars.builder_cfg.get('extra_config', '')
- is_clang = 'Clang' in self.m.vars.builder_name
- is_gcc = 'GCC' in self.m.vars.builder_name
+ gn_args = []
+ if configuration != 'Debug':
+ gn_args.append('is_debug=false')
cc, cxx = 'cc', 'c++'
- if is_clang:
+ cflags = []
+
+ if compiler == 'Clang':
cc, cxx = 'clang', 'clang++'
- elif is_gcc:
+ elif compiler == '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 compiler == '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 extra_config == 'Fast':
+ cflags.extend(['-march=native', '-fomit-frame-pointer'])
+ if extra_config.startswith('SK'):
+ cflags.append('-D' + extra_config)
+
+ cflags = ' '.join(cflags)
+ gn_args += [ 'cc="%s %s"' % (cc, cflags), 'cxx="%s %s"' % (cxx, cflags) ]
+
+ run = lambda title, cmd: self.m.run(self.m.step, title, cmd=cmd,
+ cwd=self.m.vars.skia_dir, **kwargs)
+
+ 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])
"@@@SET_BUILD_PROPERTY@got_revision@164710@@@"
]
},
- {
- "cmd": [
- "[CUSTOM_/_B_WORK]/skia/bin/fetch-gn"
- ],
- "cwd": "[CUSTOM_/_B_WORK]/skia",
- "env": {
- "BUILDTYPE": "Debug",
- "CC": "/usr/bin/clang",
- "CHROME_HEADLESS": "1",
- "CXX": "/usr/bin/clang++",
- "GYP_DEFINES": "skia_arch_type=x86_64 skia_clang_build=1 skia_warnings_as_errors=1",
- "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
- "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-Clang-x86_64-Debug-GN"
- },
- "name": "fetch-gn"
- },
{
"cmd": [
"python",
"@@@STEP_LOG_END@python.inline@@@"
]
},
+ {
+ "cmd": [
+ "[CUSTOM_/_B_WORK]/skia/bin/fetch-gn"
+ ],
+ "cwd": "[CUSTOM_/_B_WORK]/skia",
+ "env": {
+ "BUILDTYPE": "Debug",
+ "CC": "/usr/bin/clang",
+ "CHROME_HEADLESS": "1",
+ "CXX": "/usr/bin/clang++",
+ "GYP_DEFINES": "skia_arch_type=x86_64 skia_clang_build=1 skia_warnings_as_errors=1",
+ "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
+ "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-Clang-x86_64-Debug-GN"
+ },
+ "name": "fetch-gn"
+ },
{
"cmd": [
"gn",
"gen",
"[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-Clang-x86_64-Debug-GN/Debug",
- "--args=is_debug=true cc=\"/usr/bin/ccache clang -Qunused-arguments\" cxx=\"/usr/bin/ccache clang++ -Qunused-arguments\""
+ "--args=cc=\"/usr/bin/ccache clang -Qunused-arguments\" cxx=\"/usr/bin/ccache clang++ -Qunused-arguments\""
],
"cwd": "[CUSTOM_/_B_WORK]/skia",
"env": {
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-Clang-x86_64-Debug-GN"
},
- "name": "gn_gen"
+ "name": "gn gen"
},
{
"cmd": [
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-Clang-x86_64-Debug-GN"
},
- "name": "compile most"
+ "name": "ninja"
},
{
"cmd": [
"@@@SET_BUILD_PROPERTY@got_revision@164710@@@"
]
},
- {
- "cmd": [
- "[CUSTOM_/_B_WORK]/skia/bin/fetch-gn"
- ],
- "cwd": "[CUSTOM_/_B_WORK]/skia",
- "env": {
- "BUILDTYPE": "Debug",
- "CHROME_HEADLESS": "1",
- "GYP_DEFINES": "skia_arch_type=x86_64 skia_warnings_as_errors=1",
- "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
- "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-GN"
- },
- "name": "fetch-gn"
- },
{
"cmd": [
"python",
"@@@STEP_LOG_END@python.inline@@@"
]
},
+ {
+ "cmd": [
+ "[CUSTOM_/_B_WORK]/skia/bin/fetch-gn"
+ ],
+ "cwd": "[CUSTOM_/_B_WORK]/skia",
+ "env": {
+ "BUILDTYPE": "Debug",
+ "CHROME_HEADLESS": "1",
+ "GYP_DEFINES": "skia_arch_type=x86_64 skia_warnings_as_errors=1",
+ "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
+ "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-GN"
+ },
+ "name": "fetch-gn"
+ },
{
"cmd": [
"gn",
"gen",
"[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-GN/Debug",
- "--args=is_debug=true cc=\"/usr/bin/ccache gcc\" cxx=\"/usr/bin/ccache g++\""
+ "--args=cc=\"/usr/bin/ccache gcc \" cxx=\"/usr/bin/ccache g++ \""
],
"cwd": "[CUSTOM_/_B_WORK]/skia",
"env": {
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-GN"
},
- "name": "gn_gen"
+ "name": "gn gen"
},
{
"cmd": [
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-GN"
},
- "name": "compile most"
+ "name": "ninja"
},
{
"cmd": [
},
{
"cmd": [
- "make",
- "most"
+ "python",
+ "-u",
+ "import json\nimport subprocess\nimport sys\n\nccache = None\ntry:\n ccache = subprocess.check_output(['which', 'ccache']).rstrip()\nexcept:\n pass\nprint json.dumps({'ccache': ccache})\n"
+ ],
+ "env": {
+ "BUILDTYPE": "Debug",
+ "CHROME_HEADLESS": "1",
+ "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
+ "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE"
+ },
+ "name": "has ccache?",
+ "stdout": "/path/to/tmp/json",
+ "~followup_annotations": [
+ "@@@STEP_LOG_LINE@json.output (invalid)@null@@@",
+ "@@@STEP_LOG_END@json.output (invalid)@@@",
+ "@@@STEP_LOG_LINE@python.inline@import json@@@",
+ "@@@STEP_LOG_LINE@python.inline@import subprocess@@@",
+ "@@@STEP_LOG_LINE@python.inline@import sys@@@",
+ "@@@STEP_LOG_LINE@python.inline@@@@",
+ "@@@STEP_LOG_LINE@python.inline@ccache = None@@@",
+ "@@@STEP_LOG_LINE@python.inline@try:@@@",
+ "@@@STEP_LOG_LINE@python.inline@ ccache = subprocess.check_output(['which', 'ccache']).rstrip()@@@",
+ "@@@STEP_LOG_LINE@python.inline@except:@@@",
+ "@@@STEP_LOG_LINE@python.inline@ pass@@@",
+ "@@@STEP_LOG_LINE@python.inline@print json.dumps({'ccache': ccache})@@@",
+ "@@@STEP_LOG_END@python.inline@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[CUSTOM_/_B_WORK]/skia/bin/fetch-gn"
+ ],
+ "cwd": "[CUSTOM_/_B_WORK]/skia",
+ "env": {
+ "BUILDTYPE": "Debug",
+ "CHROME_HEADLESS": "1",
+ "CPPFLAGS": "-DSK_USE_DISCARDABLE_SCALEDIMAGECACHE",
+ "GYP_DEFINES": "skia_arch_type=x86_64 skia_warnings_as_errors=1",
+ "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
+ "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE"
+ },
+ "name": "fetch-gn"
+ },
+ {
+ "cmd": [
+ "gn",
+ "gen",
+ "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE/Debug",
+ "--args=cc=\"gcc -DSK_USE_DISCARDABLE_SCALEDIMAGECACHE\" cxx=\"g++ -DSK_USE_DISCARDABLE_SCALEDIMAGECACHE\""
+ ],
+ "cwd": "[CUSTOM_/_B_WORK]/skia",
+ "env": {
+ "BUILDTYPE": "Debug",
+ "CHROME_HEADLESS": "1",
+ "CPPFLAGS": "-DSK_USE_DISCARDABLE_SCALEDIMAGECACHE",
+ "GYP_DEFINES": "skia_arch_type=x86_64 skia_warnings_as_errors=1",
+ "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
+ "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE"
+ },
+ "name": "gn gen"
+ },
+ {
+ "cmd": [
+ "ninja",
+ "-C",
+ "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE/Debug"
],
"cwd": "[CUSTOM_/_B_WORK]/skia",
"env": {
"BUILDTYPE": "Debug",
"CHROME_HEADLESS": "1",
- "CHROME_PATH": "[SLAVE_BUILD]/src",
"CPPFLAGS": "-DSK_USE_DISCARDABLE_SCALEDIMAGECACHE",
"GYP_DEFINES": "skia_arch_type=x86_64 skia_warnings_as_errors=1",
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE"
},
- "name": "build most"
+ "name": "ninja"
},
{
"cmd": [
},
{
"cmd": [
- "make",
- "most"
+ "python",
+ "-u",
+ "import json\nimport subprocess\nimport sys\n\nccache = None\ntry:\n ccache = subprocess.check_output(['which', 'ccache']).rstrip()\nexcept:\n pass\nprint json.dumps({'ccache': ccache})\n"
+ ],
+ "env": {
+ "BUILDTYPE": "Release",
+ "CHROME_HEADLESS": "1",
+ "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
+ "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Release-Fast"
+ },
+ "name": "has ccache?",
+ "stdout": "/path/to/tmp/json",
+ "~followup_annotations": [
+ "@@@STEP_LOG_LINE@json.output (invalid)@null@@@",
+ "@@@STEP_LOG_END@json.output (invalid)@@@",
+ "@@@STEP_LOG_LINE@python.inline@import json@@@",
+ "@@@STEP_LOG_LINE@python.inline@import subprocess@@@",
+ "@@@STEP_LOG_LINE@python.inline@import sys@@@",
+ "@@@STEP_LOG_LINE@python.inline@@@@",
+ "@@@STEP_LOG_LINE@python.inline@ccache = None@@@",
+ "@@@STEP_LOG_LINE@python.inline@try:@@@",
+ "@@@STEP_LOG_LINE@python.inline@ ccache = subprocess.check_output(['which', 'ccache']).rstrip()@@@",
+ "@@@STEP_LOG_LINE@python.inline@except:@@@",
+ "@@@STEP_LOG_LINE@python.inline@ pass@@@",
+ "@@@STEP_LOG_LINE@python.inline@print json.dumps({'ccache': ccache})@@@",
+ "@@@STEP_LOG_END@python.inline@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[CUSTOM_/_B_WORK]/skia/bin/fetch-gn"
+ ],
+ "cwd": "[CUSTOM_/_B_WORK]/skia",
+ "env": {
+ "BUILDTYPE": "Release",
+ "CHROME_HEADLESS": "1",
+ "GYP_DEFINES": "skia_arch_type=x86_64 skia_fast=1 skia_warnings_as_errors=0",
+ "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
+ "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Release-Fast"
+ },
+ "name": "fetch-gn"
+ },
+ {
+ "cmd": [
+ "gn",
+ "gen",
+ "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Release-Fast/Release",
+ "--args=is_debug=false cc=\"gcc -march=native -fomit-frame-pointer\" cxx=\"g++ -march=native -fomit-frame-pointer\""
+ ],
+ "cwd": "[CUSTOM_/_B_WORK]/skia",
+ "env": {
+ "BUILDTYPE": "Release",
+ "CHROME_HEADLESS": "1",
+ "GYP_DEFINES": "skia_arch_type=x86_64 skia_fast=1 skia_warnings_as_errors=0",
+ "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
+ "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Release-Fast"
+ },
+ "name": "gn gen"
+ },
+ {
+ "cmd": [
+ "ninja",
+ "-C",
+ "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Release-Fast/Release"
],
"cwd": "[CUSTOM_/_B_WORK]/skia",
"env": {
"BUILDTYPE": "Release",
"CHROME_HEADLESS": "1",
- "CHROME_PATH": "[SLAVE_BUILD]/src",
"GYP_DEFINES": "skia_arch_type=x86_64 skia_fast=1 skia_warnings_as_errors=0",
"PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Release-Fast"
},
- "name": "build most"
+ "name": "ninja"
},
{
"cmd": [
},
{
"cmd": [
- "gn.exe",
+ "gn",
"gen",
"[CUSTOM_C:\\_B_WORK]\\skia\\out\\Build-Win-MSVC-x86-Release-GN\\Release",
- "--args=is_debug=false cc=\"cc\" cxx=\"c++\""
+ "--args=is_debug=false cc=\"cc \" cxx=\"c++ \""
],
"cwd": "[CUSTOM_C:\\_B_WORK]\\skia",
"env": {
"PATH": "%(PATH)s;RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[CUSTOM_C:\\_B_WORK]\\skia\\out\\Build-Win-MSVC-x86-Release-GN"
},
- "name": "gn_gen"
+ "name": "gn gen"
},
{
"cmd": [
"PATH": "%(PATH)s;RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[CUSTOM_C:\\_B_WORK]\\skia\\out\\Build-Win-MSVC-x86-Release-GN"
},
- "name": "compile most"
+ "name": "ninja"
},
{
"cmd": [