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

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

Issue 2182303002: Merging under test java into instrumentation test java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@runtimelibrary
Patch Set: Cleaning up for review Created 4 years, 5 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 70bc6d08104a0a6e08165a6b5daa52ce3be97fcb..11566a08664c8d6b78e4f7688cbde1385008c5c7 100755
--- a/build/android/gyp/write_build_config.py
+++ b/build/android/gyp/write_build_config.py
@@ -81,6 +81,13 @@ def GetDepConfig(path):
return dep_config_cache[path]
+config_cache = {}
+def GetConfig(path):
+ if not path in config_cache:
+ config_cache[path] = build_utils.ReadJson(path)
+ return config_cache[path]
+
+
def DepsOfType(wanted_type, configs):
return [c for c in configs if c['type'] == wanted_type]
@@ -273,6 +280,8 @@ def main(argv):
parser.add_option('--tested-apk-config',
help='Path to the build config of the tested apk (for an instrumentation '
'test apk).')
+ parser.add_option('--merge-tested-apk', action='store_true',
+ help='Whether to merge the test apk and tested apk into one.')
agrieve 2016/07/28 01:30:57 nit: "Whether to add all jars from test-apk-config
smaier 2016/07/28 15:27:18 Done.
parser.add_option('--proguard-enabled', action='store_true',
help='Whether proguard is enabled for this apk.')
parser.add_option('--proguard-info',
@@ -521,19 +530,28 @@ 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 = GetDepConfig(options.tested_apk_config)
+ tested_apk_config = GetConfig(options.tested_apk_config)
agrieve 2016/07/28 01:30:57 rather than expose the top-level config, we should
smaier 2016/07/28 15:27:18 Done.
+ tested_apk_dep_config = GetDepConfig(options.tested_apk_config)
- expected_tested_package = tested_apk_config['package_name']
+ expected_tested_package = tested_apk_dep_config['package_name']
AndroidManifest(options.android_manifest).CheckInstrumentation(
expected_tested_package)
- if tested_apk_config['proguard_enabled']:
- assert options.proguard_enabled, ('proguard must be enabled for '
- 'instrumentation apks if it\'s enabled for the tested apk.')
+ if options.merge_tested_apk:
+ # Add all tested classes to the test's classpath to ensure that the test's
+ # java code is a superset of the tested apk's java code
+ java_full_classpath += [
+ jar for jar in tested_apk_config['java']['full_classpath']
+ if jar not in java_full_classpath]
# Include in the classpath classes that are added directly to the apk under
# test (those that are not a part of a java_library).
- javac_classpath.append(tested_apk_config['jar_path'])
- java_full_classpath.append(tested_apk_config['jar_path'])
+ javac_classpath.append(tested_apk_dep_config['jar_path'])
+ java_full_classpath.append(tested_apk_dep_config['jar_path'])
+
+ if tested_apk_dep_config['proguard_enabled']:
+ assert options.proguard_enabled, ('proguard must be enabled for '
+ 'instrumentation apks if it\'s enabled for the tested apk.')
+
# Exclude dex files from the test apk that exist within the apk under test.
# TODO(agrieve): When proguard is enabled, this filtering logic happens

Powered by Google App Engine
This is Rietveld 408576698