Index: build/java_apk.gypi |
diff --git a/build/java_apk.gypi b/build/java_apk.gypi |
index 0e550a0e1f6db471fa1c9045f7f2d1c60ae7e840..e77224a908d8ecc513f9c61972a1db44cd01734c 100644 |
--- a/build/java_apk.gypi |
+++ b/build/java_apk.gypi |
@@ -87,15 +87,18 @@ |
'native_libraries_template_data_file': '<(native_libraries_template_data_dir)/native_libraries_array.h', |
'native_libraries_template_data_stamp': '<(intermediate_dir)/native_libraries_template_data.stamp', |
'compile_stamp': '<(intermediate_dir)/compile.stamp', |
+ 'instr_stamp': '<(intermediate_dir)/instr.stamp', |
'jar_stamp': '<(intermediate_dir)/jar.stamp', |
'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', |
'strip_stamp': '<(intermediate_dir)/strip.stamp', |
'classes_dir': '<(intermediate_dir)/classes', |
+ 'classes_final_dir': '<(intermediate_dir)/classes_instr', |
'javac_includes': [], |
'jar_excluded_classes': [], |
'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', |
@@ -128,6 +131,7 @@ |
], |
}, |
'native_lib_target%': '', |
+ 'emma_instrument': '<(emma_coverage)', |
'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
}, |
@@ -466,20 +470,37 @@ |
], |
}, |
{ |
+ 'action_name': 'instr_classes_<(_target_name)', |
+ 'message': 'Instrumenting <(_target_name) classes', |
+ 'variables': { |
+ 'input_path': '<(classes_dir)', |
+ 'output_path': '<(classes_final_dir)', |
+ 'stamp_path': '<(instr_stamp)', |
+ 'instr_type': 'classes', |
+ }, |
+ 'outputs': [ |
+ '<(instr_stamp)', |
+ ], |
+ 'inputs': [ |
+ '<(compile_stamp)', |
+ ], |
+ 'includes': [ 'android/instr_action.gypi' ], |
+ }, |
+ { |
'action_name': 'jar_<(_target_name)', |
'message': 'Creating <(_target_name) jar', |
'inputs': [ |
+ '<(instr_stamp)', |
'<(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)', |
@@ -496,7 +517,7 @@ |
'<(DEPTH)/build/android/ant/create-test-jar.js', |
'<(DEPTH)/build/android/gyp/util/build_utils.py', |
'<(DEPTH)/build/android/gyp/ant.py', |
- '<(compile_stamp)', |
+ '<(instr_stamp)', |
'>@(proguard_flags_paths)', |
], |
'outputs': [ |
@@ -542,10 +563,14 @@ |
'input_paths': [ '<(obfuscate_stamp)' ], |
'proguard_enabled_input_path': '<(obfuscated_jar_path)', |
}], |
+ ['emma_instrument != 0', { |
+ 'dex_input_paths': [ '<(emma_device_jar)' ], |
+ 'dex_no_locals': 1, |
+ }], |
], |
- 'input_paths': [ '<(compile_stamp)' ], |
+ 'input_paths': [ '<(instr_stamp)' ], |
'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' ], |
@@ -630,6 +655,7 @@ |
'-DOUT_DIR=<(intermediate_dir)', |
'-DSOURCE_DIR=<(source_dir)', |
'-DUNSIGNED_APK_PATH=<(unsigned_apk_path)', |
+ '-DEMMA_INSTRUMENT=<(emma_instrument)', |
'-Dbasedir=.', |
'-buildfile', |