OLD | NEW |
| (Empty) |
1 # Copyright 2015 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 """Configures devil for use in chromium.""" | |
6 | |
7 import os | |
8 | |
9 from devil import devil_env | |
10 | |
11 | |
12 _DEVIL_CONFIG = os.path.abspath( | |
13 os.path.join(os.path.dirname(__file__), 'devil_chromium.json')) | |
14 | |
15 _DEVIL_BUILD_PRODUCT_DEPS = { | |
16 'forwarder_device': { | |
17 'armeabi-v7a': 'forwarder_dist', | |
18 'arm64-v8a': 'forwarder_dist', | |
19 }, | |
20 'forwarder_host': { | |
21 'any': 'host_forwarder', | |
22 }, | |
23 'md5sum_device': { | |
24 'armeabi-v7a': 'md5sum_dist', | |
25 'arm64-v8a': 'md5sum_dist', | |
26 }, | |
27 'md5sum_host': { | |
28 'any': 'md5sum_bin_host', | |
29 }, | |
30 } | |
31 | |
32 | |
33 def Initialize(output_directory=None): | |
34 """Initializes devil with chromium's binaries and third-party libraries. | |
35 | |
36 This includes: | |
37 - Libraries: | |
38 - the android SDK ("android_sdk") | |
39 - pymock ("pymock") | |
40 - Build products: | |
41 - host & device forwarder binaries | |
42 ("forwarder_device" and "forwarder_host") | |
43 - host & device md5sum binaries ("md5sum_device" and "md5sum_host") | |
44 | |
45 Args: | |
46 output_directory: An optional path to the output directory. If not set, | |
47 no built dependencies are configured. | |
48 """ | |
49 | |
50 devil_dynamic_deps = {} | |
51 | |
52 if output_directory: | |
53 for dep_name, arch_dict in _DEVIL_BUILD_PRODUCT_DEPS.iteritems(): | |
54 devil_dynamic_deps[dep_name] = {} | |
55 for arch, name in arch_dict.iteritems(): | |
56 devil_dynamic_deps[dep_name][arch] = os.path.join( | |
57 output_directory, name) | |
58 | |
59 devil_dynamic_config = { | |
60 'config_type': 'BaseConfig', | |
61 'dependencies': { | |
62 dep_name: { | |
63 'file_info': { | |
64 'android_%s' % arch: { | |
65 'local_paths': [path] | |
66 } | |
67 for arch, path in arch_dict.iteritems() | |
68 } | |
69 } | |
70 for dep_name, arch_dict in devil_dynamic_deps.iteritems() | |
71 } | |
72 } | |
73 | |
74 devil_env.config.Initialize( | |
75 configs=[devil_dynamic_config], config_files=[_DEVIL_CONFIG]) | |
76 | |
OLD | NEW |