Index: build/java.gypi |
diff --git a/build/java.gypi b/build/java.gypi |
index 1635c71da40db66cfee1a1737cc9089057ec378c..f8f54a70e0c99c74e377caad0910369b0e328af7 100644 |
--- a/build/java.gypi |
+++ b/build/java.gypi |
@@ -55,10 +55,12 @@ |
'additional_src_dirs': [], |
'javac_includes': [], |
'jar_name': '<(_target_name).jar', |
- 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
+ 'jar_dir': '<(PRODUCT_DIR)/lib.java', |
+ 'jar_final_path': '<(jar_dir)/<(jar_name)', |
'jar_excluded_classes': [ '*/R.class', '*/R##*.class' ], |
'additional_input_paths': [], |
'dex_path': '<(PRODUCT_DIR)/lib.java/<(_target_name).dex.jar', |
+ 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', |
'generated_src_dirs': ['>@(generated_R_dirs)'], |
'generated_R_dirs': [], |
'has_java_resources%': 0, |
@@ -70,12 +72,19 @@ |
'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', |
'classes_dir': '<(intermediate_dir)/classes', |
'compile_stamp': '<(intermediate_dir)/compile.stamp', |
+ 'conditions': [ |
+ ['emma_instrument != 0', { |
+ 'jar_path': '<(intermediate_dir)/<(jar_name)', |
+ }, { |
+ 'jar_path': '<(jar_final_path)', |
+ }] |
+ ] |
}, |
# This all_dependent_settings is used for java targets only. This will add the |
# jar path to the classpath of dependent java targets. |
'all_dependent_settings': { |
'variables': { |
- 'input_jars_paths': ['<(jar_path)'], |
+ 'input_jars_paths': ['<(jar_final_path)'], |
'library_dexed_jars_paths': ['<(dex_path)'], |
}, |
}, |
@@ -218,6 +227,39 @@ |
}, |
], |
}], |
+ ['emma_instrument != 0', { |
+ 'actions': [ |
+ { |
+ 'action_name': 'emma_instr_<(_target_name)', |
+ 'message': 'Instrumenting <(_target_name) classes', |
+ 'inputs': [ |
+ '<(jar_path)', |
+ '<(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', |
+ '<(jar_final_path)', |
+ ], |
+ 'action': [ |
+ 'python', '<(DEPTH)/build/android/gyp/ant.py', |
+ '-DINPUT_JAR_FILE=<(jar_path)', |
+ '-DOUTPUT_JAR_DIR=<(intermediate_dir)', |
+ '-DOUTPUT_JAR_FINAL_DIR=<(jar_dir)', |
+ '-DEMMA_COVERAGE_FILE=<(intermediate_dir)/coverage.em', |
+ '-DEMMA_SOURCES_FILE=<(intermediate_dir)/emma_sources.txt', |
+ '-DJAVA_SRC=<(java_in_dir)/src', |
+ '-DADDITIONAL_SRC=>(additional_src_dirs)', |
+ '-DGENERATED_SRC=>(generated_src_dirs)', |
+ '-DANDROID_SDK_ROOT=<(android_sdk_root)', |
+ '-Dbasedir=.', |
+ '-buildfile', |
+ '<(DEPTH)/build/android/ant/apk-instr.xml', |
+ ] |
+ }, |
+ ], |
+ }], |
], |
'actions': [ |
{ |
@@ -282,15 +324,15 @@ |
'<(DEPTH)/build/android/gyp/util/build_utils.py', |
'<(DEPTH)/build/android/gyp/util/md5_check.py', |
'<(DEPTH)/build/android/gyp/jar_toc.py', |
- '<(jar_path)', |
+ '<(jar_final_path)', |
], |
'outputs': [ |
- '<(jar_path).TOC', |
+ '<(jar_final_path).TOC', |
], |
'action': [ |
'python', '<(DEPTH)/build/android/gyp/jar_toc.py', |
- '--jar-path=<(jar_path)', |
- '--toc-path=<(jar_path).TOC', |
+ '--jar-path=<(jar_final_path)', |
+ '--toc-path=<(jar_final_path).TOC', |
# TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. |
'--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
@@ -299,7 +341,12 @@ |
{ |
'action_name': 'dex_<(_target_name)', |
'variables': { |
- 'dex_input_paths': [ '<(jar_path)' ], |
+ 'conditions': [ |
+ ['emma_instrument != 0', { |
+ 'dex_no_locals': [ '--no-locals' ], |
+ }], |
+ ], |
+ 'dex_input_paths': [ '<(jar_final_path)' ], |
'output_path': '<(dex_path)', |
}, |
'includes': [ 'android/dex_action.gypi' ], |