OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//base/android/linker/config.gni") | 5 import("//base/android/linker/config.gni") |
6 import("//build/config/android/config.gni") | 6 import("//build/config/android/config.gni") |
7 import("//build/config/android/internal_rules.gni") | 7 import("//build/config/android/internal_rules.gni") |
8 import("//build/toolchain/toolchain.gni") | 8 import("//build/toolchain/toolchain.gni") |
9 import("//third_party/android_platform/config.gni") | 9 import("//third_party/android_platform/config.gni") |
10 import("//tools/grit/grit_rule.gni") | 10 import("//tools/grit/grit_rule.gni") |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 # dex_path: If set, the resulting .dex.jar file will be placed under this | 1065 # dex_path: If set, the resulting .dex.jar file will be placed under this |
1066 # path. | 1066 # path. |
1067 # | 1067 # |
1068 # alternative_android_sdk_ijar: if set, the given android_sdk_ijar file | 1068 # alternative_android_sdk_ijar: if set, the given android_sdk_ijar file |
1069 # replaces the default android_sdk_ijar. | 1069 # replaces the default android_sdk_ijar. |
1070 # | 1070 # |
1071 # alternative_android_sdk_ijar_dep: the target that generates | 1071 # alternative_android_sdk_ijar_dep: the target that generates |
1072 # alternative_android_sdk_ijar, must be set if alternative_android_sdk_ijar | 1072 # alternative_android_sdk_ijar, must be set if alternative_android_sdk_ijar |
1073 # is used. | 1073 # is used. |
1074 # | 1074 # |
| 1075 # emma_never_instrument: Disables EMMA Java code coverage for this target. |
| 1076 # |
1075 # Example | 1077 # Example |
1076 # android_library("foo_java") { | 1078 # android_library("foo_java") { |
1077 # java_files = [ | 1079 # java_files = [ |
1078 # "android/org/chromium/foo/Foo.java", | 1080 # "android/org/chromium/foo/Foo.java", |
1079 # "android/org/chromium/foo/FooInterface.java", | 1081 # "android/org/chromium/foo/FooInterface.java", |
1080 # "android/org/chromium/foo/FooService.java", | 1082 # "android/org/chromium/foo/FooService.java", |
1081 # ] | 1083 # ] |
1082 # deps = [ | 1084 # deps = [ |
1083 # ":bar_java" | 1085 # ":bar_java" |
1084 # ] | 1086 # ] |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 | 1360 |
1359 # Help GN understand that _create_abi_split is not unused (bug in GN). | 1361 # Help GN understand that _create_abi_split is not unused (bug in GN). |
1360 assert(_create_abi_split || true) | 1362 assert(_create_abi_split || true) |
1361 | 1363 |
1362 _proguard_enabled = | 1364 _proguard_enabled = |
1363 defined(invoker.proguard_enabled) && invoker.proguard_enabled | 1365 defined(invoker.proguard_enabled) && invoker.proguard_enabled |
1364 if (_proguard_enabled) { | 1366 if (_proguard_enabled) { |
1365 _proguard_jar_path = "$base_path.proguard.jar" | 1367 _proguard_jar_path = "$base_path.proguard.jar" |
1366 } | 1368 } |
1367 | 1369 |
| 1370 _emma_never_instrument = defined(invoker.testonly) && invoker.testonly |
| 1371 |
1368 build_config_target = "${_template_name}__build_config" | 1372 build_config_target = "${_template_name}__build_config" |
1369 write_build_config(build_config_target) { | 1373 write_build_config(build_config_target) { |
1370 forward_variables_from(invoker, [ "apk_under_test" ]) | 1374 forward_variables_from(invoker, [ "apk_under_test" ]) |
1371 type = "android_apk" | 1375 type = "android_apk" |
1372 jar_path = _jar_path | 1376 jar_path = _jar_path |
1373 dex_path = final_dex_path | 1377 dex_path = final_dex_path |
1374 resources_zip = resources_zip_path | 1378 resources_zip = resources_zip_path |
1375 build_config = _build_config | 1379 build_config = _build_config |
1376 android_manifest = _android_manifest | 1380 android_manifest = _android_manifest |
1377 | 1381 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 if (defined(invoker.java_files)) { | 1475 if (defined(invoker.java_files)) { |
1472 java_files = invoker.java_files | 1476 java_files = invoker.java_files |
1473 } else if (defined(invoker.DEPRECATED_java_in_dir)) { | 1477 } else if (defined(invoker.DEPRECATED_java_in_dir)) { |
1474 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir | 1478 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir |
1475 } else { | 1479 } else { |
1476 java_files = [] | 1480 java_files = [] |
1477 } | 1481 } |
1478 srcjar_deps = _srcjar_deps | 1482 srcjar_deps = _srcjar_deps |
1479 jar_path = _jar_path | 1483 jar_path = _jar_path |
1480 dex_path = _lib_dex_path | 1484 dex_path = _lib_dex_path |
| 1485 emma_never_instrument = _emma_never_instrument |
1481 | 1486 |
1482 if (defined(invoker.deps)) { | 1487 if (defined(invoker.deps)) { |
1483 deps += invoker.deps | 1488 deps += invoker.deps |
1484 } | 1489 } |
1485 } | 1490 } |
1486 | 1491 |
1487 if (_dist_jar_path != "") { | 1492 if (_dist_jar_path != "") { |
1488 create_dist_target = "${_template_name}__create_dist_jar" | 1493 create_dist_target = "${_template_name}__create_dist_jar" |
1489 _final_deps += [ ":$create_dist_target" ] | 1494 _final_deps += [ ":$create_dist_target" ] |
1490 | 1495 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 | 1557 |
1553 dex("$final_dex_target_name") { | 1558 dex("$final_dex_target_name") { |
1554 deps = _dex_deps + [ ":$build_config_target" ] | 1559 deps = _dex_deps + [ ":$build_config_target" ] |
1555 inputs = [ | 1560 inputs = [ |
1556 _build_config, | 1561 _build_config, |
1557 ] | 1562 ] |
1558 sources = _dex_sources | 1563 sources = _dex_sources |
1559 output = final_dex_path | 1564 output = final_dex_path |
1560 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" | 1565 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" |
1561 args = [ "--inputs=@FileArg($_dex_arg_key)" ] | 1566 args = [ "--inputs=@FileArg($_dex_arg_key)" ] |
| 1567 |
| 1568 if (emma_coverage && !_emma_never_instrument) { |
| 1569 no_locals = true |
| 1570 sources += [ "$android_sdk_root/tools/lib/emma_device.jar" ] |
| 1571 } |
1562 } | 1572 } |
1563 | 1573 |
1564 if (_native_libs != []) { | 1574 if (_native_libs != []) { |
1565 _prepare_native_target_name = "${_template_name}__prepare_native" | 1575 _prepare_native_target_name = "${_template_name}__prepare_native" |
1566 action(_prepare_native_target_name) { | 1576 action(_prepare_native_target_name) { |
1567 forward_variables_from(invoker, | 1577 forward_variables_from(invoker, |
1568 [ | 1578 [ |
1569 "data_deps", | 1579 "data_deps", |
1570 "public_deps", | 1580 "public_deps", |
1571 ]) | 1581 ]) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 "language_splits", | 1641 "language_splits", |
1632 "shared_resources", | 1642 "shared_resources", |
1633 ]) | 1643 ]) |
1634 apk_path = _final_apk_path | 1644 apk_path = _final_apk_path |
1635 android_manifest = _android_manifest | 1645 android_manifest = _android_manifest |
1636 assets_build_config = _build_config | 1646 assets_build_config = _build_config |
1637 resources_zip = _all_resources_zip_path | 1647 resources_zip = _all_resources_zip_path |
1638 dex_path = final_dex_path | 1648 dex_path = final_dex_path |
1639 load_library_from_apk = _load_library_from_apk | 1649 load_library_from_apk = _load_library_from_apk |
1640 create_density_splits = _create_density_splits | 1650 create_density_splits = _create_density_splits |
| 1651 emma_instrument = emma_coverage && !_emma_never_instrument |
1641 | 1652 |
1642 if (!defined(extensions_to_not_compress)) { | 1653 if (!defined(extensions_to_not_compress)) { |
1643 # Allow icu data, v8 snapshots, and pak files to be loaded directly from | 1654 # Allow icu data, v8 snapshots, and pak files to be loaded directly from |
1644 # the .apk. | 1655 # the .apk. |
1645 # Note: These are actually suffix matches, not necessarily extensions. | 1656 # Note: These are actually suffix matches, not necessarily extensions. |
1646 extensions_to_not_compress = ".dat,.bin,.pak" | 1657 extensions_to_not_compress = ".dat,.bin,.pak" |
1647 } | 1658 } |
1648 | 1659 |
1649 version_code = _version_code | 1660 version_code = _version_code |
1650 version_name = _version_name | 1661 version_name = _version_name |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2173 } | 2184 } |
2174 | 2185 |
2175 android_library(target_name) { | 2186 android_library(target_name) { |
2176 java_files = [] | 2187 java_files = [] |
2177 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 2188 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
2178 deps = [ | 2189 deps = [ |
2179 "//third_party/android_protobuf:protobuf_nano_javalib", | 2190 "//third_party/android_protobuf:protobuf_nano_javalib", |
2180 ] | 2191 ] |
2181 } | 2192 } |
2182 } | 2193 } |
OLD | NEW |