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

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

Issue 1457883002: Port EMMA Java code coverage build rules to GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | build/config/android/config.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/apkbuilder.py
diff --git a/build/android/gyp/apkbuilder.py b/build/android/gyp/apkbuilder.py
index f668c08e690ee41ebc6bef1db3bd805c1d05f4c4..4f947642dcd3a3a63fcaf6925bfedcc0a6a036f5 100755
--- a/build/android/gyp/apkbuilder.py
+++ b/build/android/gyp/apkbuilder.py
@@ -51,6 +51,8 @@ def _ParseArgs(args):
parser.add_argument('--native-lib-placeholders',
help='GYP-list of native library placeholders to add.',
default='[]')
+ parser.add_argument('--emma-device-jar',
+ help='Path to emma_device.jar to include.')
options = parser.parse_args(args)
options.assets = build_utils.ParseGypList(options.assets)
options.uncompressed_assets = build_utils.ParseGypList(
@@ -122,6 +124,9 @@ def main(args):
if options.dex_file:
input_paths.append(options.dex_file)
+ if options.emma_device_jar:
+ input_paths.append(options.emma_device_jar)
+
input_strings = [options.android_abi, options.native_lib_placeholders]
for path in itertools.chain(options.assets, options.uncompressed_assets):
@@ -152,6 +157,23 @@ def main(args):
if options.dex_file:
apk.write(options.dex_file, 'classes.dex')
+ if options.emma_device_jar:
+ # Add EMMA Java resources to APK.
+ with zipfile.ZipFile(options.emma_device_jar, 'r') as emma_device_jar:
+ for emma_device_jar_entry in emma_device_jar.namelist():
+ entry_name_lower = emma_device_jar_entry.lower()
+ if entry_name_lower.startswith('meta-inf/'):
+ continue
+
+ if entry_name_lower.endswith('/'):
+ continue
+
+ if entry_name_lower.endswith('.class'):
+ continue
+
+ apk.writestr(emma_device_jar_entry,
+ emma_device_jar.read(emma_device_jar_entry))
+
shutil.move(tmp_apk, options.output_apk)
finally:
if os.path.exists(tmp_apk):
« no previous file with comments | « no previous file | build/config/android/config.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698