1cb93a386Sopenharmony_ci# Copyright 2014 The Chromium Authors. All rights reserved.
2cb93a386Sopenharmony_ci# Use of this source code is governed by a BSD-style license that can be
3cb93a386Sopenharmony_ci# found in the LICENSE file.
4cb93a386Sopenharmony_ci
5cb93a386Sopenharmony_ci
6cb93a386Sopenharmony_ci# Recipe for the Skia PerCommit Housekeeper.
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci
9cb93a386Sopenharmony_ciimport calendar
10cb93a386Sopenharmony_ci
11cb93a386Sopenharmony_ciPYTHON_VERSION_COMPATIBILITY = "PY2+3"
12cb93a386Sopenharmony_ci
13cb93a386Sopenharmony_ciDEPS = [
14cb93a386Sopenharmony_ci  'checkout',
15cb93a386Sopenharmony_ci  'doxygen',
16cb93a386Sopenharmony_ci  'recipe_engine/file',
17cb93a386Sopenharmony_ci  'recipe_engine/path',
18cb93a386Sopenharmony_ci  'recipe_engine/properties',
19cb93a386Sopenharmony_ci  'run',
20cb93a386Sopenharmony_ci  'vars',
21cb93a386Sopenharmony_ci]
22cb93a386Sopenharmony_ci
23cb93a386Sopenharmony_ci
24cb93a386Sopenharmony_cidef RunSteps(api):
25cb93a386Sopenharmony_ci  # Checkout, compile, etc.
26cb93a386Sopenharmony_ci  api.vars.setup()
27cb93a386Sopenharmony_ci  checkout_root = api.checkout.default_checkout_root
28cb93a386Sopenharmony_ci  api.checkout.bot_update(checkout_root=checkout_root)
29cb93a386Sopenharmony_ci  api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir)
30cb93a386Sopenharmony_ci
31cb93a386Sopenharmony_ci  # TODO(borenet): Detect static initializers?
32cb93a386Sopenharmony_ci
33cb93a386Sopenharmony_ci  skia_dir = checkout_root.join('skia')
34cb93a386Sopenharmony_ci  if not api.vars.is_trybot:
35cb93a386Sopenharmony_ci    api.doxygen.generate_and_upload(skia_dir)
36cb93a386Sopenharmony_ci
37cb93a386Sopenharmony_ci
38cb93a386Sopenharmony_cidef GenTests(api):
39cb93a386Sopenharmony_ci  yield (
40cb93a386Sopenharmony_ci      api.test('Housekeeper-PerCommit') +
41cb93a386Sopenharmony_ci      api.properties(buildername='Housekeeper-PerCommit',
42cb93a386Sopenharmony_ci                     repository='https://skia.googlesource.com/skia.git',
43cb93a386Sopenharmony_ci                     revision='abc123',
44cb93a386Sopenharmony_ci                     path_config='kitchen',
45cb93a386Sopenharmony_ci                     swarm_out_dir='[SWARM_OUT_DIR]') +
46cb93a386Sopenharmony_ci      api.path.exists(api.path['start_dir'])
47cb93a386Sopenharmony_ci  )
48cb93a386Sopenharmony_ci  yield (
49cb93a386Sopenharmony_ci      api.test('Housekeeper-PerCommit-Trybot') +
50cb93a386Sopenharmony_ci      api.properties(buildername='Housekeeper-PerCommit',
51cb93a386Sopenharmony_ci                     repository='https://skia.googlesource.com/skia.git',
52cb93a386Sopenharmony_ci                     revision='abc123',
53cb93a386Sopenharmony_ci                     path_config='kitchen',
54cb93a386Sopenharmony_ci                     patch_issue='456789',
55cb93a386Sopenharmony_ci                     patch_set='11',
56cb93a386Sopenharmony_ci                     patch_ref='refs/changes/89/456789/12',
57cb93a386Sopenharmony_ci                     patch_repo='https://skia.googlesource.com/skia.git',
58cb93a386Sopenharmony_ci                     patch_storage='gerrit',
59cb93a386Sopenharmony_ci                     swarm_out_dir='[SWARM_OUT_DIR]') +
60cb93a386Sopenharmony_ci      api.path.exists(api.path['start_dir'])
61cb93a386Sopenharmony_ci  )
62