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("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 | 6 |
7 assert(is_android) | 7 assert(is_android) |
8 | 8 |
9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) | 9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) |
10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) | 10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 rebase_path(result_path, root_build_dir), | 107 rebase_path(result_path, root_build_dir), |
108 rebase_path(jar_path, root_build_dir), | 108 rebase_path(jar_path, root_build_dir), |
109 ] | 109 ] |
110 | 110 |
111 if (findbugs_verbose) { | 111 if (findbugs_verbose) { |
112 args += [ "-vv" ] | 112 args += [ "-vv" ] |
113 } | 113 } |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
| 117 # Generates a script in the output bin.java directory to run a java binary. |
| 118 template("java_binary_script") { |
| 119 set_sources_assignment_filter([]) |
| 120 forward_variables_from(invoker, [ "testonly" ]) |
| 121 |
| 122 _main_class = invoker.main_class |
| 123 _build_config = invoker.build_config |
| 124 _jar_path = invoker.jar_path |
| 125 _script_name = invoker.script_name |
| 126 |
| 127 action(target_name) { |
| 128 script = "//build/android/gyp/create_java_binary_script.py" |
| 129 depfile = "$target_gen_dir/$_script_name.d" |
| 130 java_script = "$root_build_dir/bin/$_script_name" |
| 131 inputs = [ |
| 132 _build_config, |
| 133 ] |
| 134 outputs = [ |
| 135 depfile, |
| 136 java_script, |
| 137 ] |
| 138 forward_variables_from(invoker, [ "deps" ]) |
| 139 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
| 140 args = [ |
| 141 "--depfile", |
| 142 rebase_path(depfile, root_build_dir), |
| 143 "--output", |
| 144 rebase_path(java_script, root_build_dir), |
| 145 "--classpath=@FileArg($_rebased_build_config:java:full_classpath)", |
| 146 "--jar-path", |
| 147 rebase_path(_jar_path, root_build_dir), |
| 148 "--main-class", |
| 149 _main_class, |
| 150 ] |
| 151 } |
| 152 } |
| 153 |
117 template("dex") { | 154 template("dex") { |
118 set_sources_assignment_filter([]) | 155 set_sources_assignment_filter([]) |
119 | 156 |
120 assert(defined(invoker.output)) | 157 assert(defined(invoker.output)) |
121 action(target_name) { | 158 action(target_name) { |
122 forward_variables_from(invoker, | 159 forward_variables_from(invoker, |
123 [ | 160 [ |
124 "deps", | 161 "deps", |
125 "inputs", | 162 "inputs", |
126 "sources", | 163 "sources", |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 if (_supports_android) { | 875 if (_supports_android) { |
839 dex(dex_target_name) { | 876 dex(dex_target_name) { |
840 sources = [ | 877 sources = [ |
841 _jar_path, | 878 _jar_path, |
842 ] | 879 ] |
843 output = _dex_path | 880 output = _dex_path |
844 deps = [ ":$process_jar_target_name" ] + _deps + _jar_deps | 881 deps = [ ":$process_jar_target_name" ] + _deps + _jar_deps |
845 } | 882 } |
846 } | 883 } |
847 | 884 |
| 885 if (defined(invoker.main_class)) { |
| 886 binary_script_target_name = "${_template_name}__java_binary_script" |
| 887 java_binary_script(binary_script_target_name) { |
| 888 build_config = _build_config |
| 889 jar_path = _jar_path |
| 890 main_class = invoker.main_class |
| 891 script_name = _template_name |
| 892 deps = [ |
| 893 ":$build_config_target_name", |
| 894 ] |
| 895 } |
| 896 } |
| 897 |
848 group(target_name) { | 898 group(target_name) { |
849 forward_variables_from(invoker, [ "data_deps" ]) | 899 forward_variables_from(invoker, [ "data_deps" ]) |
850 deps = [ | 900 deps = [ |
851 ":$process_jar_target_name", | 901 ":$process_jar_target_name", |
852 ] | 902 ] |
853 if (_supports_android) { | 903 if (_supports_android) { |
854 deps += [ ":$dex_target_name" ] | 904 deps += [ ":$dex_target_name" ] |
855 } | 905 } |
| 906 data_deps = [] |
| 907 if (defined(invoker.data_deps)) { |
| 908 data_deps += invoker.data_deps |
| 909 } |
| 910 if (defined(invoker.main_class)) { |
| 911 data_deps += [ ":$binary_script_target_name" ] |
| 912 } |
856 } | 913 } |
857 } | 914 } |
858 | 915 |
859 # Compiles and jars a set of java files. | 916 # Compiles and jars a set of java files. |
860 # | 917 # |
861 # Outputs: | 918 # Outputs: |
862 # $jar_path.jar | 919 # $jar_path.jar |
863 # $jar_path.jar.TOC | 920 # $jar_path.jar.TOC |
864 # | 921 # |
865 # Variables | 922 # Variables |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 srcjar_deps = _srcjar_deps | 1190 srcjar_deps = _srcjar_deps |
1134 srcjars = _srcjars | 1191 srcjars = _srcjars |
1135 chromium_code = _chromium_code | 1192 chromium_code = _chromium_code |
1136 android = _requires_android | 1193 android = _requires_android |
1137 | 1194 |
1138 supports_android = _supports_android | 1195 supports_android = _supports_android |
1139 deps = build_config_deps | 1196 deps = build_config_deps |
1140 } | 1197 } |
1141 | 1198 |
1142 if (defined(invoker.main_class)) { | 1199 if (defined(invoker.main_class)) { |
1143 _final_deps += [ ":${_template_name}__binary_script" ] | 1200 _final_datadeps += [ ":${_template_name}__java_binary_script" ] |
1144 action("${_template_name}__binary_script") { | 1201 java_binary_script("${_template_name}__java_binary_script") { |
1145 script = "//build/android/gyp/create_java_binary_script.py" | 1202 build_config = _build_config |
1146 depfile = "$target_gen_dir/$target_name.d" | 1203 jar_path = _jar_path |
1147 java_script = "$root_build_dir/bin/$_template_name" | 1204 main_class = invoker.main_class |
1148 inputs = [ | 1205 script_name = _template_name |
1149 _build_config, | |
1150 ] | |
1151 outputs = [ | |
1152 depfile, | |
1153 java_script, | |
1154 ] | |
1155 _rebased_build_config = rebase_path(_build_config, root_build_dir) | |
1156 args = [ | |
1157 "--depfile", | |
1158 rebase_path(depfile, root_build_dir), | |
1159 "--output", | |
1160 rebase_path(java_script, root_build_dir), | |
1161 "--classpath=@FileArg($_rebased_build_config:java:full_classpath)", | |
1162 "--jar-path", | |
1163 rebase_path(_jar_path, root_build_dir), | |
1164 "--main-class", | |
1165 invoker.main_class, | |
1166 ] | |
1167 | |
1168 deps = build_config_deps | 1206 deps = build_config_deps |
1169 } | 1207 } |
1170 } | 1208 } |
1171 | 1209 |
1172 if (_supports_android) { | 1210 if (_supports_android) { |
1173 if (defined(invoker.chromium_code) && invoker.chromium_code) { | 1211 if (defined(invoker.chromium_code) && invoker.chromium_code) { |
1174 _android_manifest = "//build/android/AndroidManifest.xml" | 1212 _android_manifest = "//build/android/AndroidManifest.xml" |
1175 if (defined(invoker.android_manifest)) { | 1213 if (defined(invoker.android_manifest)) { |
1176 _android_manifest = invoker.android_manifest | 1214 _android_manifest = invoker.android_manifest |
1177 } | 1215 } |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 ] | 1540 ] |
1503 args = [ | 1541 args = [ |
1504 "--depfile", | 1542 "--depfile", |
1505 rebase_path(depfile, root_build_dir), | 1543 rebase_path(depfile, root_build_dir), |
1506 "--script-output-path", | 1544 "--script-output-path", |
1507 rebase_path(generated_script, root_build_dir), | 1545 rebase_path(generated_script, root_build_dir), |
1508 ] | 1546 ] |
1509 args += test_runner_args | 1547 args += test_runner_args |
1510 } | 1548 } |
1511 } | 1549 } |
OLD | NEW |