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 3# found in the LICENSE file. 4 5 6# Recipe module for Skia Swarming compile. 7 8 9DEPS = [ 10 'build', 11 'checkout', 12 'recipe_engine/context', 13 'recipe_engine/file', 14 'recipe_engine/json', 15 'recipe_engine/path', 16 'recipe_engine/platform', 17 'recipe_engine/properties', 18 'recipe_engine/python', 19 'recipe_engine/step', 20 'run', 21 'vars', 22] 23 24 25def RunSteps(api): 26 api.vars.setup() 27 28 # Check out code. 29 bot_update = True 30 checkout_root = api.checkout.default_checkout_root 31 checkout_chromium = False 32 checkout_flutter = False 33 flutter_android = False 34 35 if 'NoDEPS' in api.properties['buildername']: 36 bot_update = False 37 checkout_root = api.path['start_dir'] 38 if 'CommandBuffer' in api.vars.builder_name: 39 checkout_chromium = True 40 if 'Flutter' in api.vars.builder_name: 41 checkout_root = checkout_root.join('flutter') 42 checkout_flutter = True 43 if 'Android' in api.vars.builder_name: 44 flutter_android = True 45 46 if bot_update: 47 api.checkout.bot_update( 48 checkout_root=checkout_root, 49 checkout_chromium=checkout_chromium, 50 checkout_flutter=checkout_flutter, 51 flutter_android=flutter_android) 52 else: 53 api.checkout.git(checkout_root=checkout_root) 54 55 api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir) 56 57 out_dir = checkout_root.join( 58 'skia', 'out', api.vars.builder_name, api.vars.configuration) 59 if 'Flutter' in api.vars.builder_name: 60 out_dir = checkout_root.join('src', 'out', 'android_release') 61 62 try: 63 api.build(checkout_root=checkout_root, out_dir=out_dir) 64 65 # TODO(borenet): Move this out of the try/finally. 66 dst = api.vars.swarming_out_dir 67 api.build.copy_build_products(out_dir=out_dir, dst=dst) 68 finally: 69 if 'Win' in api.vars.builder_cfg.get('os', ''): 70 api.python.inline( 71 name='cleanup', 72 program=''' 73# [VPYTHON:BEGIN] 74# wheel: < 75# name: "infra/python/wheels/psutil/${vpython_platform}" 76# version: "version:5.4.7" 77# > 78# [VPYTHON:END] 79 80import psutil 81for p in psutil.process_iter(): 82 try: 83 if p.name in ('mspdbsrv.exe', 'vctip.exe', 'cl.exe', 'link.exe'): 84 p.kill() 85 except psutil._error.AccessDenied: 86 pass 87''', 88 infra_step=True, 89 venv=True) 90 91 api.run.check_failure() 92 93 94TEST_BUILDERS = [ 95 'Build-Debian10-Clang-universal-devrel-Android_SKQP', 96 'Build-Debian10-Clang-arm-Release-Flutter_Android', 97 'Build-Mac-Clang-x86_64-Debug-CommandBuffer', 98 'Build-Win10-Clang-x86_64-Release-NoDEPS', 99] 100 101 102def GenTests(api): 103 for builder in TEST_BUILDERS: 104 test = ( 105 api.test(builder) + 106 api.properties(buildername=builder, 107 repository='https://skia.googlesource.com/skia.git', 108 revision='abc123', 109 path_config='kitchen', 110 swarm_out_dir='[SWARM_OUT_DIR]') + 111 api.path.exists( 112 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt') 113 ) 114 ) 115 if 'Win' in builder: 116 test += api.platform('win', 64) 117 yield test 118