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 extra_gclient_env = {} 34 flutter_android = False 35 parent_rev = False 36 37 if 'NoDEPS' in api.properties['buildername']: 38 bot_update = False 39 checkout_root = api.path['start_dir'] 40 if 'CommandBuffer' in api.vars.builder_name: 41 checkout_chromium = True 42 if 'Flutter' in api.vars.builder_name: 43 checkout_root = checkout_root.join('flutter') 44 checkout_flutter = True 45 if 'Android' in api.vars.builder_name: 46 flutter_android = True 47 if 'ParentRevision' in api.vars.builder_name: 48 parent_rev = True 49 50 if bot_update: 51 api.checkout.bot_update( 52 checkout_root=checkout_root, 53 checkout_chromium=checkout_chromium, 54 checkout_flutter=checkout_flutter, 55 extra_gclient_env=extra_gclient_env, 56 flutter_android=flutter_android, 57 parent_rev=parent_rev) 58 else: 59 api.checkout.git(checkout_root=checkout_root) 60 61 api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir) 62 63 out_dir = checkout_root.join( 64 'skia', 'out', api.vars.builder_name, api.vars.configuration) 65 if 'Flutter' in api.vars.builder_name: 66 out_dir = checkout_root.join('src', 'out', 'android_release') 67 68 try: 69 api.build(checkout_root=checkout_root, out_dir=out_dir) 70 71 # TODO(borenet): Move this out of the try/finally. 72 dst = api.vars.swarming_out_dir 73 if 'ParentRevision' in api.vars.builder_name: 74 dst = api.vars.swarming_out_dir.join('ParentRevision') 75 api.build.copy_build_products(out_dir=out_dir, dst=dst) 76 if 'SKQP' in api.vars.extra_tokens: 77 wlist = checkout_root.join( 78 'skia', 'infra','cts', 'whitelist_devices.json') 79 api.file.copy('copy whitelist', wlist, dst) 80 finally: 81 if 'Win' in api.vars.builder_cfg.get('os', ''): 82 api.python.inline( 83 name='cleanup', 84 program='''import psutil 85for p in psutil.process_iter(): 86 try: 87 if p.name in ('mspdbsrv.exe', 'vctip.exe', 'cl.exe', 'link.exe'): 88 p.kill() 89 except psutil._error.AccessDenied: 90 pass 91''', 92 infra_step=True) 93 94 api.run.check_failure() 95 96 97TEST_BUILDERS = [ 98 'Build-Debian9-Clang-universal-devrel-Android_SKQP', 99 'Build-Debian9-Clang-x86_64-Release-NoDEPS', 100 'Build-Debian9-Clang-x86_64-Release-ParentRevision', 101 'Build-Debian9-GCC-x86_64-Release-Flutter_Android', 102 'Build-Mac-Clang-x86_64-Debug-CommandBuffer', 103 'Build-Win-Clang-x86-Debug', 104] 105 106 107def GenTests(api): 108 for builder in TEST_BUILDERS: 109 test = ( 110 api.test(builder) + 111 api.properties(buildername=builder, 112 repository='https://skia.googlesource.com/skia.git', 113 revision='abc123', 114 path_config='kitchen', 115 swarm_out_dir='[SWARM_OUT_DIR]') + 116 api.path.exists( 117 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt') 118 ) 119 ) 120 yield test 121