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

Side by Side Diff: build/config/android/internal_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 unified diff | Download patch
« no previous file with comments | « build/config/android/config.gni ('k') | build/config/android/rules.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/zip.gni") 6 import("//build/config/zip.gni")
7 import("//third_party/ijar/ijar.gni") 7 import("//third_party/ijar/ijar.gni")
8 8
9 assert(is_android) 9 assert(is_android)
10 10
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 } 462 }
463 } 463 }
464 } 464 }
465 465
466 template("process_java_prebuilt") { 466 template("process_java_prebuilt") {
467 set_sources_assignment_filter([]) 467 set_sources_assignment_filter([])
468 forward_variables_from(invoker, [ "testonly" ]) 468 forward_variables_from(invoker, [ "testonly" ])
469 469
470 _input_jar_path = invoker.input_jar_path 470 _input_jar_path = invoker.input_jar_path
471 _output_jar_path = invoker.output_jar_path 471 _output_jar_path = invoker.output_jar_path
472 _output_ijar_path = get_path_info(_output_jar_path, "dir") + "/" +
473 get_path_info(_output_jar_path, "name") + ".interface.jar"
474 472
475 assert(invoker.build_config != "") 473 assert(invoker.build_config != "")
476 474
477 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { 475 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
478 _build_config = invoker.build_config 476 _build_config = invoker.build_config
479 _rebased_build_config = rebase_path(_build_config, root_build_dir) 477 _rebased_build_config = rebase_path(_build_config, root_build_dir)
480 _proguard_config_path = invoker.proguard_config 478 _proguard_config_path = invoker.proguard_config
481 _output_jar_target = "${target_name}__proguard_process" 479 _output_jar_target = "${target_name}__proguard_process"
482 proguard(_output_jar_target) { 480 proguard(_output_jar_target) {
483 forward_variables_from(invoker, 481 forward_variables_from(invoker,
(...skipping 28 matching lines...) Expand all
512 ]) 510 ])
513 sources = [ 511 sources = [
514 _input_jar_path, 512 _input_jar_path,
515 ] 513 ]
516 outputs = [ 514 outputs = [
517 _output_jar_path, 515 _output_jar_path,
518 ] 516 ]
519 } 517 }
520 } 518 }
521 519
522 generate_interface_jar("${target_name}__ijar") {
523 input_jar = _output_jar_path
524 output_jar = _output_ijar_path
525 deps = [
526 ":$_output_jar_target",
527 ]
528 }
529
530 group(target_name) { 520 group(target_name) {
531 forward_variables_from(invoker, [ "visibility" ]) 521 forward_variables_from(invoker, [ "visibility" ])
532 public_deps = [ 522 public_deps = [
533 ":${target_name}__ijar",
534 ":$_output_jar_target", 523 ":$_output_jar_target",
535 ] 524 ]
536 } 525 }
526 }
527
528 template("emma_instr") {
529 set_sources_assignment_filter([])
530 forward_variables_from(invoker, [ "testonly" ])
531
532 assert(invoker.source_files != [] || true) # Mark as used
533
534 if (invoker.emma_instrument) {
535 _output_jar_target = "${target_name}__process"
536 _coverage_file = "$target_out_dir/${target_name}.em"
537 _source_dirs_listing_file = "$target_out_dir/${target_name}_sources.txt"
538 _emma_jar = "${android_sdk_root}/tools/lib/emma.jar"
539 _rebased_source_files = rebase_path(invoker.source_files, root_build_dir)
540 action(_output_jar_target) {
541 forward_variables_from(invoker, [ "deps" ])
542
543 script = "//build/android/gyp/emma_instr.py"
544 depfile = "${target_gen_dir}/${target_name}.d"
545 inputs = [
546 _emma_jar,
547 invoker.input_jar_path,
548 ]
549 outputs = [
550 depfile,
551 _coverage_file,
552 _source_dirs_listing_file,
553 invoker.output_jar_path,
554 ]
555 args = [
556 "instrument_jar",
557 "--input-path",
558 rebase_path(invoker.input_jar_path, root_build_dir),
559 "--output-path",
560 rebase_path(invoker.output_jar_path, root_build_dir),
561 "--depfile",
562 rebase_path(depfile, root_build_dir),
563 "--coverage-file",
564 rebase_path(_coverage_file, root_build_dir),
565 "--sources-list-file",
566 rebase_path(_source_dirs_listing_file, root_build_dir),
567 "--source-files=$_rebased_source_files",
568 "--src-root",
569 rebase_path("//", root_build_dir),
570 "--emma-jar",
571 rebase_path(_emma_jar, root_build_dir),
572 "--filter-string",
573 emma_filter,
574 ]
575 }
576 } else {
577 _output_jar_target = "${target_name}__copy_jar"
578 copy(_output_jar_target) {
579 forward_variables_from(invoker, [ "deps" ])
580
581 sources = [
582 invoker.input_jar_path,
583 ]
584 outputs = [
585 invoker.output_jar_path,
586 ]
587 }
588 }
589
590 group(target_name) {
591 forward_variables_from(invoker, [ "visibility" ])
592 public_deps = [
593 ":$_output_jar_target",
594 ]
595 }
537 } 596 }
538 597
539 # Creates an unsigned .apk. 598 # Creates an unsigned .apk.
540 # 599 #
541 # Variables 600 # Variables
542 # assets_build_config: Path to android_apk .build_config containing merged 601 # assets_build_config: Path to android_apk .build_config containing merged
543 # asset information. 602 # asset information.
544 # deps: Specifies the dependencies of this target. 603 # deps: Specifies the dependencies of this target.
545 # dex_path: Path to classes.dex file to include (optional). 604 # dex_path: Path to classes.dex file to include (optional).
546 # resource_packaged_apk_path: Path to .ap_ to use. 605 # resource_packaged_apk_path: Path to .ap_ to use.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 args += [ "--android-abi=$android_app_abi" ] 665 args += [ "--android-abi=$android_app_abi" ]
607 } 666 }
608 if (defined(invoker.native_libs_dir)) { 667 if (defined(invoker.native_libs_dir)) {
609 _rebased_native_libs_dir = 668 _rebased_native_libs_dir =
610 rebase_path(invoker.native_libs_dir, root_build_dir) 669 rebase_path(invoker.native_libs_dir, root_build_dir)
611 args += [ "--native-libs-dir=$_rebased_native_libs_dir/$android_app_abi" ] 670 args += [ "--native-libs-dir=$_rebased_native_libs_dir/$android_app_abi" ]
612 } 671 }
613 if (_native_lib_placeholders != []) { 672 if (_native_lib_placeholders != []) {
614 args += [ "--native-lib-placeholders=$_native_lib_placeholders" ] 673 args += [ "--native-lib-placeholders=$_native_lib_placeholders" ]
615 } 674 }
675
676 if (defined(invoker.emma_instrument) && invoker.emma_instrument) {
677 _emma_device_jar = "$android_sdk_root/tools/lib/emma_device.jar"
678 _rebased_emma_device_jar = rebase_path(_emma_device_jar, root_build_dir)
679 args += [ "--emma-device-jar=$_rebased_emma_device_jar" ]
680 }
616 } 681 }
617 } 682 }
618 683
619 # Signs & zipaligns an apk. 684 # Signs & zipaligns an apk.
620 # 685 #
621 # Variables 686 # Variables
622 # input_apk_path: Path of the .apk to be finalized. 687 # input_apk_path: Path of the .apk to be finalized.
623 # output_apk_path: Output path for the generated .apk. 688 # output_apk_path: Output path for the generated .apk.
624 # keystore_path: Path to keystore to use for signing. 689 # keystore_path: Path to keystore to use for signing.
625 # keystore_name: Key alias to use. 690 # keystore_name: Key alias to use.
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 _incremental_deps + [ ":$_generate_incremental_manifest_target_name" ] 939 _incremental_deps + [ ":$_generate_incremental_manifest_target_name" ]
875 android_manifest = _incremental_android_manifest 940 android_manifest = _incremental_android_manifest
876 resource_packaged_apk_path = _incremental_resource_packaged_apk_path 941 resource_packaged_apk_path = _incremental_resource_packaged_apk_path
877 } 942 }
878 943
879 package_target = "${target_name}__package" 944 package_target = "${target_name}__package"
880 package_apk(package_target) { 945 package_apk(package_target) {
881 forward_variables_from(invoker, 946 forward_variables_from(invoker,
882 [ 947 [
883 "assets_build_config", 948 "assets_build_config",
949 "emma_instrument",
884 "native_lib_placeholders", 950 "native_lib_placeholders",
885 "native_libs_dir", 951 "native_libs_dir",
886 ]) 952 ])
887 deps = _deps + [ ":${_package_resources_target_name}" ] 953 deps = _deps + [ ":${_package_resources_target_name}" ]
888 954
889 if (defined(_dex_path)) { 955 if (defined(_dex_path)) {
890 dex_path = _dex_path 956 dex_path = _dex_path
891 } 957 }
892 958
893 output_apk_path = _packaged_apk_path 959 output_apk_path = _packaged_apk_path
894 resource_packaged_apk_path = _resource_packaged_apk_path 960 resource_packaged_apk_path = _resource_packaged_apk_path
895 } 961 }
896 962
897 _incremental_package_target = "${target_name}_incremental__package" 963 _incremental_package_target = "${target_name}_incremental__package"
898 package_apk(_incremental_package_target) { 964 package_apk(_incremental_package_target) {
899 forward_variables_from(invoker, [ "assets_build_config" ]) 965 forward_variables_from(invoker,
966 [
967 "assets_build_config",
968 "emma_instrument",
969 ])
900 _dex_target = "//build/android/incremental_install:bootstrap_java__dex" 970 _dex_target = "//build/android/incremental_install:bootstrap_java__dex"
901 deps = _incremental_deps + [ 971 deps = _incremental_deps + [
902 ":${_incremental_package_resources_target_name}", 972 ":${_incremental_package_resources_target_name}",
903 _dex_target, 973 _dex_target,
904 ] 974 ]
905 975
906 if (defined(_dex_path)) { 976 if (defined(_dex_path)) {
907 dex_path = 977 dex_path =
908 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex" 978 get_label_info(_dex_target, "target_gen_dir") + "/bootstrap.dex"
909 } 979 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 _supports_android = 1066 _supports_android =
997 defined(invoker.supports_android) && invoker.supports_android 1067 defined(invoker.supports_android) && invoker.supports_android
998 1068
999 assert(defined(invoker.jar_path)) 1069 assert(defined(invoker.jar_path))
1000 _base_path = "${target_gen_dir}/$target_name" 1070 _base_path = "${target_gen_dir}/$target_name"
1001 1071
1002 # Jar files can be needed at runtime (by Robolectric tests or java binaries), 1072 # Jar files can be needed at runtime (by Robolectric tests or java binaries),
1003 # so do not put them under gen/. 1073 # so do not put them under gen/.
1004 _target_dir_name = get_label_info(":$target_name", "dir") 1074 _target_dir_name = get_label_info(":$target_name", "dir")
1005 _jar_path = "$root_out_dir/lib.java$_target_dir_name/$target_name.jar" 1075 _jar_path = "$root_out_dir/lib.java$_target_dir_name/$target_name.jar"
1076 _ijar_path =
1077 "$root_out_dir/lib.java$_target_dir_name/$target_name.interface.jar"
1006 _build_config = _base_path + ".build_config" 1078 _build_config = _base_path + ".build_config"
1007 1079
1008 if (_supports_android) { 1080 if (_supports_android) {
1009 _dex_path = _base_path + ".dex.jar" 1081 _dex_path = _base_path + ".dex.jar"
1010 } 1082 }
1011 _deps = [] 1083 _deps = []
1012 if (defined(invoker.deps)) { 1084 if (defined(invoker.deps)) {
1013 _deps = invoker.deps 1085 _deps = invoker.deps
1014 } 1086 }
1015 _jar_deps = [] 1087 _jar_deps = []
1016 if (defined(invoker.jar_dep)) { 1088 if (defined(invoker.jar_dep)) {
1017 _jar_deps = [ invoker.jar_dep ] 1089 _jar_deps = [ invoker.jar_dep ]
1018 } 1090 }
1019 1091
1020 _template_name = target_name 1092 _template_name = target_name
1021 1093
1022 _build_config_target_name = "${_template_name}__build_config" 1094 _build_config_target_name = "${_template_name}__build_config"
1023 _process_jar_target_name = "${_template_name}__process_jar" 1095 _process_jar_target_name = "${_template_name}__process_jar"
1096 _ijar_target_name = "${_template_name}__ijar"
1024 if (_supports_android) { 1097 if (_supports_android) {
1025 _dex_target_name = "${_template_name}__dex" 1098 _dex_target_name = "${_template_name}__dex"
1026 } 1099 }
1027 1100
1028 write_build_config(_build_config_target_name) { 1101 write_build_config(_build_config_target_name) {
1029 type = "java_library" 1102 type = "java_library"
1030 supports_android = _supports_android 1103 supports_android = _supports_android
1031 requires_android = 1104 requires_android =
1032 defined(invoker.requires_android) && invoker.requires_android 1105 defined(invoker.requires_android) && invoker.requires_android
1033 1106
1034 deps = _deps 1107 deps = _deps
1035 build_config = _build_config 1108 build_config = _build_config
1036 jar_path = _jar_path 1109 jar_path = _jar_path
1037 if (_supports_android) { 1110 if (_supports_android) {
1038 dex_path = _dex_path 1111 dex_path = _dex_path
1039 } 1112 }
1040 } 1113 }
1041 1114
1042 process_java_prebuilt(_process_jar_target_name) { 1115 process_java_prebuilt(_process_jar_target_name) {
1043 visibility = [ ":$_template_name" ] 1116 visibility = [
1117 ":$_ijar_target_name",
1118 ":$_template_name",
1119 ]
1044 if (_supports_android) { 1120 if (_supports_android) {
1045 visibility += [ ":$_dex_target_name" ] 1121 visibility += [ ":$_dex_target_name" ]
1046 } 1122 }
1047 1123
1048 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { 1124 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
1049 proguard_preprocess = true 1125 proguard_preprocess = true
1050 proguard_config = invoker.proguard_config 1126 proguard_config = invoker.proguard_config
1051 } 1127 }
1052 1128
1053 build_config = _build_config 1129 build_config = _build_config
1054 input_jar_path = invoker.jar_path 1130 input_jar_path = invoker.jar_path
1055 output_jar_path = _jar_path 1131 output_jar_path = _jar_path
1056 1132
1057 deps = [ ":$_build_config_target_name" ] + _deps + _jar_deps 1133 deps = [ ":$_build_config_target_name" ] + _deps + _jar_deps
1058 } 1134 }
1059 1135
1136 generate_interface_jar(_ijar_target_name) {
1137 input_jar = _jar_path
1138 output_jar = _ijar_path
1139 deps = [
1140 ":$_process_jar_target_name",
1141 ]
1142 }
1143
1060 if (_supports_android) { 1144 if (_supports_android) {
1061 dex(_dex_target_name) { 1145 dex(_dex_target_name) {
1062 sources = [ 1146 sources = [
1063 _jar_path, 1147 _jar_path,
1064 ] 1148 ]
1065 output = _dex_path 1149 output = _dex_path
1066 deps = [ ":$_process_jar_target_name" ] + _deps + _jar_deps 1150 deps = [ ":$_process_jar_target_name" ] + _deps + _jar_deps
1067 } 1151 }
1068 } 1152 }
1069 1153
(...skipping 11 matching lines...) Expand all
1081 script_name = _template_name 1165 script_name = _template_name
1082 deps = [ 1166 deps = [
1083 ":$_build_config_target_name", 1167 ":$_build_config_target_name",
1084 ] 1168 ]
1085 } 1169 }
1086 } 1170 }
1087 1171
1088 group(target_name) { 1172 group(target_name) {
1089 forward_variables_from(invoker, [ "data_deps" ]) 1173 forward_variables_from(invoker, [ "data_deps" ])
1090 deps = [ 1174 deps = [
1175 ":$_ijar_target_name",
1091 ":$_process_jar_target_name", 1176 ":$_process_jar_target_name",
1092 ] 1177 ]
1093 if (_supports_android) { 1178 if (_supports_android) {
1094 deps += [ ":$_dex_target_name" ] 1179 deps += [ ":$_dex_target_name" ]
1095 } 1180 }
1096 data_deps = [] 1181 data_deps = []
1097 if (defined(invoker.data_deps)) { 1182 if (defined(invoker.data_deps)) {
1098 data_deps += invoker.data_deps 1183 data_deps += invoker.data_deps
1099 } 1184 }
1100 if (defined(invoker.main_class)) { 1185 if (defined(invoker.main_class)) {
(...skipping 20 matching lines...) Expand all
1121 template("compile_java") { 1206 template("compile_java") {
1122 set_sources_assignment_filter([]) 1207 set_sources_assignment_filter([])
1123 forward_variables_from(invoker, [ "testonly" ]) 1208 forward_variables_from(invoker, [ "testonly" ])
1124 1209
1125 assert(defined(invoker.java_files)) 1210 assert(defined(invoker.java_files))
1126 assert(defined(invoker.build_config)) 1211 assert(defined(invoker.build_config))
1127 assert(defined(invoker.jar_path)) 1212 assert(defined(invoker.jar_path))
1128 1213
1129 _java_files = invoker.java_files 1214 _java_files = invoker.java_files
1130 _final_jar_path = invoker.jar_path 1215 _final_jar_path = invoker.jar_path
1131 _intermediate_jar_path = "$target_gen_dir/$target_name.initial.jar" 1216 _javac_jar_path = "$target_gen_dir/$target_name.javac.jar"
1217 _process_prebuilt_jar_path =
1218 "$target_gen_dir/$target_name.process_prebuilt.jar"
1219 _final_ijar_path = get_path_info(_final_jar_path, "dir") + "/" +
1220 get_path_info(_final_jar_path, "name") + ".interface.jar"
1132 1221
1133 _build_config = invoker.build_config 1222 _build_config = invoker.build_config
1134 1223
1135 _jar_excluded_patterns = [] 1224 _jar_excluded_patterns = []
1136 if (defined(invoker.jar_excluded_patterns)) { 1225 if (defined(invoker.jar_excluded_patterns)) {
1137 _jar_excluded_patterns += invoker.jar_excluded_patterns 1226 _jar_excluded_patterns += invoker.jar_excluded_patterns
1138 } 1227 }
1139 1228
1140 _chromium_code = false 1229 _chromium_code = false
1141 if (defined(invoker.chromium_code)) { 1230 if (defined(invoker.chromium_code)) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 foreach(dep, _srcjar_deps) { 1265 foreach(dep, _srcjar_deps) {
1177 _dep_gen_dir = get_label_info(dep, "target_gen_dir") 1266 _dep_gen_dir = get_label_info(dep, "target_gen_dir")
1178 _dep_name = get_label_info(dep, "name") 1267 _dep_name = get_label_info(dep, "name")
1179 _java_srcjars += [ "$_dep_gen_dir/$_dep_name.srcjar" ] 1268 _java_srcjars += [ "$_dep_gen_dir/$_dep_name.srcjar" ]
1180 } 1269 }
1181 1270
1182 # Mark srcjar_deps as used. 1271 # Mark srcjar_deps as used.
1183 assert(_srcjar_deps == [] || true) 1272 assert(_srcjar_deps == [] || true)
1184 1273
1185 _rebased_build_config = rebase_path(_build_config, root_build_dir) 1274 _rebased_build_config = rebase_path(_build_config, root_build_dir)
1186 _rebased_jar_path = rebase_path(_intermediate_jar_path, root_build_dir) 1275 _rebased_jar_path = rebase_path(_javac_jar_path, root_build_dir)
1187 1276
1188 _javac_target_name = "${target_name}__javac" 1277 _javac_target_name = "${target_name}__javac"
1189 _finish_target_name = "${target_name}__finish" 1278 _process_prebuilt_target_name = "${target_name}__process_prebuilt"
1279 _emma_instr_target_name = "${target_name}__emma_instr"
1280 _ijar_target_name = "${target_name}__ijar"
1190 _final_target_name = target_name 1281 _final_target_name = target_name
1191 1282
1192 action(_javac_target_name) { 1283 action(_javac_target_name) {
1193 script = "//build/android/gyp/javac.py" 1284 script = "//build/android/gyp/javac.py"
1194 depfile = "$target_gen_dir/$target_name.d" 1285 depfile = "$target_gen_dir/$target_name.d"
1195 deps = _srcjar_deps 1286 deps = _srcjar_deps
1196 if (defined(invoker.deps)) { 1287 if (defined(invoker.deps)) {
1197 deps += invoker.deps 1288 deps += invoker.deps
1198 } 1289 }
1199 1290
1200 outputs = [ 1291 outputs = [
1201 depfile, 1292 depfile,
1202 _intermediate_jar_path, 1293 _javac_jar_path,
1203 _intermediate_jar_path + ".md5.stamp", 1294 _javac_jar_path + ".md5.stamp",
1204 ] 1295 ]
1205 sources = _java_files + _java_srcjars 1296 sources = _java_files + _java_srcjars
1206 inputs = [ 1297 inputs = [
1207 _build_config, 1298 _build_config,
1208 ] 1299 ]
1209 1300
1210 _rebased_java_srcjars = rebase_path(_java_srcjars, root_build_dir) 1301 _rebased_java_srcjars = rebase_path(_java_srcjars, root_build_dir)
1211 _rebased_depfile = rebase_path(depfile, root_build_dir) 1302 _rebased_depfile = rebase_path(depfile, root_build_dir)
1212 args = [ 1303 args = [
1213 "--depfile=$_rebased_depfile", 1304 "--depfile=$_rebased_depfile",
1214 "--use-ijars", 1305 "--use-ijars",
1215 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", 1306 "--classpath=@FileArg($_rebased_build_config:javac:classpath)",
1216 "--jar-path=$_rebased_jar_path", 1307 "--jar-path=$_rebased_jar_path",
1217 "--java-srcjars=$_rebased_java_srcjars", 1308 "--java-srcjars=$_rebased_java_srcjars",
1218 "--java-srcjars=@FileArg($_rebased_build_config:javac:srcjars)", 1309 "--java-srcjars=@FileArg($_rebased_build_config:javac:srcjars)",
1219 "--jar-excluded-classes=$_jar_excluded_patterns", 1310 "--jar-excluded-classes=$_jar_excluded_patterns",
1220 ] 1311 ]
1221 if (_enable_incremental_javac) { 1312 if (_enable_incremental_javac) {
1222 args += [ "--incremental" ] 1313 args += [ "--incremental" ]
1223 deps += [ "//third_party/jmake" ] 1314 deps += [ "//third_party/jmake" ]
1224 outputs += [ "${_intermediate_jar_path}.pdb" ] 1315 outputs += [ "${_javac_jar_path}.pdb" ]
1225 } 1316 }
1226 if (_supports_android) { 1317 if (_supports_android) {
1227 if (defined(invoker.alternative_android_sdk_ijar)) { 1318 if (defined(invoker.alternative_android_sdk_ijar)) {
1228 deps += [ invoker.alternative_android_sdk_ijar_dep ] 1319 deps += [ invoker.alternative_android_sdk_ijar_dep ]
1229 _android_sdk_ijar = invoker.alternative_android_sdk_ijar 1320 _android_sdk_ijar = invoker.alternative_android_sdk_ijar
1230 } else { 1321 } else {
1231 deps += [ "//build/android:android_ijar" ] 1322 deps += [ "//build/android:android_ijar" ]
1232 _android_sdk_ijar = "$root_out_dir/lib.java/android.interface.jar" 1323 _android_sdk_ijar = "$root_out_dir/lib.java/android.interface.jar"
1233 } 1324 }
1234 inputs += [ _android_sdk_ijar ] 1325 inputs += [ _android_sdk_ijar ]
1235 _rebased_android_sdk_ijar = rebase_path(_android_sdk_ijar, root_build_dir) 1326 _rebased_android_sdk_ijar = rebase_path(_android_sdk_ijar, root_build_dir)
1236 args += [ "--bootclasspath=$_rebased_android_sdk_ijar" ] 1327 args += [ "--bootclasspath=$_rebased_android_sdk_ijar" ]
1237 } 1328 }
1238 foreach(e, _manifest_entries) { 1329 foreach(e, _manifest_entries) {
1239 args += [ "--manifest-entry=" + e ] 1330 args += [ "--manifest-entry=" + e ]
1240 } 1331 }
1241 if (_chromium_code) { 1332 if (_chromium_code) {
1242 args += [ "--chromium-code=1" ] 1333 args += [ "--chromium-code=1" ]
1243 } 1334 }
1244 if (_enable_errorprone) { 1335 if (_enable_errorprone) {
1245 deps += [ "//third_party/errorprone:chromium_errorprone" ] 1336 deps += [ "//third_party/errorprone:chromium_errorprone" ]
1246 args += [ 1337 args += [
1247 "--use-errorprone-path", 1338 "--use-errorprone-path",
1248 "bin/chromium_errorprone", 1339 "bin/chromium_errorprone",
1249 ] 1340 ]
1250 } 1341 }
1251 args += rebase_path(_java_files, root_build_dir) 1342 args += rebase_path(_java_files, root_build_dir)
1252 } 1343 }
1253 1344
1254 process_java_prebuilt(_finish_target_name) { 1345 process_java_prebuilt(_process_prebuilt_target_name) {
1255 visibility = [ ":$_final_target_name" ]
1256
1257 build_config = _build_config 1346 build_config = _build_config
1258 input_jar_path = _intermediate_jar_path 1347 input_jar_path = _javac_jar_path
1259 output_jar_path = _final_jar_path 1348 output_jar_path = _process_prebuilt_jar_path
1260 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { 1349 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
1261 proguard_preprocess = invoker.proguard_preprocess 1350 proguard_preprocess = invoker.proguard_preprocess
1262 proguard_config = invoker.proguard_config 1351 proguard_config = invoker.proguard_config
1263 } 1352 }
1264 deps = [ 1353 deps = [
1265 ":$_javac_target_name", 1354 ":$_javac_target_name",
1266 ] 1355 ]
1267 } 1356 }
1268 1357
1358 emma_instr(_emma_instr_target_name) {
1359 visibility = [
1360 ":$_ijar_target_name",
1361 ":$_final_target_name",
1362 ]
1363
1364 forward_variables_from(invoker, [ "emma_instrument" ])
1365
1366 input_jar_path = _process_prebuilt_jar_path
1367 output_jar_path = _final_jar_path
1368 source_files = _java_files
1369
1370 deps = [
1371 ":$_process_prebuilt_target_name",
1372 ]
1373 }
1374
1375 generate_interface_jar(_ijar_target_name) {
1376 input_jar = _final_jar_path
1377 output_jar = _final_ijar_path
1378 deps = [
1379 ":$_emma_instr_target_name",
1380 ]
1381 }
1382
1269 group(_final_target_name) { 1383 group(_final_target_name) {
1270 forward_variables_from(invoker, [ "visibility" ]) 1384 forward_variables_from(invoker, [ "visibility" ])
1271 public_deps = [ 1385 public_deps = [
1272 ":$_finish_target_name", 1386 ":$_emma_instr_target_name",
1387 ":$_ijar_target_name",
1273 ] 1388 ]
1274 } 1389 }
1275 } 1390 }
1276 1391
1277 template("java_library_impl") { 1392 template("java_library_impl") {
1278 set_sources_assignment_filter([]) 1393 set_sources_assignment_filter([])
1279 forward_variables_from(invoker, [ "testonly" ]) 1394 forward_variables_from(invoker, [ "testonly" ])
1280 1395
1281 assert( 1396 assert(
1282 defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir) || 1397 defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir) ||
(...skipping 21 matching lines...) Expand all
1304 defined(invoker.requires_android) && invoker.requires_android 1419 defined(invoker.requires_android) && invoker.requires_android
1305 assert(_requires_android || true) # Mark as used. 1420 assert(_requires_android || true) # Mark as used.
1306 _android_manifest = "//build/android/AndroidManifest.xml" 1421 _android_manifest = "//build/android/AndroidManifest.xml"
1307 if (defined(invoker.android_manifest)) { 1422 if (defined(invoker.android_manifest)) {
1308 _android_manifest = invoker.android_manifest 1423 _android_manifest = invoker.android_manifest
1309 } 1424 }
1310 assert(_android_manifest != "") # Mark as used. 1425 assert(_android_manifest != "") # Mark as used.
1311 _run_findbugs = defined(invoker.run_findbugs) && invoker.run_findbugs 1426 _run_findbugs = defined(invoker.run_findbugs) && invoker.run_findbugs
1312 assert(_run_findbugs || true) # Mark as used. 1427 assert(_run_findbugs || true) # Mark as used.
1313 1428
1429 _chromium_code = true
1430 if (defined(invoker.chromium_code)) {
1431 _chromium_code = invoker.chromium_code
1432 }
1433
1434 _emma_never_instrument = !_chromium_code
1435 if (defined(invoker.emma_never_instrument)) {
1436 _emma_never_instrument = invoker.emma_never_instrument
1437 }
1438 assert(_emma_never_instrument || true) # Mark as used
1439 _emma_instrument = emma_coverage && !_emma_never_instrument
1440
1314 if (_supports_android) { 1441 if (_supports_android) {
1315 _dex_path = _base_path + ".dex.jar" 1442 _dex_path = _base_path + ".dex.jar"
1316 if (defined(invoker.dex_path)) { 1443 if (defined(invoker.dex_path)) {
1317 _dex_path = invoker.dex_path 1444 _dex_path = invoker.dex_path
1318 } 1445 }
1319 } 1446 }
1320 1447
1321 # Define build_config_deps which will be a list of targets required to 1448 # Define build_config_deps which will be a list of targets required to
1322 # build the _build_config. 1449 # build the _build_config.
1323 if (defined(invoker.override_build_config)) { 1450 if (defined(invoker.override_build_config)) {
(...skipping 20 matching lines...) Expand all
1344 invoker.bypass_platform_checks 1471 invoker.bypass_platform_checks
1345 1472
1346 build_config = _build_config 1473 build_config = _build_config
1347 jar_path = _jar_path 1474 jar_path = _jar_path
1348 if (_supports_android) { 1475 if (_supports_android) {
1349 dex_path = _dex_path 1476 dex_path = _dex_path
1350 } 1477 }
1351 } 1478 }
1352 } 1479 }
1353 1480
1354 _chromium_code = true
1355 if (defined(invoker.chromium_code)) {
1356 _chromium_code = invoker.chromium_code
1357 }
1358
1359 _srcjar_deps = [] 1481 _srcjar_deps = []
1360 if (defined(invoker.srcjar_deps)) { 1482 if (defined(invoker.srcjar_deps)) {
1361 _srcjar_deps = invoker.srcjar_deps 1483 _srcjar_deps = invoker.srcjar_deps
1362 } 1484 }
1363 1485
1364 _srcjars = [] 1486 _srcjars = []
1365 if (defined(invoker.srcjars)) { 1487 if (defined(invoker.srcjars)) {
1366 _srcjars = invoker.srcjars 1488 _srcjars = invoker.srcjars
1367 } 1489 }
1368 1490
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 "proguard_config", 1529 "proguard_config",
1408 "proguard_preprocess", 1530 "proguard_preprocess",
1409 ]) 1531 ])
1410 jar_path = _jar_path 1532 jar_path = _jar_path
1411 build_config = _build_config 1533 build_config = _build_config
1412 java_files = _java_files 1534 java_files = _java_files
1413 srcjar_deps = _srcjar_deps 1535 srcjar_deps = _srcjar_deps
1414 srcjars = _srcjars 1536 srcjars = _srcjars
1415 chromium_code = _chromium_code 1537 chromium_code = _chromium_code
1416 supports_android = _supports_android 1538 supports_android = _supports_android
1539 emma_instrument = _emma_instrument
1417 deps = build_config_deps 1540 deps = build_config_deps
1418 } 1541 }
1419 1542
1420 if (defined(invoker.main_class)) { 1543 if (defined(invoker.main_class)) {
1421 _final_datadeps += [ ":${_template_name}__java_binary_script" ] 1544 _final_datadeps += [ ":${_template_name}__java_binary_script" ]
1422 java_binary_script("${_template_name}__java_binary_script") { 1545 java_binary_script("${_template_name}__java_binary_script") {
1423 forward_variables_from(invoker, 1546 forward_variables_from(invoker,
1424 [ 1547 [
1425 "bootclasspath", 1548 "bootclasspath",
1426 "main_class", 1549 "main_class",
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 } 1582 }
1460 } 1583 }
1461 } 1584 }
1462 1585
1463 _final_deps += [ ":${_template_name}__dex" ] 1586 _final_deps += [ ":${_template_name}__dex" ]
1464 dex("${_template_name}__dex") { 1587 dex("${_template_name}__dex") {
1465 sources = [ 1588 sources = [
1466 _jar_path, 1589 _jar_path,
1467 ] 1590 ]
1468 output = _dex_path 1591 output = _dex_path
1592 no_locals = _emma_instrument
1469 deps = [ 1593 deps = [
1470 ":$_compile_java_target", 1594 ":$_compile_java_target",
1471 ] 1595 ]
1472 } 1596 }
1473 } 1597 }
1474 1598
1475 group(target_name) { 1599 group(target_name) {
1476 forward_variables_from(invoker, [ "visibility" ]) 1600 forward_variables_from(invoker, [ "visibility" ])
1477 public_deps = _final_deps 1601 public_deps = _final_deps
1478 data_deps = _final_datadeps 1602 data_deps = _final_datadeps
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 ] 1911 ]
1788 args = [ 1912 args = [
1789 "--depfile", 1913 "--depfile",
1790 rebase_path(depfile, root_build_dir), 1914 rebase_path(depfile, root_build_dir),
1791 "--script-output-path", 1915 "--script-output-path",
1792 rebase_path(generated_script, root_build_dir), 1916 rebase_path(generated_script, root_build_dir),
1793 ] 1917 ]
1794 args += test_runner_args 1918 args += test_runner_args
1795 } 1919 }
1796 } 1920 }
OLDNEW
« no previous file with comments | « build/config/android/config.gni ('k') | build/config/android/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698