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

Unified Diff: build/config/android/rules.gni

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
Index: build/config/android/rules.gni
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index 37c748388bb84461cf895c2040b62431877fb749..ba7d68511a381b57c5c1ea657f7eddf4750e1744 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -1066,6 +1066,8 @@ template("java_prebuilt") {
# alternative_android_sdk_ijar, must be set if alternative_android_sdk_ijar
# is used.
#
+# emma_never_instrument: Disables EMMA Java code coverage for this target.
+#
# Example
# android_library("foo_java") {
# java_files = [
@@ -1359,6 +1361,8 @@ template("android_apk") {
_proguard_jar_path = "$base_path.proguard.jar"
}
+ _emma_never_instrument = defined(invoker.testonly) && invoker.testonly
agrieve 2015/11/19 01:50:52 testonly -> emma_never_instrument
pkotwicz 2015/11/19 16:55:59 Line 1364 belongs to "android_apk" template. Line
+
build_config_target = "${_template_name}__build_config"
write_build_config(build_config_target) {
forward_variables_from(invoker, [ "apk_under_test" ])
@@ -1472,6 +1476,7 @@ template("android_apk") {
srcjar_deps = _srcjar_deps
jar_path = _jar_path
dex_path = _lib_dex_path
+ emma_never_instrument = _emma_never_instrument
if (defined(invoker.deps)) {
deps += invoker.deps
@@ -1553,6 +1558,11 @@ template("android_apk") {
output = final_dex_path
_dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files"
args = [ "--inputs=@FileArg($_dex_arg_key)" ]
+
+ if (emma_coverage && !_emma_never_instrument) {
+ no_locals = true
+ sources += [ "$android_sdk_root/tools/lib/emma_device.jar" ]
+ }
}
if (_native_libs != []) {
@@ -1632,6 +1642,7 @@ template("android_apk") {
dex_path = final_dex_path
load_library_from_apk = _load_library_from_apk
create_density_splits = _create_density_splits
+ emma_instrument = emma_coverage && !_emma_never_instrument
if (!defined(extensions_to_not_compress)) {
# Allow icu data, v8 snapshots, and pak files to be loaded directly from

Powered by Google App Engine
This is Rietveld 408576698