• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
8PYTHON_VERSION_COMPATIBILITY = "PY2+3"
9
10DEPS = [
11  'build',
12  'checkout',
13  'recipe_engine/context',
14  'recipe_engine/file',
15  'recipe_engine/json',
16  'recipe_engine/path',
17  'recipe_engine/platform',
18  'recipe_engine/properties',
19  'recipe_engine/python',
20  'recipe_engine/step',
21  'run',
22  'vars',
23]
24
25
26def RunSteps(api):
27  api.vars.setup()
28
29  # Check out code.
30  bot_update = True
31  checkout_root = api.checkout.default_checkout_root
32  checkout_chromium = False
33  checkout_flutter = False
34  flutter_android = False
35
36  if 'NoDEPS' in api.properties['buildername']:
37    bot_update = False
38    checkout_root = api.path['start_dir']
39  if 'CommandBuffer' in api.vars.builder_name:
40    checkout_chromium = True
41  if 'Flutter' in api.vars.builder_name:
42    checkout_root = checkout_root.join('flutter')
43    checkout_flutter = True
44    if 'Android' in api.vars.builder_name:
45      flutter_android = True
46
47  if bot_update:
48    api.checkout.bot_update(
49        checkout_root=checkout_root,
50        checkout_chromium=checkout_chromium,
51        checkout_flutter=checkout_flutter,
52        flutter_android=flutter_android)
53  else:
54    api.checkout.git(checkout_root=checkout_root)
55
56  api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir)
57
58  out_dir = checkout_root.join(
59      'skia', 'out', api.vars.builder_name, api.vars.configuration)
60  if 'Flutter' in api.vars.builder_name:
61    out_dir = checkout_root.join('src', 'out', 'android_release')
62
63  try:
64    api.build(checkout_root=checkout_root, out_dir=out_dir)
65
66    # TODO(borenet): Move this out of the try/finally.
67    dst = api.vars.swarming_out_dir
68    api.build.copy_build_products(out_dir=out_dir, dst=dst)
69  finally:
70    if 'Win' in api.vars.builder_cfg.get('os', ''):
71      api.python.inline(
72          name='cleanup',
73          program='''
74# [VPYTHON:BEGIN]
75# wheel: <
76#  name: "infra/python/wheels/psutil/${vpython_platform}"
77#  version: "version:5.4.7"
78# >
79# [VPYTHON:END]
80
81import psutil
82for p in psutil.process_iter():
83  try:
84    if p.name in ('mspdbsrv.exe', 'vctip.exe', 'cl.exe', 'link.exe'):
85      p.kill()
86  except psutil._error.AccessDenied:
87    pass
88''',
89          infra_step=True,
90          venv=True)
91
92  api.run.check_failure()
93
94
95TEST_BUILDERS = [
96  'Build-Debian10-Clang-arm-Release-Flutter_Android',
97  'Build-Mac-Clang-x86_64-Debug-CommandBuffer',
98  'Build-Win10-Clang-x86_64-Release-NoDEPS',
99]
100
101
102def GenTests(api):
103  for builder in TEST_BUILDERS:
104    test = (
105      api.test(builder) +
106      api.properties(buildername=builder,
107                     repository='https://skia.googlesource.com/skia.git',
108                     revision='abc123',
109                     path_config='kitchen',
110                     swarm_out_dir='[SWARM_OUT_DIR]') +
111      api.path.exists(
112          api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
113      )
114    )
115    if 'Win' in builder:
116      test += api.platform('win', 64)
117    yield test
118