Flutter Engine
The Flutter Engine
Functions | Variables
build.util Namespace Reference

Functions

def py_to_gn (val)
 
def copy_listed_files (api, src, dst, product_list)
 
def set_dawn_args_and_env (args, env, api, extra_tokens, skia_dir)
 

Variables

list DEFAULT_BUILD_PRODUCTS
 

Function Documentation

◆ copy_listed_files()

def build.util.copy_listed_files (   api,
  src,
  dst,
  product_list 
)
Copy listed files src to dst.

Definition at line 44 of file util.py.

44def copy_listed_files(api, src, dst, product_list):
45 """Copy listed files src to dst."""
46 script = api.build.resource('copy_build_products.py')
47 api.step(
48 name='copy build products',
49 cmd=['python3', script, src, dst, ','.join(product_list)],
50 infra_step=True)
51
52
def copy_listed_files(api, src, dst, product_list)
Definition: util.py:44
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ py_to_gn()

def build.util.py_to_gn (   val)
Convert val to a string that can be used as GN args.

Definition at line 27 of file util.py.

27def py_to_gn(val):
28 """Convert val to a string that can be used as GN args."""
29 if isinstance(val, bool):
30 return 'true' if val else 'false'
31 elif '%s' % val == val:
32 # TODO(dogben): Handle quoting "$\
33 return '"%s"' % val
34 elif isinstance(val, (list, tuple)):
35 return '[%s]' % (','.join(py_to_gn(x) for x in val))
36 elif isinstance(val, dict):
37 gn = ' '.join(
38 '%s=%s' % (k, py_to_gn(v)) for (k, v) in sorted(val.items()))
39 return gn
40 else: # pragma: nocover
41 raise Exception('Converting %s to gn is not implemented.' % type(val))
42
43
GLenum type
def py_to_gn(val)
Definition: util.py:27

◆ set_dawn_args_and_env()

def build.util.set_dawn_args_and_env (   args,
  env,
  api,
  extra_tokens,
  skia_dir 
)
Add to ``args`` and ``env`` the gn args and environment vars needed to
make a build targeting Dawn.

Definition at line 53 of file util.py.

53def set_dawn_args_and_env(args, env, api, extra_tokens, skia_dir):
54 """Add to ``args`` and ``env`` the gn args and environment vars needed to
55 make a build targeting Dawn."""
56 args['skia_use_dawn'] = 'true'
57 args['skia_use_gl'] = 'false'
58 # Set dawn specific args to limit which backends are built
59 args['dawn_enable_d3d11'] = 'false'
60 args['dawn_enable_d3d12'] = 'false'
61 args['dawn_enable_metal'] = 'false'
62 args['dawn_enable_desktop_gl'] = 'false'
63 args['dawn_enable_opengles'] = 'false'
64 args['dawn_enable_vulkan'] = 'false'
65 if 'D3D11' in extra_tokens:
66 args['dawn_enable_d3d11'] = 'true'
67 if 'D3D12' in extra_tokens:
68 args['dawn_enable_d3d12'] = 'true'
69 if 'Metal' in extra_tokens:
70 args['dawn_enable_metal'] = 'true'
71 if 'Vulkan' in extra_tokens:
72 args['dawn_enable_vulkan'] = 'true'
73 env['PYTHONPATH'] = api.path.pathsep.join([
74 str(skia_dir.join('third_party', 'externals')), '%%(PYTHONPATH)s'])
def set_dawn_args_and_env(args, env, api, extra_tokens, skia_dir)
Definition: util.py:53

Variable Documentation

◆ DEFAULT_BUILD_PRODUCTS

list build.util.DEFAULT_BUILD_PRODUCTS
Initial value:
1= [
2 'dm',
3 'dm.exe',
4 'dm.app',
5 'nanobench.app',
6 'get_images_from_skps',
7 'get_images_from_skps.exe',
8 'nanobench',
9 'nanobench.exe',
10 '*.so',
11 '*.dll',
12 '*.dylib',
13 'skottie_tool',
14 'lib/*.so',
15 'run_testlab',
16]

Definition at line 10 of file util.py.