Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2690)

Unified Diff: build/android/gyp/write_build_config.py

Issue 1127233005: Don't include tested apks resources in test apk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..d2737f643cfbdd54b061104a1f242ccb7522eeb1 100755
--- a/build/android/gyp/write_build_config.py
+++ b/build/android/gyp/write_build_config.py
@@ -79,9 +79,32 @@ 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):
+ 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):
@@ -165,20 +188,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 +282,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 +340,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__':

Powered by Google App Engine
This is Rietveld 408576698