1# Copyright 2019 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 5DOCKER_IMAGE = 'gcr.io/skia-public/cmake-release:3.13.1_v2' 6INNER_BUILD_SCRIPT = '/SRC/skia/infra/cmake/build_skia.sh' 7 8 9def compile_fn(api, checkout_root, _ignore): 10 out_dir = api.vars.cache_dir.join('docker', 'cmake') 11 configuration = api.vars.builder_cfg.get('configuration', '') 12 if configuration != 'Release': # pragma: nocover 13 # If a debug mode is wanted, update the infra/cmake/build_skia.sh 14 # to support that also. 15 raise 'Only Release mode supported for CMake' 16 17 # We want to make sure the directories exist and were created by chrome-bot, 18 # because if that isn't the case, docker will make them and they will be 19 # owned by root, which causes mysterious failures. To mitigate this risk 20 # further, we don't use the same out_dir as everyone else (thus the _ignore) 21 # param. Instead, we use a "cmake" subdirectory in the "docker" named_cache. 22 api.file.ensure_directory('mkdirs out_dir', out_dir, mode=0777) 23 24 # This uses the cmake docker image and says "run the 25 # build_skia.sh helper script in there". Additionally, it binds two 26 # folders: the Skia checkout to /SRC and the output directory to /OUT 27 # The called helper script will make the compile happen and put the 28 # output in the right spot. The neat thing is that since the Skia checkout 29 # (and, by extension, the build script) is not a part of the image, but 30 # bound in at runtime, we don't have to re-build the image, except when the 31 # toolchain changes. 32 cmd = ['docker', 'run', '--rm', '--volume', '%s:/SRC' % checkout_root, 33 '--volume', '%s:/OUT' % out_dir, 34 DOCKER_IMAGE, INNER_BUILD_SCRIPT] 35 # It's always Release mode (for now?) This is mostly an FYI 36 # thing, to make sure we don't break CMake users. 37 38 # Override DOCKER_CONFIG set by Kitchen. 39 env = {'DOCKER_CONFIG': '/home/chrome-bot/.docker'} 40 with api.env(env): 41 api.run( 42 api.step, 43 'Build Skia using CMake in Docker', 44 cmd=cmd) 45 46def copy_extra_build_products(_api, _src, _dst): 47 pass 48