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 from pylib import constants |
| 11 |
| 12 |
| 13 _DEVIL_CONFIG = os.path.abspath(os.path.dirname(__file__), |
| 14 'devil_chromium.json') |
| 15 |
| 16 |
| 17 def Initialize(output_directory=None, custom_deps=None): |
| 18 """Initializes devil with chromium's binaries and third-party libraries. |
| 19 |
| 20 This includes: |
| 21 - the android SDK ("android_sdk") |
| 22 - host & device forwarder binaries ("forwarder_device" and "forwarder_host") |
| 23 - host & device md5sum binaries ("md5sum_device" and "md5sum_host"), and |
| 24 - pymock ("pymock") |
| 25 |
| 26 Args: |
| 27 output_directory: An optional path to the output directory. If not set, |
| 28 defaults to out/<build type> (e.g., out/Debug) |
| 29 custom_deps: An optional dictionary containing dependencies that should |
| 30 be specified instead of or in addition |
| 31 """ |
| 32 |
| 33 if not output_directory: |
| 34 output_directory = constants.GetOutDirectory() |
| 35 |
| 36 output_binary = lambda p: os.path.join(output_directory, p) |
| 37 devil_dynamic_deps = { |
| 38 'forwarder_device': [output_binary('forwarder_dist')], |
| 39 'forwarder_host': [output_binary('host_forwarder')], |
| 40 'md5sum_device': [output_binary('md5sum_dist')], |
| 41 'md5sum_host': [output_binary('md5sum_bin_host')], |
| 42 } |
| 43 |
| 44 if custom_deps: |
| 45 devil_dynamic_deps.update(custom_deps) |
| 46 |
| 47 devil_dynamic_config = devil_env.GenerateDynamicConfig(devil_dynamic_deps) |
| 48 devil_env.config.Initialize(configs=[devil_dynamic_config], |
| 49 config_files=[_DEVIL_CONFIG]) |
| 50 |
OLD | NEW |