OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Configures devil for use in chromium.""" | 5 """Configures devil for use in chromium.""" |
6 | 6 |
7 import os | 7 import os |
8 | 8 |
9 from devil import devil_env | 9 from devil import devil_env |
10 | 10 |
11 | 11 |
12 _DEVIL_CONFIG = os.path.abspath( | 12 _DEVIL_CONFIG = os.path.abspath( |
13 os.path.join(os.path.dirname(__file__), 'devil_chromium.json')) | 13 os.path.join(os.path.dirname(__file__), 'devil_chromium.json')) |
14 | 14 |
15 _DEVIL_BUILD_PRODUCT_DEPS = { | 15 _DEVIL_BUILD_PRODUCT_DEPS = { |
16 'forwarder_device': { | 16 'forwarder_device': [ |
17 'armeabi-v7a': 'forwarder_dist', | 17 { |
18 'arm64-v8a': 'forwarder_dist', | 18 'platform': 'android', |
19 'mips': 'forwarder_dist', | 19 'arch': 'armeabi-v7a', |
20 'mips64': 'forwarder_dist', | 20 'name': 'forwarder_dist', |
21 'x86': 'forwarder_dist', | 21 }, |
22 'x86_64': 'forwarder_dist', | 22 { |
23 }, | 23 'platform': 'android', |
24 'forwarder_host': { | 24 'arch': 'arm64-v8a', |
25 'any': 'host_forwarder', | 25 'name': 'forwarder_dist', |
26 }, | 26 }, |
27 'md5sum_device': { | 27 { |
28 'armeabi-v7a': 'md5sum_dist', | 28 'platform': 'android', |
29 'arm64-v8a': 'md5sum_dist', | 29 'arch': 'mips', |
30 'mips': 'md5sum_dist', | 30 'name': 'forwarder_dist', |
31 'mips64': 'md5sum_dist', | 31 }, |
32 'x86': 'md5sum_dist', | 32 { |
33 'x86_64': 'md5sum_dist', | 33 'platform': 'android', |
34 }, | 34 'arch': 'mips64', |
35 'md5sum_host': { | 35 'name': 'forwarder_dist', |
36 'any': 'md5sum_bin_host', | 36 }, |
37 }, | 37 { |
| 38 'platform': 'android', |
| 39 'arch': 'x86', |
| 40 'name': 'forwarder_dist', |
| 41 }, |
| 42 { |
| 43 'platform': 'android', |
| 44 'arch': 'x86_64', |
| 45 'name': 'forwarder_dist', |
| 46 }, |
| 47 ], |
| 48 'forwarder_host': [ |
| 49 { |
| 50 'platform': 'linux', |
| 51 'arch': 'x86_64', |
| 52 'name': 'host_forwarder', |
| 53 }, |
| 54 ], |
| 55 'md5sum_device': [ |
| 56 { |
| 57 'platform': 'android', |
| 58 'arch': 'armeabi-v7a', |
| 59 'name': 'md5sum_dist', |
| 60 }, |
| 61 { |
| 62 'platform': 'android', |
| 63 'arch': 'arm64-v8a', |
| 64 'name': 'md5sum_dist', |
| 65 }, |
| 66 { |
| 67 'platform': 'android', |
| 68 'arch': 'mips', |
| 69 'name': 'md5sum_dist', |
| 70 }, |
| 71 { |
| 72 'platform': 'android', |
| 73 'arch': 'mips64', |
| 74 'name': 'md5sum_dist', |
| 75 }, |
| 76 { |
| 77 'platform': 'android', |
| 78 'arch': 'x86', |
| 79 'name': 'md5sum_dist', |
| 80 }, |
| 81 { |
| 82 'platform': 'android', |
| 83 'arch': 'x86_64', |
| 84 'name': 'md5sum_dist', |
| 85 }, |
| 86 ], |
| 87 'md5sum_host': [ |
| 88 { |
| 89 'platform': 'linux', |
| 90 'arch': 'x86_64', |
| 91 'name': 'md5sum_bin_host', |
| 92 }, |
| 93 ], |
38 } | 94 } |
39 | 95 |
40 | 96 |
41 def Initialize(output_directory=None, custom_deps=None): | 97 def Initialize(output_directory=None, custom_deps=None): |
42 """Initializes devil with chromium's binaries and third-party libraries. | 98 """Initializes devil with chromium's binaries and third-party libraries. |
43 | 99 |
44 This includes: | 100 This includes: |
45 - Libraries: | 101 - Libraries: |
46 - the android SDK ("android_sdk") | 102 - the android SDK ("android_sdk") |
47 - pymock ("pymock") | 103 - pymock ("pymock") |
(...skipping 10 matching lines...) Expand all Loading... |
58 | 114 |
59 { | 115 { |
60 'dependency_name': { | 116 'dependency_name': { |
61 'platform': 'path', | 117 'platform': 'path', |
62 ... | 118 ... |
63 }, | 119 }, |
64 ... | 120 ... |
65 } | 121 } |
66 """ | 122 """ |
67 | 123 |
68 devil_dynamic_deps = {} | |
69 | |
70 if output_directory: | |
71 for dep_name, arch_dict in _DEVIL_BUILD_PRODUCT_DEPS.iteritems(): | |
72 devil_dynamic_deps[dep_name] = {} | |
73 for arch, name in arch_dict.iteritems(): | |
74 devil_dynamic_deps[dep_name][arch] = os.path.join( | |
75 output_directory, name) | |
76 | |
77 devil_dynamic_config = { | 124 devil_dynamic_config = { |
78 'config_type': 'BaseConfig', | 125 'config_type': 'BaseConfig', |
79 'dependencies': { | 126 'dependencies': {}, |
| 127 } |
| 128 if output_directory: |
| 129 devil_dynamic_config['dependencies'] = { |
80 dep_name: { | 130 dep_name: { |
81 'file_info': { | 131 'file_info': { |
82 'android_%s' % arch: { | 132 '%s_%s' % (dep_config['platform'], dep_config['arch']): { |
83 'local_paths': [path] | 133 'local_paths': [ |
| 134 os.path.join(output_directory, dep_config['name']), |
| 135 ], |
84 } | 136 } |
85 for arch, path in arch_dict.iteritems() | 137 for dep_config in dep_configs |
86 } | 138 } |
87 } | 139 } |
88 for dep_name, arch_dict in devil_dynamic_deps.iteritems() | 140 for dep_name, dep_configs in _DEVIL_BUILD_PRODUCT_DEPS.iteritems() |
89 } | 141 } |
90 } | |
91 if custom_deps: | 142 if custom_deps: |
92 devil_dynamic_config['dependencies'].update(custom_deps) | 143 devil_dynamic_config['dependencies'].update(custom_deps) |
93 | 144 |
94 devil_env.config.Initialize( | 145 devil_env.config.Initialize( |
95 configs=[devil_dynamic_config], config_files=[_DEVIL_CONFIG]) | 146 configs=[devil_dynamic_config], config_files=[_DEVIL_CONFIG]) |
96 | 147 |
OLD | NEW |