diff options
author | 2017-01-12 08:15:38 -0500 | |
---|---|---|
committer | 2017-01-12 13:45:08 +0000 | |
commit | 2b861d3a391f2a9c93f97163d783c78935b7e72d (patch) | |
tree | 78d584d44ec4e8f85a58e4b92aa638914599cfd7 /infra/bots/recipe_modules/compile | |
parent | 621ea115e0b14467ae8f410ed6ad7a31bbe224e2 (diff) |
Move most recipes into modules
The modules will eventually move into a shared repository.
BUG=skia:6070
Change-Id: I622265d98a5446f9f3ebf2c6a197770398623769
Reviewed-on: https://skia-review.googlesource.com/6942
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
Diffstat (limited to 'infra/bots/recipe_modules/compile')
-rw-r--r-- | infra/bots/recipe_modules/compile/__init__.py | 15 | ||||
-rw-r--r-- | infra/bots/recipe_modules/compile/api.py | 81 |
2 files changed, 96 insertions, 0 deletions
diff --git a/infra/bots/recipe_modules/compile/__init__.py b/infra/bots/recipe_modules/compile/__init__.py new file mode 100644 index 0000000000..219eff548d --- /dev/null +++ b/infra/bots/recipe_modules/compile/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2017 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. + +DEPS = [ + 'core', + 'recipe_engine/json', + 'recipe_engine/path', + 'recipe_engine/platform', + 'recipe_engine/properties', + 'recipe_engine/python', + 'flavor', + 'run', + 'vars', +] diff --git a/infra/bots/recipe_modules/compile/api.py b/infra/bots/recipe_modules/compile/api.py new file mode 100644 index 0000000000..5f332c55b5 --- /dev/null +++ b/infra/bots/recipe_modules/compile/api.py @@ -0,0 +1,81 @@ +# 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. + + +# Recipe module for Skia Swarming compile. + + +from recipe_engine import recipe_api + + +def build_targets_from_builder_dict(builder_dict): + """Return a list of targets to build, depending on the builder type.""" + if builder_dict.get('extra_config') == 'iOS': + return ['iOSShell'] + return ['most'] + + +def get_extra_env_vars(builder_dict): + env = {} + if builder_dict.get('compiler') == 'Clang': + env['CC'] = '/usr/bin/clang' + env['CXX'] = '/usr/bin/clang++' + + # SKNX_NO_SIMD, SK_USE_DISCARDABLE_SCALEDIMAGECACHE, etc. + extra_config = builder_dict.get('extra_config', '') + if extra_config.startswith('SK') and extra_config.isupper(): + env['CPPFLAGS'] = '-D' + extra_config + + return env + + +def get_gyp_defines(builder_dict): + gyp_defs = {} + + if (builder_dict.get('os') == 'iOS' or + builder_dict.get('extra_config') == 'iOS'): + gyp_defs['skia_arch_type'] = 'arm' + gyp_defs['skia_clang_build'] = '1' + gyp_defs['skia_os'] = 'ios' + gyp_defs['skia_warnings_as_errors'] = 1 + + return gyp_defs + + +class CompileApi(recipe_api.RecipeApi): + def run(self): + self.m.core.setup() + + env = get_extra_env_vars(self.m.vars.builder_cfg) + gyp_defs = get_gyp_defines(self.m.vars.builder_cfg) + gyp_defs_list = ['%s=%s' % (k, v) for k, v in gyp_defs.iteritems()] + gyp_defs_list.sort() + env['GYP_DEFINES'] = ' '.join(gyp_defs_list) + + build_targets = build_targets_from_builder_dict(self.m.vars.builder_cfg) + + try: + for target in build_targets: + self.m.flavor.compile(target, env=env) + self.m.run.copy_build_products( + self.m.flavor.out_dir, + self.m.vars.swarming_out_dir.join( + 'out', self.m.vars.configuration)) + self.m.flavor.copy_extra_build_products(self.m.vars.swarming_out_dir) + finally: + if 'Win' in self.m.vars.builder_cfg.get('os', ''): + self.m.python.inline( + name='cleanup', + program='''import psutil +for p in psutil.process_iter(): + try: + if p.name in ('mspdbsrv.exe', 'vctip.exe', 'cl.exe', 'link.exe'): + p.kill() + except psutil._error.AccessDenied: + pass +''', + infra_step=True) + + self.m.flavor.cleanup_steps() + self.m.run.check_failure() |