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, custom_deps=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 custom_deps: An optional dictionary specifying custom dependencies. |
| 49 This should be of the form: |
| 50 |
| 51 { |
| 52 'dependency_name': { |
| 53 'platform': 'path', |
| 54 ... |
| 55 }, |
| 56 ... |
| 57 } |
| 58 """ |
| 59 |
| 60 devil_dynamic_deps = {} |
| 61 |
| 62 if output_directory: |
| 63 for dep_name, arch_dict in _DEVIL_BUILD_PRODUCT_DEPS.iteritems(): |
| 64 devil_dynamic_deps[dep_name] = {} |
| 65 for arch, name in arch_dict.iteritems(): |
| 66 devil_dynamic_deps[dep_name][arch] = os.path.join( |
| 67 output_directory, name) |
| 68 |
| 69 devil_dynamic_config = { |
| 70 'config_type': 'BaseConfig', |
| 71 'dependencies': { |
| 72 dep_name: { |
| 73 'file_info': { |
| 74 'android_%s' % arch: { |
| 75 'local_paths': [path] |
| 76 } |
| 77 for arch, path in arch_dict.iteritems() |
| 78 } |
| 79 } |
| 80 for dep_name, arch_dict in devil_dynamic_deps.iteritems() |
| 81 } |
| 82 } |
| 83 if custom_deps: |
| 84 devil_dynamic_config['dependencies'].update(custom_deps) |
| 85 |
| 86 devil_env.config.Initialize( |
| 87 configs=[devil_dynamic_config], config_files=[_DEVIL_CONFIG]) |
| 88 |
OLD | NEW |