Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
docker.py
Go to the documentation of this file.
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
5
6from . import util
7
8IMAGES = {
9 'gcc-debian11': (
10 'gcr.io/skia-public/gcc-debian11@sha256:'
11 '1117ea368f43e45e0f543f74c8e3bf7ff6932df54ddaa4ba1fe6131209110d3d'),
12 'gcc-debian11-x86': (
13 'gcr.io/skia-public/gcc-debian11-x86@sha256:'
14 'eb30682887c4c74c95f769aacab8a1a170eb561536ded87f0914f88b7243ba23'),
15}
16
17
18def compile_fn(api, checkout_root, out_dir):
19 compiler = api.vars.builder_cfg.get('compiler', '')
20 configuration = api.vars.builder_cfg.get('configuration', '')
21 extra_tokens = api.vars.extra_tokens
22 extra_tokens.remove('Docker')
23 os = api.vars.builder_cfg.get('os', '')
24 target_arch = api.vars.builder_cfg.get('target_arch', '')
25
26 args = {
27 'extra_cflags': [],
28 'extra_ldflags': [],
29 'target_cpu': target_arch,
30 'werror': True
31 }
32
33 if configuration == 'Debug':
34 args['extra_cflags'].append('-O1')
35 else:
36 args['is_debug'] = False
37
38 if 'NoGPU' in extra_tokens:
39 args['skia_enable_ganesh'] = False
40 extra_tokens.remove('NoGPU')
41 if 'Shared' in extra_tokens:
42 args['is_component_build'] = True
43 extra_tokens.remove('Shared')
44
45 image_name = None
46 if os == 'Debian11' and compiler == 'GCC' and not extra_tokens:
47 args['cc'] = 'gcc'
48 args['cxx'] = 'g++'
49 # Newer GCC includes tons and tons of debugging symbols. This seems to
50 # negatively affect our bots (potentially only in combination with other
51 # bugs in Swarming or recipe code). Use g1 to reduce it a bit.
52 args['extra_cflags'].append('-g1')
53 if target_arch == 'x86_64':
54 image_name = 'gcc-debian11'
55 elif target_arch == 'x86':
56 image_name = 'gcc-debian11-x86'
57
58 if not image_name:
59 raise Exception('Not implemented: ' + api.vars.builder_name)
60
61 image_hash = IMAGES[image_name]
62 # We always perform an incremental compile, since out dir is cached across
63 # compile tasks. However, we need to force a recompile when the toolchain
64 # changes. The simplest way to do that is using a C define that changes
65 # anytime the image changes.
66 args['extra_cflags'].append('-DREBUILD_IF_CHANGED_docker_image=%s' % image_hash)
67
68 script = api.build.resource('docker-compile.sh')
69 api.docker.run('Run build script in Docker', image_hash,
70 checkout_root, out_dir, script, args=[util.py_to_gn(args)])
71
72def copy_build_products(api, src, dst):
73 util.copy_listed_files(api, src, dst, util.DEFAULT_BUILD_PRODUCTS)
static void append(char **dst, size_t *count, const char *src, size_t n)
Definition editor.cpp:211
compile_fn(api, checkout_root, out_dir)
Definition docker.py:18