1# Copyright 2017 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
6DEPS = [
7  'checkout',
8  'recipe_engine/file',
9  'recipe_engine/path',
10  'recipe_engine/platform',
11  'recipe_engine/properties',
12  'run',
13  'vars',
14]
15
16
17def RunSteps(api):
18  api.vars.setup()
19
20  bot_update = True
21  if 'NoDEPS' in api.properties['buildername']:
22    bot_update = False
23
24  checkout_root = api.checkout.default_checkout_root
25  checkout_chromium = False
26  checkout_flutter = False
27  extra_gclient_env = {}
28  flutter_android = False
29  if 'CommandBuffer' in api.vars.builder_name:
30    checkout_chromium = True
31  if 'RecreateSKPs' in api.vars.builder_name:
32    checkout_chromium = True
33    extra_gclient_env['CPPFLAGS'] = (
34        '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1')
35  if 'Flutter' in api.vars.builder_name:
36    checkout_root = checkout_root.join('flutter')
37    checkout_flutter = True
38    if 'Android' in api.vars.builder_name:
39      flutter_android = True
40
41  if bot_update:
42    api.checkout.bot_update(
43        checkout_root=checkout_root,
44        checkout_chromium=checkout_chromium,
45        checkout_flutter=checkout_flutter,
46        extra_gclient_env=extra_gclient_env,
47        flutter_android=flutter_android)
48  else:
49    api.checkout.git(checkout_root=api.path['start_dir'])
50  api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir)
51
52
53TEST_BUILDERS = [
54  'Build-Mac-Clang-x86_64-Debug-CommandBuffer',
55  'Housekeeper-Weekly-RecreateSKPs',
56]
57
58
59def GenTests(api):
60  for buildername in TEST_BUILDERS:
61    test = (
62        api.test(buildername) +
63        api.properties(buildername=buildername,
64                       repository='https://skia.googlesource.com/skia.git',
65                       revision='abc123',
66                       path_config='kitchen',
67                       swarm_out_dir='[SWARM_OUT_DIR]')
68    )
69    yield test
70
71  buildername = 'Build-Debian10-Clang-arm-Release-Flutter_Android'
72  yield (
73      api.test('flutter_trybot') +
74      api.properties(
75          repository='https://skia.googlesource.com/skia.git',
76          buildername=buildername,
77          path_config='kitchen',
78          swarm_out_dir='[SWARM_OUT_DIR]',
79          revision='abc123',
80          patch_issue=456789,
81          patch_set=12,
82          patch_ref='refs/changes/89/456789/12',
83          patch_repo='https://skia.googlesource.com/skia.git',
84          patch_storage='gerrit') +
85      api.path.exists(
86          api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
87      )
88  )
89
90  builder = 'Build-Debian10-Clang-x86_64-Release-NoDEPS'
91  yield (
92      api.test(builder) +
93      api.properties(buildername=builder,
94                     repository='https://skia.googlesource.com/skia.git',
95                     revision='abc123',
96                     path_config='kitchen',
97                     swarm_out_dir='[SWARM_OUT_DIR]',
98                     patch_issue=456789,
99                     patch_set=12,
100                     patch_ref='refs/changes/89/456789/12',
101                     patch_repo='https://skia.googlesource.com/skia.git',
102                     patch_storage='gerrit') +
103      api.path.exists(api.path['start_dir'].join('skp_output'))
104  )
105
106  buildername = 'Build-Debian10-Clang-x86_64-Release'
107  yield (
108      api.test('cross_repo_trybot') +
109      api.properties(
110          repository='https://skia.googlesource.com/parent_repo.git',
111          buildername=buildername,
112          path_config='kitchen',
113          swarm_out_dir='[SWARM_OUT_DIR]',
114          revision='abc123',
115          patch_issue=456789,
116          patch_set=12,
117          patch_ref='refs/changes/89/456789/12',
118          patch_repo='https://skia.googlesource.com/skia.git',
119          patch_storage='gerrit') +
120      api.path.exists(
121          api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
122      )
123  )
124  yield (
125      api.test('trybot') +
126      api.properties(buildername=buildername,
127                     repository='https://skia.googlesource.com/skia.git',
128                     revision='abc123',
129                     path_config='kitchen',
130                     patch_issue=456789,
131                     patch_set=12,
132                     patch_ref='refs/changes/89/456789/12',
133                     patch_repo='https://skia.googlesource.com/skia.git',
134                     patch_storage='gerrit',
135                     swarm_out_dir='[SWARM_OUT_DIR]')
136  )
137