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 # Do not add any imports to non-//build directories here. | 5 # Do not add any imports to non-//build directories here. |
6 # Some projects (e.g. V8) do not have non-build directories DEPS'ed in. | 6 # Some projects (e.g. V8) do not have non-build directories DEPS'ed in. |
7 import("//build/config/android/config.gni") | 7 import("//build/config/android/config.gni") |
8 import("//build/config/android/internal_rules.gni") | 8 import("//build/config/android/internal_rules.gni") |
9 import("//build/config/compiler/compiler.gni") | 9 import("//build/config/compiler/compiler.gni") |
10 import("//build/config/dcheck_always_on.gni") | 10 import("//build/config/dcheck_always_on.gni") |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 # variables = ["color=red"] | 572 # variables = ["color=red"] |
573 # } | 573 # } |
574 template("jinja_template_resources") { | 574 template("jinja_template_resources") { |
575 set_sources_assignment_filter([]) | 575 set_sources_assignment_filter([]) |
576 forward_variables_from(invoker, [ "testonly" ]) | 576 forward_variables_from(invoker, [ "testonly" ]) |
577 | 577 |
578 assert(defined(invoker.resources)) | 578 assert(defined(invoker.resources)) |
579 assert(defined(invoker.res_dir)) | 579 assert(defined(invoker.res_dir)) |
580 | 580 |
581 _base_path = "$target_gen_dir/$target_name" | 581 _base_path = "$target_gen_dir/$target_name" |
582 | 582 _resources_zip = _base_path + ".resources.zip" |
583 # JUnit tests use resource zip files. These must not be put in gen/ | |
584 # directory or they will not be available to tester bots. | |
585 _resources_zip = "${target_out_dir}/${target_name}.resources.zip" | |
586 _build_config = _base_path + ".build_config" | 583 _build_config = _base_path + ".build_config" |
587 | 584 |
588 write_build_config("${target_name}__build_config") { | 585 write_build_config("${target_name}__build_config") { |
589 build_config = _build_config | 586 build_config = _build_config |
590 resources_zip = _resources_zip | 587 resources_zip = _resources_zip |
591 type = "android_resources" | 588 type = "android_resources" |
592 if (defined(invoker.deps)) { | 589 if (defined(invoker.deps)) { |
593 possible_config_deps = invoker.deps | 590 possible_config_deps = invoker.deps |
594 } | 591 } |
595 } | 592 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 # deps = [":foo_resources"] | 669 # deps = [":foo_resources"] |
673 # resource_dirs = ["res_overrides"] | 670 # resource_dirs = ["res_overrides"] |
674 # } | 671 # } |
675 template("android_resources") { | 672 template("android_resources") { |
676 set_sources_assignment_filter([]) | 673 set_sources_assignment_filter([]) |
677 forward_variables_from(invoker, [ "testonly" ]) | 674 forward_variables_from(invoker, [ "testonly" ]) |
678 | 675 |
679 assert(defined(invoker.resource_dirs)) | 676 assert(defined(invoker.resource_dirs)) |
680 | 677 |
681 base_path = "$target_gen_dir/$target_name" | 678 base_path = "$target_gen_dir/$target_name" |
682 | 679 zip_path = base_path + ".resources.zip" |
683 # JUnit tests use resource zip files. These must not be put in gen/ | |
684 # directory or they will not be available to tester bots. | |
685 zip_path = "${target_out_dir}/${target_name}.resources.zip" | |
686 srcjar_path = base_path + ".srcjar" | 680 srcjar_path = base_path + ".srcjar" |
687 r_text_out_path = base_path + "_R.txt" | 681 r_text_out_path = base_path + "_R.txt" |
688 build_config = base_path + ".build_config" | 682 build_config = base_path + ".build_config" |
689 | 683 |
690 build_config_target_name = "${target_name}__build_config" | 684 build_config_target_name = "${target_name}__build_config" |
691 process_resources_target_name = "${target_name}__process_resources" | 685 process_resources_target_name = "${target_name}__process_resources" |
692 final_target_name = target_name | 686 final_target_name = target_name |
693 | 687 |
694 write_build_config(build_config_target_name) { | 688 write_build_config(build_config_target_name) { |
695 type = "android_resources" | 689 type = "android_resources" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 # | 888 # |
895 # Example | 889 # Example |
896 # java_strings_grd("foo_strings_grd") { | 890 # java_strings_grd("foo_strings_grd") { |
897 # grd_file = "foo_strings.grd" | 891 # grd_file = "foo_strings.grd" |
898 # } | 892 # } |
899 template("java_strings_grd") { | 893 template("java_strings_grd") { |
900 set_sources_assignment_filter([]) | 894 set_sources_assignment_filter([]) |
901 forward_variables_from(invoker, [ "testonly" ]) | 895 forward_variables_from(invoker, [ "testonly" ]) |
902 | 896 |
903 base_path = "$target_gen_dir/$target_name" | 897 base_path = "$target_gen_dir/$target_name" |
904 | 898 resources_zip = base_path + ".resources.zip" |
905 # JUnit tests use resource zip files. These must not be put in gen/ | |
906 # directory or they will not be available to tester bots. | |
907 resources_zip = "${target_out_dir}/${target_name}.resources.zip" | |
908 build_config = base_path + ".build_config" | 899 build_config = base_path + ".build_config" |
909 | 900 |
910 write_build_config("${target_name}__build_config") { | 901 write_build_config("${target_name}__build_config") { |
911 type = "android_resources" | 902 type = "android_resources" |
912 } | 903 } |
913 | 904 |
914 # Put grit files into this subdirectory of target_gen_dir. | 905 # Put grit files into this subdirectory of target_gen_dir. |
915 extra_output_path = target_name + "_grit_output" | 906 extra_output_path = target_name + "_grit_output" |
916 | 907 |
917 grit_target_name = "${target_name}__grit" | 908 grit_target_name = "${target_name}__grit" |
918 grit_output_dir = "$target_gen_dir/$extra_output_path" | 909 grit_output_dir = "$target_gen_dir/$extra_output_path" |
919 | |
920 grit(grit_target_name) { | 910 grit(grit_target_name) { |
921 forward_variables_from(invoker, [ "deps" ]) | 911 forward_variables_from(invoker, [ "deps" ]) |
922 grit_flags = [ | 912 grit_flags = [ |
923 "-E", | 913 "-E", |
924 "ANDROID_JAVA_TAGGED_ONLY=false", | 914 "ANDROID_JAVA_TAGGED_ONLY=false", |
925 ] | 915 ] |
926 output_dir = grit_output_dir | 916 output_dir = grit_output_dir |
927 resource_ids = "" | 917 resource_ids = "" |
928 source = invoker.grd_file | 918 source = invoker.grd_file |
929 outputs = invoker.outputs | 919 outputs = invoker.outputs |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 # grit_output_dir = "$root_gen_dir/foo/grit" | 954 # grit_output_dir = "$root_gen_dir/foo/grit" |
965 # generated_files = [ | 955 # generated_files = [ |
966 # "values/strings.xml" | 956 # "values/strings.xml" |
967 # ] | 957 # ] |
968 # } | 958 # } |
969 template("java_strings_grd_prebuilt") { | 959 template("java_strings_grd_prebuilt") { |
970 set_sources_assignment_filter([]) | 960 set_sources_assignment_filter([]) |
971 forward_variables_from(invoker, [ "testonly" ]) | 961 forward_variables_from(invoker, [ "testonly" ]) |
972 | 962 |
973 base_path = "$target_gen_dir/$target_name" | 963 base_path = "$target_gen_dir/$target_name" |
974 | 964 resources_zip = base_path + ".resources.zip" |
975 # JUnit tests use resource zip files. These must not be put in gen/ | |
976 # directory or they will not be available to tester bots. | |
977 resources_zip = "${target_out_dir}/${target_name}.resources.zip" | |
978 build_config = base_path + ".build_config" | 965 build_config = base_path + ".build_config" |
979 | 966 |
980 build_config_target_name = "${target_name}__build_config" | 967 build_config_target_name = "${target_name}__build_config" |
981 zip_target_name = "${target_name}__zip" | 968 zip_target_name = "${target_name}__zip" |
982 final_target_name = target_name | 969 final_target_name = target_name |
983 | 970 |
984 write_build_config(build_config_target_name) { | 971 write_build_config(build_config_target_name) { |
985 type = "android_resources" | 972 type = "android_resources" |
986 } | 973 } |
987 | 974 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 # java_files = [ "org/chromium/foo/FooTest.java" ] | 1060 # java_files = [ "org/chromium/foo/FooTest.java" ] |
1074 # deps = [ ":bar_java" ] | 1061 # deps = [ ":bar_java" ] |
1075 # } | 1062 # } |
1076 template("junit_binary") { | 1063 template("junit_binary") { |
1077 set_sources_assignment_filter([]) | 1064 set_sources_assignment_filter([]) |
1078 testonly = true | 1065 testonly = true |
1079 | 1066 |
1080 _java_binary_target_name = "${target_name}__java_binary" | 1067 _java_binary_target_name = "${target_name}__java_binary" |
1081 _test_runner_target_name = "${target_name}__test_runner_script" | 1068 _test_runner_target_name = "${target_name}__test_runner_script" |
1082 | 1069 |
1083 _build_config = "$target_gen_dir/$target_name.build_config" | |
1084 _build_config_target_name = "${target_name}__build_config" | |
1085 | |
1086 write_build_config(_build_config_target_name) { | |
1087 type = "junit_binary" | |
1088 build_config = _build_config | |
1089 if (defined(invoker.deps)) { | |
1090 possible_config_deps = invoker.deps | |
1091 } | |
1092 } | |
1093 | |
1094 test_runner_script(_test_runner_target_name) { | 1070 test_runner_script(_test_runner_target_name) { |
1095 test_name = invoker.target_name | 1071 test_name = invoker.target_name |
1096 test_suite = invoker.target_name | 1072 test_suite = invoker.target_name |
1097 test_type = "junit" | 1073 test_type = "junit" |
1098 ignore_all_data_deps = true | 1074 ignore_all_data_deps = true |
1099 forward_variables_from(invoker, | |
1100 [ | |
1101 "android_manifest_path", | |
1102 "package_name", | |
1103 ]) | |
1104 } | 1075 } |
1105 | 1076 |
1106 java_binary(_java_binary_target_name) { | 1077 java_binary(_java_binary_target_name) { |
1107 deps = [] | 1078 deps = [] |
1108 output_name = invoker.target_name | 1079 output_name = invoker.target_name |
1109 forward_variables_from(invoker, "*") | 1080 forward_variables_from(invoker, "*") |
1110 testonly = true | 1081 testonly = true |
1111 bypass_platform_checks = true | 1082 bypass_platform_checks = true |
1112 main_class = "org.chromium.testing.local.JunitTestMain" | 1083 main_class = "org.chromium.testing.local.JunitTestMain" |
1113 wrapper_script_name = "helper/$target_name" | 1084 wrapper_script_name = "helper/$target_name" |
1114 deps += [ | 1085 deps += [ |
1115 "//testing/android/junit:junit_test_support", | 1086 "//testing/android/junit:junit_test_support", |
1116 "//third_party/junit", | 1087 "//third_party/junit", |
1117 "//third_party/mockito:mockito_java", | 1088 "//third_party/mockito:mockito_java", |
1118 "//third_party/robolectric:robolectric_all_java", | 1089 "//third_party/robolectric:robolectric_all_java", |
1119 ] | 1090 ] |
1120 } | 1091 } |
1121 group(target_name) { | 1092 group(target_name) { |
1122 public_deps = [ | 1093 public_deps = [ |
1123 ":$_build_config_target_name", | |
1124 ":$_java_binary_target_name", | 1094 ":$_java_binary_target_name", |
1125 ":$_test_runner_target_name", | 1095 ":$_test_runner_target_name", |
1126 ] | 1096 ] |
1127 } | 1097 } |
1128 } | 1098 } |
1129 | 1099 |
1130 # Declare a java library target | 1100 # Declare a java library target |
1131 # | 1101 # |
1132 # Variables | 1102 # Variables |
1133 # deps: Specifies the dependencies of this target. Java targets in this list | 1103 # deps: Specifies the dependencies of this target. Java targets in this list |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 # } | 1509 # } |
1540 template("android_apk") { | 1510 template("android_apk") { |
1541 set_sources_assignment_filter([]) | 1511 set_sources_assignment_filter([]) |
1542 forward_variables_from(invoker, [ "testonly" ]) | 1512 forward_variables_from(invoker, [ "testonly" ]) |
1543 | 1513 |
1544 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) | 1514 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) |
1545 assert(defined(invoker.android_manifest)) | 1515 assert(defined(invoker.android_manifest)) |
1546 gen_dir = "$target_gen_dir/$target_name" | 1516 gen_dir = "$target_gen_dir/$target_name" |
1547 base_path = "$gen_dir/$target_name" | 1517 base_path = "$gen_dir/$target_name" |
1548 _build_config = "$target_gen_dir/$target_name.build_config" | 1518 _build_config = "$target_gen_dir/$target_name.build_config" |
1549 | 1519 resources_zip_path = "$base_path.resources.zip" |
1550 # JUnit tests use resource zip files. These must not be put in gen/ | |
1551 # directory or they will not be available to tester bots. | |
1552 resources_zip_path = "${target_out_dir}/${target_name}.resources.zip" | |
1553 _all_resources_zip_path = "$base_path.resources.all.zip" | 1520 _all_resources_zip_path = "$base_path.resources.all.zip" |
1554 _jar_path = "$base_path.jar" | 1521 _jar_path = "$base_path.jar" |
1555 _lib_dex_path = "$base_path.dex.jar" | 1522 _lib_dex_path = "$base_path.dex.jar" |
1556 _rebased_lib_dex_path = rebase_path(_lib_dex_path, root_build_dir) | 1523 _rebased_lib_dex_path = rebase_path(_lib_dex_path, root_build_dir) |
1557 _template_name = target_name | 1524 _template_name = target_name |
1558 if (defined(invoker.java_files)) { | 1525 if (defined(invoker.java_files)) { |
1559 _java_sources_file = "$base_path.sources" | 1526 _java_sources_file = "$base_path.sources" |
1560 } | 1527 } |
1561 | 1528 |
1562 enable_multidex = | 1529 enable_multidex = |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2949 # because in practice they seem to contain classes required to be in the | 2916 # because in practice they seem to contain classes required to be in the |
2950 # classpath. | 2917 # classpath. |
2951 deps += _subjar_targets | 2918 deps += _subjar_targets |
2952 } | 2919 } |
2953 if (defined(_res_target_name)) { | 2920 if (defined(_res_target_name)) { |
2954 deps += [ ":$_res_target_name" ] | 2921 deps += [ ":$_res_target_name" ] |
2955 } | 2922 } |
2956 } | 2923 } |
2957 } | 2924 } |
2958 } | 2925 } |
OLD | NEW |