blob: cea7af4648bfaec94b025ec11aa5a44313ddcc8a [file] [log] [blame]
borenet1ed2ae42016-07-26 11:52:17 -07001# 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 = [
Eric Boren9030b942018-05-14 12:50:38 -040010 'build',
Eric Boren90f05032018-05-24 09:14:18 -040011 'checkout',
Robert Iannucci297a7ef2017-05-12 19:09:38 -070012 'recipe_engine/context',
Eric Borenb7023162018-05-04 13:46:15 -040013 'recipe_engine/file',
Eric Boren4c7754c2017-04-10 08:19:10 -040014 'recipe_engine/json',
borenet1ed2ae42016-07-26 11:52:17 -070015 'recipe_engine/path',
16 'recipe_engine/platform',
17 'recipe_engine/properties',
Eric Boren4c7754c2017-04-10 08:19:10 -040018 'recipe_engine/python',
19 'recipe_engine/step',
Eric Boren4c7754c2017-04-10 08:19:10 -040020 'run',
21 'vars',
borenet1ed2ae42016-07-26 11:52:17 -070022]
23
24
borenet1ed2ae42016-07-26 11:52:17 -070025def RunSteps(api):
Eric Borenb7023162018-05-04 13:46:15 -040026 api.vars.setup()
27
28 # Check out code.
Eric Boren41846082018-05-30 14:36:03 -040029 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 Boren86a11462018-02-22 10:03:56 -050037 if 'NoDEPS' in api.properties['buildername']:
Eric Boren41846082018-05-30 14:36:03 -040038 bot_update = False
Eric Boren72f66682018-05-18 07:36:55 -040039 checkout_root = api.path['start_dir']
Eric Boren41846082018-05-30 14:36:03 -040040 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 Borenb7023162018-05-04 13:46:15 -040058 else:
Eric Boren41846082018-05-30 14:36:03 -040059 api.checkout.git(checkout_root=checkout_root)
Eric Boren72f66682018-05-18 07:36:55 -040060
Eric Borenb7023162018-05-04 13:46:15 -040061 api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir)
Eric Boren4c7754c2017-04-10 08:19:10 -040062
Eric Boren72f66682018-05-18 07:36:55 -040063 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 Boren4c7754c2017-04-10 08:19:10 -040068 try:
Eric Boren72f66682018-05-18 07:36:55 -040069 api.build(checkout_root=checkout_root, out_dir=out_dir)
70
71 # TODO(borenet): Move this out of the try/finally.
Eric Boren322a8592018-06-01 10:08:53 -040072 dst = api.vars.swarming_out_dir
Eric Boren72f66682018-05-18 07:36:55 -040073 if 'ParentRevision' in api.vars.builder_name:
Eric Boren322a8592018-06-01 10:08:53 -040074 dst = api.vars.swarming_out_dir.join('ParentRevision')
Eric Boren72f66682018-05-18 07:36:55 -040075 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 Boren4c7754c2017-04-10 08:19:10 -040080 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
Eric Boren4c7754c2017-04-10 08:19:10 -040094 api.run.check_failure()
95
96
Eric Borenf9aa9e52017-04-10 09:56:10 -040097TEST_BUILDERS = [
Eric Boren72f66682018-05-18 07:36:55 -040098 'Build-Debian9-Clang-universal-devrel-Android_SKQP',
Eric Boren86a11462018-02-22 10:03:56 -050099 'Build-Debian9-Clang-x86_64-Release-NoDEPS',
Eric Boren72f66682018-05-18 07:36:55 -0400100 'Build-Debian9-Clang-x86_64-Release-ParentRevision',
Ben Wagner6e0a6b32017-09-26 14:11:15 -0400101 'Build-Debian9-GCC-x86_64-Release-Flutter_Android',
Eric Boren41846082018-05-30 14:36:03 -0400102 'Build-Mac-Clang-x86_64-Debug-CommandBuffer',
Ben Wagner2a5931e2018-03-20 17:13:32 -0400103 'Build-Win-Clang-x86-Debug',
Eric Borenf9aa9e52017-04-10 09:56:10 -0400104]
borenet1ed2ae42016-07-26 11:52:17 -0700105
106
107def GenTests(api):
Eric Borenf9aa9e52017-04-10 09:56:10 -0400108 for builder in TEST_BUILDERS:
109 test = (
110 api.test(builder) +
111 api.properties(buildername=builder,
Eric Boren4c7754c2017-04-10 08:19:10 -0400112 repository='https://skia.googlesource.com/skia.git',
113 revision='abc123',
114 path_config='kitchen',
Eric Borenf9aa9e52017-04-10 09:56:10 -0400115 swarm_out_dir='[SWARM_OUT_DIR]') +
Eric Boren4c7754c2017-04-10 08:19:10 -0400116 api.path.exists(
117 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
Eric Borenf9aa9e52017-04-10 09:56:10 -0400118 )
119 )
Kevin Lubickfe079d42017-04-12 08:31:48 -0400120 yield test