| 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 compiling Skia when the checkout has already been done |
| 7 |
# (e.g. repo brought in via CAS) |
| 8 |
|
| 9 |
|
| 10 |
DEPS = [ |
| 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/step', |
| 20 |
'run', |
| 21 |
'vars', |
| 22 |
] |
| 23 |
|
| 24 |
import hashlib |
| 25 |
|
| 26 |
def RunSteps(api): |
| 27 |
api.vars.setup() |
| 28 |
|
| 29 |
checkout_root = api.path.start_dir |
| 30 |
|
| 31 |
# We changed the names of these paths. To reduce disk space from the old |
| 32 |
# paths, we'll try to delete them as we go. |
| 33 |
old_path = api.vars.cache_dir.joinpath( |
| 34 |
'work', 'skia', 'out', api.vars.builder_name) |
| 35 |
# If the folder does not exist, this returns without error. |
| 36 |
# //skia/infra/bots/.recipe_deps/recipe_engine/recipe_modules/file/api.py |
| 37 |
api.file.rmtree('delete old caches %s' % old_path, old_path) |
| 38 |
|
| 39 |
# Use a shortened output directory path to avoid hitting path length |
| 40 |
# limits on Windows (250 chars) |
| 41 |
long_name = api.vars.builder_name + api.vars.configuration |
| 42 |
short_name = hashlib.md5(long_name.encode('utf-8')).hexdigest()[:6] |
| 43 |
out_dir = api.vars.cache_dir.joinpath( |
| 44 |
'work', 'skia', 'out', short_name) |
| 45 |
|
| 46 |
try: |
| 47 |
api.build(checkout_root=checkout_root, out_dir=out_dir) |
| 48 |
|
| 49 |
# TODO(borenet): Move this out of the try/finally. |
| 50 |
dst = api.vars.swarming_out_dir |
| 51 |
api.build.copy_build_products(out_dir=out_dir, dst=dst) |
| 52 |
finally: |
| 53 |
if 'Win' in api.vars.builder_cfg.get('os', ''): |
| 54 |
script = api.build.resource('cleanup_win_processes.py') |
| 55 |
api.step( |
| 56 |
name='cleanup', |
| 57 |
cmd=['vpython3', script], |
| 58 |
infra_step=True) |
| 59 |
|
| 60 |
api.run.check_failure() |
| 61 |
|
| 62 |
|
| 63 |
TEST_BUILDERS = [ |
| 64 |
'Build-Win-Clang-x86-Debug', |
| 65 |
] |
| 66 |
|
| 67 |
|
| 68 |
def GenTests(api): |
| 69 |
for builder in TEST_BUILDERS: |
| 70 |
test = ( |
| 71 |
api.test(builder) + |
| 72 |
api.properties(buildername=builder, |
| 73 |
repository='https://skia.googlesource.com/skia.git', |
| 74 |
revision='abc123', |
| 75 |
path_config='kitchen', |
| 76 |
swarm_out_dir='[SWARM_OUT_DIR]') |
| 77 |
) |
| 78 |
if 'Win' in builder: |
| 79 |
test += api.platform('win', 64) |
| 80 |
yield test |