borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 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 = [ |
Eric Boren | 9030b94 | 2018-05-14 12:50:38 -0400 | [diff] [blame] | 10 | 'build', |
Eric Boren | 90f0503 | 2018-05-24 09:14:18 -0400 | [diff] [blame] | 11 | 'checkout', |
Robert Iannucci | 297a7ef | 2017-05-12 19:09:38 -0700 | [diff] [blame] | 12 | 'recipe_engine/context', |
Eric Boren | b702316 | 2018-05-04 13:46:15 -0400 | [diff] [blame] | 13 | 'recipe_engine/file', |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 14 | 'recipe_engine/json', |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 15 | 'recipe_engine/path', |
| 16 | 'recipe_engine/platform', |
| 17 | 'recipe_engine/properties', |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 18 | 'recipe_engine/python', |
| 19 | 'recipe_engine/step', |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 20 | 'run', |
| 21 | 'vars', |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 22 | ] |
| 23 | |
| 24 | |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 25 | def RunSteps(api): |
Eric Boren | b702316 | 2018-05-04 13:46:15 -0400 | [diff] [blame] | 26 | api.vars.setup() |
| 27 | |
| 28 | # Check out code. |
Eric Boren | 4184608 | 2018-05-30 14:36:03 -0400 | [diff] [blame] | 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 | |
Eric Boren | 86a1146 | 2018-02-22 10:03:56 -0500 | [diff] [blame] | 37 | if 'NoDEPS' in api.properties['buildername']: |
Eric Boren | 4184608 | 2018-05-30 14:36:03 -0400 | [diff] [blame] | 38 | bot_update = False |
Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 39 | checkout_root = api.path['start_dir'] |
Eric Boren | 4184608 | 2018-05-30 14:36:03 -0400 | [diff] [blame] | 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) |
Eric Boren | b702316 | 2018-05-04 13:46:15 -0400 | [diff] [blame] | 58 | else: |
Eric Boren | 4184608 | 2018-05-30 14:36:03 -0400 | [diff] [blame] | 59 | api.checkout.git(checkout_root=checkout_root) |
Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 60 | |
Eric Boren | b702316 | 2018-05-04 13:46:15 -0400 | [diff] [blame] | 61 | api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir) |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 62 | |
Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 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 | |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 68 | try: |
Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 69 | api.build(checkout_root=checkout_root, out_dir=out_dir) |
| 70 | |
| 71 | # TODO(borenet): Move this out of the try/finally. |
Eric Boren | 322a859 | 2018-06-01 10:08:53 -0400 | [diff] [blame] | 72 | dst = api.vars.swarming_out_dir |
Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 73 | if 'ParentRevision' in api.vars.builder_name: |
Eric Boren | 322a859 | 2018-06-01 10:08:53 -0400 | [diff] [blame] | 74 | dst = api.vars.swarming_out_dir.join('ParentRevision') |
Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 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) |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 80 | finally: |
| 81 | if 'Win' in api.vars.builder_cfg.get('os', ''): |
| 82 | api.python.inline( |
| 83 | name='cleanup', |
| 84 | program='''import psutil |
| 85 | for 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 | |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 94 | api.run.check_failure() |
| 95 | |
| 96 | |
Eric Boren | f9aa9e5 | 2017-04-10 09:56:10 -0400 | [diff] [blame] | 97 | TEST_BUILDERS = [ |
Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 98 | 'Build-Debian9-Clang-universal-devrel-Android_SKQP', |
Eric Boren | 86a1146 | 2018-02-22 10:03:56 -0500 | [diff] [blame] | 99 | 'Build-Debian9-Clang-x86_64-Release-NoDEPS', |
Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 100 | 'Build-Debian9-Clang-x86_64-Release-ParentRevision', |
Ben Wagner | 6e0a6b3 | 2017-09-26 14:11:15 -0400 | [diff] [blame] | 101 | 'Build-Debian9-GCC-x86_64-Release-Flutter_Android', |
Eric Boren | 4184608 | 2018-05-30 14:36:03 -0400 | [diff] [blame] | 102 | 'Build-Mac-Clang-x86_64-Debug-CommandBuffer', |
Ben Wagner | 2a5931e | 2018-03-20 17:13:32 -0400 | [diff] [blame] | 103 | 'Build-Win-Clang-x86-Debug', |
Eric Boren | f9aa9e5 | 2017-04-10 09:56:10 -0400 | [diff] [blame] | 104 | ] |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 105 | |
| 106 | |
| 107 | def GenTests(api): |
Eric Boren | f9aa9e5 | 2017-04-10 09:56:10 -0400 | [diff] [blame] | 108 | for builder in TEST_BUILDERS: |
| 109 | test = ( |
| 110 | api.test(builder) + |
| 111 | api.properties(buildername=builder, |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 112 | repository='https://skia.googlesource.com/skia.git', |
| 113 | revision='abc123', |
| 114 | path_config='kitchen', |
Eric Boren | f9aa9e5 | 2017-04-10 09:56:10 -0400 | [diff] [blame] | 115 | swarm_out_dir='[SWARM_OUT_DIR]') + |
Eric Boren | 4c7754c | 2017-04-10 08:19:10 -0400 | [diff] [blame] | 116 | api.path.exists( |
| 117 | api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt') |
Eric Boren | f9aa9e5 | 2017-04-10 09:56:10 -0400 | [diff] [blame] | 118 | ) |
| 119 | ) |
Kevin Lubick | fe079d4 | 2017-04-12 08:31:48 -0400 | [diff] [blame] | 120 | yield test |