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

Unified Diff: build/java_apk.gypi

Issue 20210002: [Android] Sets up a coverage system for java using EMMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« build/android/test_runner.py ('K') | « build/java.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/java_apk.gypi
diff --git a/build/java_apk.gypi b/build/java_apk.gypi
index e388690f767a9941d92b944f4d09ffba3ce71ac9..8b8b7fde33d22fb0170eac959b8a341c9081b1b4 100644
--- a/build/java_apk.gypi
+++ b/build/java_apk.gypi
@@ -96,6 +96,7 @@
'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)',
'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar',
'dex_path': '<(intermediate_dir)/classes.dex',
+ 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar',
'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml',
'push_stamp': '<(intermediate_dir)/push.stamp',
'link_stamp': '<(intermediate_dir)/link.stamp',
@@ -130,6 +131,13 @@
'native_lib_target%': '',
'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)',
'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)',
+ 'conditions': [
+ ['coverage == 1', {
+ 'classes_final_dir': '<(intermediate_dir)/classes_instr',
+ }, {
+ 'classes_final_dir': '<(intermediate_dir)/classes',
+ }]
+ ]
},
# Pass the jar path to the apk's "fake" jar target. This would be better as
# direct_dependent_settings, but a variable set by a direct_dependent_settings
@@ -372,6 +380,34 @@
},
],
}],
+ ['coverage == 1', {
+ 'actions': [
+ {
+ 'action_name': 'emma_instr_<(_target_name)',
+ 'message': 'Instrumenting <(_target_name) classes',
+ 'inputs': [
+ '<(compile_stamp)',
+ '<(DEPTH)/build/android/ant/apk-instr.xml',
+ '<(DEPTH)/build/android/gyp/ant.py',
+ '<(DEPTH)/build/android/gyp/util/build_utils.py',
+ ],
+ 'outputs': [
+ '<(intermediate_dir)/coverage.em',
+ '<(classes_final_dir)',
+ ],
+ 'action': [
+ 'python', '<(DEPTH)/build/android/gyp/ant.py',
+ '-DCLASSES_DIR=<(classes_dir)',
+ '-DCLASSES_INSTR_DIR=<(classes_final_dir)',
+ '-DEMMA_COVERAGE_FILE=<(intermediate_dir)/coverage.em',
+ '-DANDROID_SDK_ROOT=<(android_sdk_root)',
+ '-Dbasedir=.',
+ '-buildfile',
+ '<(DEPTH)/build/android/ant/apk-instr.xml',
+ ]
+ },
+ ],
+ }],
],
'actions': [
{
@@ -463,18 +499,22 @@
{
'action_name': 'jar_<(_target_name)',
'message': 'Creating <(_target_name) jar',
+ 'conditions': [
+ ['coverage == 1', {
+ 'inputs': [ '<(intermediate_dir)/coverage.em', ]
+ }]
+ ],
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/util/md5_check.py',
'<(DEPTH)/build/android/gyp/jar.py',
- '<(compile_stamp)',
],
'outputs': [
'<(jar_stamp)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/jar.py',
- '--classes-dir=<(classes_dir)',
+ '--classes-dir=<(classes_final_dir)',
'--jar-path=<(jar_path)',
'--excluded-classes=<(jar_excluded_classes)',
'--stamp=<(jar_stamp)',
@@ -536,10 +576,13 @@
'input_paths': [ '<(obfuscate_stamp)' ],
'proguard_enabled_input_path': '<(obfuscated_jar_path)',
}],
+ ['coverage == 1', {
+ 'dex_input_paths': [ '<(emma_device_jar)' ],
+ }],
],
- 'input_paths': [ '<(compile_stamp)' ],
+ 'input_paths': [ '<(compile_stamp)', '<(classes_final_dir)' ],
'dex_input_paths': [ '>@(library_dexed_jars_paths)' ],
- 'dex_generated_input_dirs': [ '<(classes_dir)' ],
+ 'dex_generated_input_dirs': [ '<(classes_final_dir)' ],
'output_path': '<(dex_path)',
},
'includes': [ 'android/dex_action.gypi' ],
@@ -622,6 +665,7 @@
'-DOUT_DIR=<(intermediate_dir)',
'-DSOURCE_DIR=<(source_dir)',
'-DUNSIGNED_APK_PATH=<(unsigned_apk_path)',
+ '-DCOVERAGE=<(coverage)',
'-Dbasedir=.',
'-buildfile',
« build/android/test_runner.py ('K') | « build/java.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698