Chromium Code Reviews| Index: build/android/gyp/write_build_config.py |
| diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py |
| index 1b4379d3b97eb2e1e40780d41584f0953684f345..495c19f3521478f42419ba85182a61e518d2099c 100755 |
| --- a/build/android/gyp/write_build_config.py |
| +++ b/build/android/gyp/write_build_config.py |
| @@ -79,10 +79,31 @@ def DepsOfType(wanted_type, configs): |
| def GetAllDepsConfigsInOrder(deps_config_paths): |
| - def Deps(path): |
| + def GetDeps(path): |
| return set(GetDepConfig(path)['deps_configs']) |
| - return build_utils.GetSortedTransitiveDependencies(deps_config_paths, Deps) |
| - |
| + return build_utils.GetSortedTransitiveDependencies(deps_config_paths, GetDeps) |
| + |
| +class Deps(object): |
|
newt (away)
2015/05/12 01:01:24
more blank lines!
|
| + def __init__(self, direct_deps_config_paths): |
| + self.all_deps_config_paths = GetAllDepsConfigsInOrder( |
| + direct_deps_config_paths) |
| + self.direct_deps_configs = [ |
| + GetDepConfig(p) for p in direct_deps_config_paths] |
| + self.all_deps_configs = [ |
| + GetDepConfig(p) for p in self.all_deps_config_paths] |
| + |
| + def All(self, wanted_type=None): |
| + if type is None: |
| + return self.all_deps_configs |
| + return DepsOfType(wanted_type, self.all_deps_configs) |
| + |
| + def Direct(self, wanted_type=None): |
| + if wanted_type is None: |
| + return self.direct_deps_configs |
| + return DepsOfType(wanted_type, self.direct_deps_configs) |
| + |
| + def AllConfigPaths(self): |
| + return self.all_deps_config_paths |
| def main(argv): |
| parser = optparse.OptionParser() |
| @@ -165,20 +186,23 @@ def main(argv): |
| direct_deps_config_paths = [ |
| c for c in possible_deps_config_paths if not c in unknown_deps] |
| - all_deps_config_paths = GetAllDepsConfigsInOrder(direct_deps_config_paths) |
| - |
| - direct_deps_configs = [GetDepConfig(p) for p in direct_deps_config_paths] |
| - all_deps_configs = [GetDepConfig(p) for p in all_deps_config_paths] |
| - direct_library_deps = DepsOfType('java_library', direct_deps_configs) |
| - all_library_deps = DepsOfType('java_library', all_deps_configs) |
| + deps = Deps(direct_deps_config_paths) |
| + direct_library_deps = deps.Direct('java_library') |
| + all_library_deps = deps.All('java_library') |
| - direct_resources_deps = DepsOfType('android_resources', direct_deps_configs) |
| - all_resources_deps = DepsOfType('android_resources', all_deps_configs) |
| + direct_resources_deps = deps.Direct('android_resources') |
| + all_resources_deps = deps.All('android_resources') |
| # Resources should be ordered with the highest-level dependency first so that |
| # overrides are done correctly. |
| all_resources_deps.reverse() |
| + if options.type == 'android_apk' and options.tested_apk_config: |
| + tested_apk_deps = Deps([options.tested_apk_config]) |
| + tested_apk_resources_deps = tested_apk_deps.All('android_resources') |
| + all_resources_deps = [ |
| + d for d in all_resources_deps if not d in tested_apk_resources_deps] |
| + |
| # Initialize some common config. |
| config = { |
| 'deps_info': { |
| @@ -256,10 +280,8 @@ def main(argv): |
| # An instrumentation test apk should exclude the dex files that are in the apk |
| # under test. |
| if options.type == 'android_apk' and options.tested_apk_config: |
| - tested_apk_config_paths = GetAllDepsConfigsInOrder( |
| - [options.tested_apk_config]) |
| - tested_apk_configs = [GetDepConfig(p) for p in tested_apk_config_paths] |
| - tested_apk_library_deps = DepsOfType('java_library', tested_apk_configs) |
| + tested_apk_deps = Deps([options.tested_apk_config]) |
| + tested_apk_library_deps = tested_apk_deps.All('java_library') |
| tested_apk_deps_dex_files = [c['dex_path'] for c in tested_apk_library_deps] |
| deps_dex_files = [ |
| p for p in deps_dex_files if not p in tested_apk_deps_dex_files] |
| @@ -316,7 +338,7 @@ def main(argv): |
| if options.depfile: |
| build_utils.WriteDepfile( |
| options.depfile, |
| - all_deps_config_paths + build_utils.GetPythonDependencies()) |
| + deps.AllConfigPaths() + build_utils.GetPythonDependencies()) |
| if __name__ == '__main__': |