| Index: mojo/devtools/common/devtoolslib/paths.py
|
| diff --git a/mojo/devtools/common/devtoolslib/paths.py b/mojo/devtools/common/devtoolslib/paths.py
|
| index 3347c754fd86a8f78da3ba75b1b053ca6fb6f069..1b0bff4720377f99d12cccff02a14a385d13f090 100644
|
| --- a/mojo/devtools/common/devtoolslib/paths.py
|
| +++ b/mojo/devtools/common/devtoolslib/paths.py
|
| @@ -8,6 +8,7 @@ These functions allow devtools scripts to work out-of-the-box with regular Mojo
|
| checkouts.
|
| """
|
|
|
| +import collections
|
| import os.path
|
| import sys
|
|
|
| @@ -26,13 +27,13 @@ def find_ancestor_with(relpath):
|
| return None
|
|
|
|
|
| -def infer_mojo_paths(is_android, is_debug, target_cpu):
|
| - """Infers the locations of select build output artifacts in a regular Mojo
|
| - checkout.
|
| +def infer_paths(is_android, is_debug, target_cpu):
|
| + """Infers the locations of select build output artifacts in a regular
|
| + Chromium-like checkout. This should grow thinner or disappear as we introduce
|
| + per-repo config files, see https://github.com/domokit/devtools/issues/28.
|
|
|
| Returns:
|
| - Tuple of path dictionary, error message. Only one of the two will be
|
| - not-None.
|
| + Defaultdict with the inferred paths.
|
| """
|
| build_dir = (('android_' if is_android else '') +
|
| (target_cpu + '_' if target_cpu else '') +
|
| @@ -40,20 +41,19 @@ def infer_mojo_paths(is_android, is_debug, target_cpu):
|
| out_build_dir = os.path.join('out', build_dir)
|
|
|
| root_path = find_ancestor_with(out_build_dir)
|
| + paths = collections.defaultdict(lambda: None)
|
| if not root_path:
|
| - return None, ('Failed to find build directory: ' + out_build_dir)
|
| + return paths
|
|
|
| - paths = {}
|
| - paths['root'] = root_path
|
| build_dir_path = os.path.join(root_path, out_build_dir)
|
| - paths['build'] = build_dir_path
|
| + paths['build_dir_path'] = build_dir_path
|
| if is_android:
|
| - paths['shell'] = os.path.join(build_dir_path, 'apks', 'MojoShell.apk')
|
| - paths['adb'] = os.path.join(root_path, 'third_party', 'android_tools',
|
| + paths['shell_path'] = os.path.join(build_dir_path, 'apks', 'MojoShell.apk')
|
| + paths['adb_path'] = os.path.join(root_path, 'third_party', 'android_tools',
|
| 'sdk', 'platform-tools', 'adb')
|
| else:
|
| - paths['shell'] = os.path.join(build_dir_path, 'mojo_shell')
|
| - return paths, None
|
| + paths['shell_path'] = os.path.join(build_dir_path, 'mojo_shell')
|
| + return paths
|
|
|
|
|
| # Based on Chromium //tools/find_depot_tools.py.
|
|
|