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

Side by Side Diff: build/config/android/internal_rules.gni

Issue 2543463002: Add retrolambda.py and integrate it to build process. (Closed)
Patch Set: Addressing comments Created 4 years 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 # 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_overrides/build.gni") 7 import("//build_overrides/build.gni")
8 import("//build/config/android/config.gni") 8 import("//build/config/android/config.gni")
9 import("//build/config/dcheck_always_on.gni") 9 import("//build/config/dcheck_always_on.gni")
10 import("//build/config/sanitizers/sanitizers.gni") 10 import("//build/config/sanitizers/sanitizers.gni")
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 rebased_renaming_sources = 411 rebased_renaming_sources =
412 rebase_path(invoker.renaming_sources, root_build_dir) 412 rebase_path(invoker.renaming_sources, root_build_dir)
413 args += [ "--renaming-sources=$rebased_renaming_sources" ] 413 args += [ "--renaming-sources=$rebased_renaming_sources" ]
414 414
415 renaming_destinations = invoker.renaming_destinations 415 renaming_destinations = invoker.renaming_destinations
416 args += [ "--renaming-destinations=$renaming_destinations" ] 416 args += [ "--renaming-destinations=$renaming_destinations" ]
417 } 417 }
418 } 418 }
419 } 419 }
420 420
421 # Generates a script in the output bin directory which runs the test 421 # Generates a script in the build bin directory which runs the test
422 # target using the test runner script in build/android/test_runner.py. 422 # target using the test runner script in build/android/test_runner.py.
423 template("test_runner_script") { 423 template("test_runner_script") {
424 testonly = true 424 testonly = true
425 _test_name = invoker.test_name 425 _test_name = invoker.test_name
426 _test_type = invoker.test_type 426 _test_type = invoker.test_type
427 _incremental_install = 427 _incremental_install =
428 defined(invoker.incremental_install) && invoker.incremental_install 428 defined(invoker.incremental_install) && invoker.incremental_install
429 429
430 _runtime_deps = 430 _runtime_deps =
431 !defined(invoker.ignore_all_data_deps) || !invoker.ignore_all_data_deps 431 !defined(invoker.ignore_all_data_deps) || !invoker.ignore_all_data_deps
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 rebase_path(_result_path, root_build_dir), 812 rebase_path(_result_path, root_build_dir),
813 rebase_path(invoker.jar_path, root_build_dir), 813 rebase_path(invoker.jar_path, root_build_dir),
814 ] 814 ]
815 815
816 if (findbugs_verbose) { 816 if (findbugs_verbose) {
817 args += [ "-vv" ] 817 args += [ "-vv" ]
818 } 818 }
819 } 819 }
820 } 820 }
821 821
822 # Generates a script in the output bin.java directory to run a java binary. 822 # Generates a script in the build bin directory to run a java binary.
823 # 823 #
824 # Variables 824 # Variables
825 # main_class: The class containing the progam entry point. 825 # main_class: The class containing the program entry point.
826 # jar_path: The path to the jar to run. 826 # jar_path: The path to the jar to run.
827 # script_name: Name of the script to generate. 827 # script_name: Name of the script to generate.
828 # build_config: Path to .build_config for the jar (contains classpath). 828 # build_config: Path to .build_config for the jar (contains classpath).
829 # wrapper_script_args: List of extra arguments to pass to the executable. 829 # wrapper_script_args: List of extra arguments to pass to the executable.
830 # 830 #
831 template("java_binary_script") { 831 template("java_binary_script") {
832 set_sources_assignment_filter([]) 832 set_sources_assignment_filter([])
833 forward_variables_from(invoker, [ "testonly" ]) 833 forward_variables_from(invoker, [ "testonly" ])
834 834
835 _main_class = invoker.main_class 835 _main_class = invoker.main_class
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 forward_variables_from(invoker, [ "testonly" ]) 993 forward_variables_from(invoker, [ "testonly" ])
994 994
995 assert(invoker.build_config != "") 995 assert(invoker.build_config != "")
996 _build_config = invoker.build_config 996 _build_config = invoker.build_config
997 _rebased_build_config = rebase_path(_build_config, root_build_dir) 997 _rebased_build_config = rebase_path(_build_config, root_build_dir)
998 assert(_rebased_build_config != "" || true) # Mark used. 998 assert(_rebased_build_config != "" || true) # Mark used.
999 999
1000 _input_jar_path = invoker.input_jar_path 1000 _input_jar_path = invoker.input_jar_path
1001 _output_jar_path = invoker.output_jar_path 1001 _output_jar_path = invoker.output_jar_path
1002 1002
1003 _proguard_preprocess =
1004 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess
1005
1006 _jar_excluded_patterns = [] 1003 _jar_excluded_patterns = []
1007 if (defined(invoker.jar_excluded_patterns)) { 1004 if (defined(invoker.jar_excluded_patterns)) {
1008 _jar_excluded_patterns = invoker.jar_excluded_patterns 1005 _jar_excluded_patterns = invoker.jar_excluded_patterns
1009 } 1006 }
1010 _strip_resource_classes = defined(invoker.strip_resource_classes) && 1007 _strip_resource_classes = defined(invoker.strip_resource_classes) &&
1011 invoker.strip_resource_classes 1008 invoker.strip_resource_classes
1012 _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes 1009 _filter_jar = _jar_excluded_patterns != [] || _strip_resource_classes
1013 1010
1011 _proguard_preprocess =
1012 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess
1013
1014 _enable_assert = 1014 _enable_assert =
1015 defined(invoker.supports_android) && invoker.supports_android && 1015 defined(invoker.supports_android) && invoker.supports_android &&
1016 (is_java_debug || dcheck_always_on) 1016 (is_java_debug || dcheck_always_on)
1017 assert(_enable_assert || true) # Mark used. 1017
1018 _retrolambda = defined(invoker.supports_android) &&
1019 invoker.supports_android && use_java8
1020
1021 _deps = []
1022 _previous_output_jar = _input_jar_path
1018 1023
1019 if (_filter_jar) { 1024 if (_filter_jar) {
1020 _filter_target = "${target_name}__filter" 1025 _filter_target = "${target_name}__filter"
1026 _filter_input_jar = _previous_output_jar
1027 _filter_output_jar = "$target_out_dir/$target_name-filtered.jar"
1021 1028
1022 _filter_jar_path = "$target_out_dir/$target_name-filtered.jar"
1023 action(_filter_target) { 1029 action(_filter_target) {
1024 script = "//build/android/gyp/jar.py" 1030 script = "//build/android/gyp/jar.py"
1025 forward_variables_from(invoker, 1031 deps = _deps
1026 [ 1032 if (defined(invoker.deps)) {
1027 "deps", 1033 deps += invoker.deps
1028 "public_deps", 1034 }
1029 ]) 1035 if (defined(invoker.public_deps)) {
1036 public_deps = invoker.public_deps
1037 }
1030 inputs = [ 1038 inputs = [
1031 _build_config, 1039 _build_config,
1032 _input_jar_path, 1040 _filter_input_jar,
1033 ] 1041 ]
1034 outputs = [ 1042 outputs = [
1035 _filter_jar_path, 1043 _filter_output_jar,
1036 ] 1044 ]
1037 args = [ 1045 args = [
1038 "--input-jar", 1046 "--input-jar",
1039 rebase_path(_input_jar_path, root_build_dir), 1047 rebase_path(_filter_input_jar, root_build_dir),
1040 "--jar-path", 1048 "--jar-path",
1041 rebase_path(_filter_jar_path, root_build_dir), 1049 rebase_path(_filter_output_jar, root_build_dir),
1042 "--excluded-classes=$_jar_excluded_patterns", 1050 "--excluded-classes=$_jar_excluded_patterns",
1043 ] 1051 ]
1044 if (_strip_resource_classes) { 1052 if (_strip_resource_classes) {
1045 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_confi g:javac:resource_packages)" ] 1053 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_confi g:javac:resource_packages)" ]
1046 } 1054 }
1047 } 1055 }
1056
1057 _deps = []
1058 _deps = [ ":$_filter_target" ]
1059 _previous_output_jar = _filter_output_jar
1048 } 1060 }
1049 1061
1050 if (_proguard_preprocess) { 1062 if (_proguard_preprocess) {
1051 _output_jar_target = "${target_name}__proguard_process" 1063 _proguard_target = "${target_name}__proguard_process"
1052 _proguard_output_jar = _output_jar_path 1064 _proguard_input_jar = _previous_output_jar
1065 _proguard_output_jar = "$target_out_dir/$target_name-proguarded.jar"
1053 _proguard_config_path = invoker.proguard_preprocess_config 1066 _proguard_config_path = invoker.proguard_preprocess_config
1054 proguard(_output_jar_target) { 1067
1055 if (_filter_jar) { 1068 proguard(_proguard_target) {
1056 _proguard_input_jar = _filter_jar_path 1069 deps = _deps
1057 deps = [
1058 ":$_filter_target",
1059 ]
1060 } else {
1061 _proguard_input_jar = _input_jar_path
1062 deps = []
1063 }
1064 if (defined(invoker.deps)) { 1070 if (defined(invoker.deps)) {
1065 deps += invoker.deps 1071 deps += invoker.deps
1066 } 1072 }
1067 if (defined(invoker.public_deps)) { 1073 if (defined(invoker.public_deps)) {
1068 public_deps = invoker.public_deps 1074 public_deps = invoker.public_deps
1069 } 1075 }
1070 inputs = [ 1076 inputs = [
1071 _build_config, 1077 _build_config,
1072 _proguard_config_path, 1078 _proguard_config_path,
1073 _proguard_input_jar, 1079 _proguard_input_jar,
1074 ] 1080 ]
1075 output_jar_path = _proguard_output_jar 1081 output_jar_path = _proguard_output_jar
1076 1082
1077 _rebased_input_paths = 1083 _rebased_input_paths =
1078 [ rebase_path(_proguard_input_jar, root_build_dir) ] 1084 [ rebase_path(_proguard_input_jar, root_build_dir) ]
1079 _rebased_proguard_configs = 1085 _rebased_proguard_configs =
1080 [ rebase_path(_proguard_config_path, root_build_dir) ] 1086 [ rebase_path(_proguard_config_path, root_build_dir) ]
1081 args = [ 1087 args = [
1082 "--input-paths=$_rebased_input_paths", 1088 "--input-paths=$_rebased_input_paths",
1083 "--proguard-configs=$_rebased_proguard_configs", 1089 "--proguard-configs=$_rebased_proguard_configs",
1084 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", 1090 "--classpath=@FileArg($_rebased_build_config:javac:classpath)",
1085 ] 1091 ]
1086 } 1092 }
1087 } else if (_enable_assert) { 1093
1088 _output_jar_target = "${target_name}__assert" 1094 _deps = []
1089 _assert_output_jar = _output_jar_path 1095 _deps = [ ":$_proguard_target" ]
1090 action(_output_jar_target) { 1096 _previous_output_jar = _proguard_output_jar
1091 script = "$root_out_dir/bin/helper/java_assertion_enabler" 1097 }
1098
1099 if (_enable_assert) {
1100 _assert_target = "${target_name}__assert"
1101 _assert_input_jar = _previous_output_jar
1102 _assert_output_jar = "$target_out_dir/$target_name-asserted.jar"
1103
1104 action(_assert_target) {
1105 script = "$root_build_dir/bin/helper/java_assertion_enabler"
1092 deps = [ 1106 deps = [
1093 "//build/android/java_assertion_enabler($default_toolchain)", 1107 "//build/android/java_assertion_enabler($default_toolchain)",
1094 ] 1108 ]
1095 if (_filter_jar) { 1109 deps += _deps
1096 _assert_input_jar = _filter_jar_path
1097 deps += [ ":$_filter_target" ]
1098 } else {
1099 _assert_input_jar = _input_jar_path
1100 }
1101 if (defined(invoker.deps)) { 1110 if (defined(invoker.deps)) {
1102 deps += invoker.deps 1111 deps += invoker.deps
1103 } 1112 }
1104 if (defined(invoker.public_deps)) { 1113 if (defined(invoker.public_deps)) {
1105 public_deps = invoker.public_deps 1114 public_deps = invoker.public_deps
1106 } 1115 }
1107 inputs = [ 1116 inputs = [
1108 _assert_input_jar, 1117 _assert_input_jar,
1109 ] 1118 ]
1110 outputs = [ 1119 outputs = [
1111 _assert_output_jar, 1120 _assert_output_jar,
1112 ] 1121 ]
1113 args = [ 1122 args = [
1114 rebase_path(_assert_input_jar, root_build_dir), 1123 rebase_path(_assert_input_jar, root_build_dir),
1115 rebase_path(_assert_output_jar, root_build_dir), 1124 rebase_path(_assert_output_jar, root_build_dir),
1116 ] 1125 ]
1117 } 1126 }
1118 } else { 1127
1119 _output_jar_target = "${target_name}__copy" 1128 _deps = []
1120 copy(_output_jar_target) { 1129 _deps = [ ":$_assert_target" ]
1121 if (_filter_jar) { 1130 _previous_output_jar = _assert_output_jar
1122 _copy_input_jar = _filter_jar_path 1131 }
1123 public_deps = [ 1132
1124 ":$_filter_target", 1133 if (_retrolambda) {
1125 ] 1134 _retrolambda_target = "${target_name}__retrolambda"
1126 } else { 1135 _retrolambda_input_jar = _previous_output_jar
1127 _copy_input_jar = _input_jar_path 1136 _retrolambda_output_jar = "$target_out_dir/$target_name-retrolambda.jar"
1128 public_deps = [] 1137
1129 } 1138 android_sdk_jar = "$android_sdk/android.jar"
1139 action(_retrolambda_target) {
1140 script = "//build/android/gyp/retrolambda.py"
1141 deps = _deps
1130 if (defined(invoker.deps)) { 1142 if (defined(invoker.deps)) {
1131 deps = invoker.deps 1143 deps += invoker.deps
1132 } 1144 }
1133 if (defined(invoker.public_deps)) { 1145 if (defined(invoker.public_deps)) {
1134 public_deps += invoker.public_deps 1146 public_deps = invoker.public_deps
1135 } 1147 }
1136 sources = [ 1148 inputs = [
1137 _copy_input_jar, 1149 _build_config,
1150 _retrolambda_input_jar,
1138 ] 1151 ]
1139 outputs = [ 1152 outputs = [
1140 _output_jar_path, 1153 _retrolambda_output_jar,
1154 ]
1155 args = [
1156 "--input-jar",
1157 rebase_path(_retrolambda_input_jar, root_build_dir),
1158 "--output-jar",
1159 rebase_path(_retrolambda_output_jar, root_build_dir),
1160 "--classpath=@FileArg($_rebased_build_config:javac:classpath)",
1161 "--android-sdk-jar",
1162 rebase_path(android_sdk_jar, root_build_dir),
1141 ] 1163 ]
1142 } 1164 }
1165
1166 _deps = []
1167 _deps = [ ":$_retrolambda_target" ]
1168 _previous_output_jar = _retrolambda_output_jar
1169 }
1170
1171 _output_jar_target = "${target_name}__copy"
1172 copy(_output_jar_target) {
1173 deps = _deps
1174 if (defined(invoker.deps)) {
1175 deps += invoker.deps
1176 }
1177 if (defined(invoker.public_deps)) {
1178 public_deps = invoker.public_deps
1179 }
1180 sources = [
1181 _previous_output_jar,
1182 ]
1183 outputs = [
1184 _output_jar_path,
1185 ]
1143 } 1186 }
1144 1187
1145 group(target_name) { 1188 group(target_name) {
1146 forward_variables_from(invoker, 1189 forward_variables_from(invoker,
1147 [ 1190 [
1148 "data_deps", 1191 "data_deps",
1149 "visibility", 1192 "visibility",
1150 ]) 1193 ])
1151 public_deps = [ 1194 public_deps = [
1152 ":$_output_jar_target", 1195 ":$_output_jar_target",
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 _android_sdk_ijar = invoker.alternative_android_sdk_ijar 2115 _android_sdk_ijar = invoker.alternative_android_sdk_ijar
2073 } else { 2116 } else {
2074 deps += [ "//build/android:android_ijar" ] 2117 deps += [ "//build/android:android_ijar" ]
2075 _android_sdk_ijar = "$root_out_dir/lib.java/android.interface.jar" 2118 _android_sdk_ijar = "$root_out_dir/lib.java/android.interface.jar"
2076 } 2119 }
2077 inputs += [ _android_sdk_ijar ] 2120 inputs += [ _android_sdk_ijar ]
2078 _rebased_android_sdk_ijar = 2121 _rebased_android_sdk_ijar =
2079 rebase_path(_android_sdk_ijar, root_build_dir) 2122 rebase_path(_android_sdk_ijar, root_build_dir)
2080 args += [ "--bootclasspath=$_rebased_android_sdk_ijar" ] 2123 args += [ "--bootclasspath=$_rebased_android_sdk_ijar" ]
2081 } 2124 }
2082 if (_supports_android) { 2125 if (use_java8) {
2126 args += [ "--java-version=1.8" ]
2127 } else if (_supports_android) {
2083 args += [ "--java-version=1.7" ] 2128 args += [ "--java-version=1.7" ]
2084 } 2129 }
2085 foreach(e, _manifest_entries) { 2130 foreach(e, _manifest_entries) {
2086 args += [ "--manifest-entry=" + e ] 2131 args += [ "--manifest-entry=" + e ]
2087 } 2132 }
2088 if (_chromium_code) { 2133 if (_chromium_code) {
2089 args += [ "--chromium-code=1" ] 2134 args += [ "--chromium-code=1" ]
2090 } 2135 }
2091 if (_enable_errorprone) { 2136 if (_enable_errorprone) {
2092 deps += [ "//third_party/errorprone:chromium_errorprone" ] 2137 deps += [ "//third_party/errorprone:chromium_errorprone" ]
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 rebase_path(root_build_dir, root_build_dir), 2775 rebase_path(root_build_dir, root_build_dir),
2731 "--packed-libraries-dir", 2776 "--packed-libraries-dir",
2732 rebase_path(_packed_libraries_dir, root_build_dir), 2777 rebase_path(_packed_libraries_dir, root_build_dir),
2733 "--libraries=${invoker.libraries_filearg}", 2778 "--libraries=${invoker.libraries_filearg}",
2734 "--filelistjson", 2779 "--filelistjson",
2735 rebase_path(invoker.file_list_json, root_build_dir), 2780 rebase_path(invoker.file_list_json, root_build_dir),
2736 ] 2781 ]
2737 } 2782 }
2738 } 2783 }
2739 } 2784 }
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