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 9 DEPS = [ 10 'core', 11 'recipe_engine/context', 12 'recipe_engine/json', 13 'recipe_engine/path', 14 'recipe_engine/platform', 15 'recipe_engine/properties', 16 'recipe_engine/python', 17 'recipe_engine/step', 18 'flavor', 19 'run', 20 'vars', 21 ] 22 23 24 def build_targets_from_builder_dict(builder_dict): 25 """Return a list of targets to build, depending on the builder type.""" 26 if builder_dict.get('extra_config') == 'iOS': 27 return ['iOSShell'] 28 return ['most'] 29 30 31 def get_extra_env_vars(builder_dict): 32 env = {} 33 if builder_dict.get('compiler') == 'Clang': 34 env['CC'] = '/usr/bin/clang' 35 env['CXX'] = '/usr/bin/clang++' 36 37 # SKNX_NO_SIMD, SK_USE_DISCARDABLE_SCALEDIMAGECACHE, etc. 38 extra_config = builder_dict.get('extra_config', '') 39 if extra_config.startswith('SK') and extra_config.isupper(): 40 env['CPPFLAGS'] = '-D' + extra_config 41 42 return env 43 44 45 def RunSteps(api): 46 api.core.setup() 47 48 env = get_extra_env_vars(api.vars.builder_cfg) 49 build_targets = build_targets_from_builder_dict(api.vars.builder_cfg) 50 51 try: 52 for target in build_targets: 53 with api.context(env=env): 54 api.flavor.compile(target) 55 api.run.copy_build_products( 56 api.flavor.out_dir, 57 api.vars.swarming_out_dir.join( 58 'out', api.vars.configuration)) 59 api.flavor.copy_extra_build_products(api.vars.swarming_out_dir) 60 finally: 61 if 'Win' in api.vars.builder_cfg.get('os', ''): 62 api.python.inline( 63 name='cleanup', 64 program='''import psutil 65 for p in psutil.process_iter(): 66 try: 67 if p.name in ('mspdbsrv.exe', 'vctip.exe', 'cl.exe', 'link.exe'): 68 p.kill() 69 except psutil._error.AccessDenied: 70 pass 71 ''', 72 infra_step=True) 73 74 api.flavor.cleanup_steps() 75 api.run.check_failure() 76 77 78 TEST_BUILDERS = [ 79 'Build-Mac-Clang-arm64-Debug-Android', 80 'Build-Mac-Clang-arm64-Debug-iOS', 81 'Build-Mac-Clang-x64-Release-iOS', 82 'Build-Mac-Clang-x86_64-Debug-CommandBuffer', 83 'Build-Mac-Clang-x86_64-Release', 84 'Build-Ubuntu-Clang-arm-Release-Chromebook_C100p', 85 'Build-Ubuntu-Clang-arm64-Release-Android', 86 'Build-Ubuntu-Clang-arm64-Release-Android_Vulkan', 87 'Build-Ubuntu-Clang-mipsel-Debug-Android', 88 'Build-Ubuntu-Clang-x86_64-Debug', 89 'Build-Ubuntu-Clang-x86_64-Debug-ASAN', 90 'Build-Ubuntu-Clang-x86_64-Debug-MSAN', 91 'Build-Ubuntu-Clang-x86_64-Release-Mini', 92 'Build-Ubuntu-Clang-x86_64-Release-Vulkan', 93 'Build-Ubuntu-GCC-arm-Release-Chromecast', 94 'Build-Ubuntu-GCC-x86-Debug', 95 'Build-Ubuntu-GCC-x86_64-Debug-GN', 96 'Build-Ubuntu-GCC-x86_64-Debug-MSAN', 97 'Build-Ubuntu-GCC-x86_64-Debug-NoGPU', 98 'Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE', 99 'Build-Ubuntu-GCC-x86_64-Release-ANGLE', 100 'Build-Ubuntu-GCC-x86_64-Release-Fast', 101 'Build-Ubuntu-GCC-x86_64-Release-Flutter_Android', 102 'Build-Ubuntu-GCC-x86_64-Release-Mesa', 103 'Build-Ubuntu-GCC-x86_64-Release-PDFium', 104 'Build-Ubuntu-GCC-x86_64-Release-PDFium_SkiaPaths', 105 'Build-Ubuntu-GCC-x86_64-Release-Shared', 106 'Build-Win-Clang-arm64-Release-Android', 107 'Build-Win-MSVC-x86-Debug', 108 'Build-Win-MSVC-x86-Debug-ANGLE', 109 'Build-Win-MSVC-x86-Debug-Exceptions', 110 'Build-Win-MSVC-x86-Release-GDI', 111 'Build-Win-MSVC-x86-Release-GN', 112 'Build-Win-MSVC-x86_64-Release-Vulkan', 113 ] 114 115 116 def GenTests(api): 117 for builder in TEST_BUILDERS: 118 test = ( 119 api.test(builder) + 120 api.properties(buildername=builder, 121 repository='https://skia.googlesource.com/skia.git', 122 revision='abc123', 123 path_config='kitchen', 124 swarm_out_dir='[SWARM_OUT_DIR]') + 125 api.path.exists( 126 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt') 127 ) 128 ) 129 if 'Win' in builder: 130 test += api.platform('win', 64) 131 elif 'Mac' in builder: 132 test += api.platform('mac', 64) 133 else: 134 test += api.platform('linux', 64) 135 136 yield test 137 138 139 buildername = 'Build-Win-MSVC-x86_64-Release-Vulkan' 140 yield ( 141 api.test("trybot") + 142 api.properties(buildername=buildername, 143 repository='https://skia.googlesource.com/skia.git', 144 revision='abc123', 145 path_config='kitchen', 146 swarm_out_dir='[SWARM_OUT_DIR]') + 147 api.path.exists( 148 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt') 149 ) + 150 api.properties(patch_storage='gerrit') + 151 api.properties.tryserver( 152 buildername=buildername, 153 gerrit_project='skia', 154 gerrit_url='https://skia-review.googlesource.com/', 155 ) 156 ) 157 158 buildername = 'Build-Win-MSVC-x86_64-Release-Vulkan' 159 yield ( 160 api.test('alternate_repo') + 161 api.properties(buildername=buildername, 162 repository='https://skia.googlesource.com/other_repo.git', 163 revision='abc123', 164 path_config='kitchen', 165 swarm_out_dir='[SWARM_OUT_DIR]') + 166 api.path.exists( 167 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt') 168 ) 169 ) 170 171 buildername = 'Build-Ubuntu-GCC-x86_64-Release-PDFium' 172 yield ( 173 api.test('pdfium_trybot') + 174 api.properties( 175 repository='https://skia.googlesource.com/skia.git', 176 buildername=buildername, 177 path_config='kitchen', 178 swarm_out_dir='[SWARM_OUT_DIR]', 179 revision='abc123', 180 patch_issue=500, 181 patch_repo='https://skia.googlesource.com/skia.git', 182 patch_set=1, 183 patch_storage='gerrit') + 184 api.properties.tryserver( 185 buildername=buildername, 186 gerrit_project='skia', 187 gerrit_url='https://skia-review.googlesource.com/', 188 ) + 189 api.path.exists( 190 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt') 191 ) 192 ) 193 194 buildername = 'Build-Ubuntu-GCC-x86_64-Release-Flutter_Android' 195 yield ( 196 api.test('flutter_trybot') + 197 api.properties( 198 repository='https://skia.googlesource.com/skia.git', 199 buildername=buildername, 200 path_config='kitchen', 201 swarm_out_dir='[SWARM_OUT_DIR]', 202 revision='abc123', 203 patch_issue=500, 204 patch_repo='https://skia.googlesource.com/skia.git', 205 patch_set=1, 206 patch_storage='gerrit') + 207 api.properties.tryserver( 208 buildername=buildername, 209 gerrit_project='skia', 210 gerrit_url='https://skia-review.googlesource.com/', 211 ) + 212 api.path.exists( 213 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt') 214 ) 215 ) 216