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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 rebase_path(exclusions_file, root_build_dir), | 112 rebase_path(exclusions_file, root_build_dir), |
113 "--auxclasspath-gyp", | 113 "--auxclasspath-gyp", |
114 "@FileArg($rebased_build_config:javac:classpath)", | 114 "@FileArg($rebased_build_config:javac:classpath)", |
115 "--output-file", | 115 "--output-file", |
116 rebase_path(result_path, root_build_dir), | 116 rebase_path(result_path, root_build_dir), |
117 rebase_path(jar_path, root_build_dir), | 117 rebase_path(jar_path, root_build_dir), |
118 ] | 118 ] |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
| 122 # Generates a script in the output bin.java directory to run a java binary. |
| 123 template("java_binary_script") { |
| 124 set_sources_assignment_filter([]) |
| 125 if (defined(invoker.testonly)) { |
| 126 testonly = invoker.testonly |
| 127 } |
| 128 |
| 129 _main_class = invoker.main_class |
| 130 _build_config = invoker.build_config |
| 131 _jar_path = invoker.jar_path |
| 132 _script_name = invoker.script_name |
| 133 |
| 134 action(target_name) { |
| 135 script = "//build/android/gyp/create_java_binary_script.py" |
| 136 depfile = "$target_gen_dir/$_script_name.d" |
| 137 java_script = "$root_build_dir/bin/$_script_name" |
| 138 inputs = [ |
| 139 _build_config, |
| 140 ] |
| 141 outputs = [ |
| 142 depfile, |
| 143 java_script, |
| 144 ] |
| 145 if (defined(invoker.deps)) { |
| 146 deps = invoker.deps |
| 147 } |
| 148 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
| 149 args = [ |
| 150 "--depfile", |
| 151 rebase_path(depfile, root_build_dir), |
| 152 "--output", |
| 153 rebase_path(java_script, root_build_dir), |
| 154 "--classpath=@FileArg($_rebased_build_config:java:full_classpath)", |
| 155 "--jar-path", |
| 156 rebase_path(_jar_path, root_build_dir), |
| 157 "--main-class", |
| 158 _main_class, |
| 159 ] |
| 160 } |
| 161 } |
| 162 |
122 template("dex") { | 163 template("dex") { |
123 set_sources_assignment_filter([]) | 164 set_sources_assignment_filter([]) |
124 if (defined(invoker.testonly)) { | 165 if (defined(invoker.testonly)) { |
125 testonly = invoker.testonly | 166 testonly = invoker.testonly |
126 } | 167 } |
127 | 168 |
128 assert(defined(invoker.output)) | 169 assert(defined(invoker.output)) |
129 action(target_name) { | 170 action(target_name) { |
130 script = "//build/android/gyp/dex.py" | 171 script = "//build/android/gyp/dex.py" |
131 depfile = "$target_gen_dir/$target_name.d" | 172 depfile = "$target_gen_dir/$target_name.d" |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 if (_supports_android) { | 927 if (_supports_android) { |
887 dex(dex_target_name) { | 928 dex(dex_target_name) { |
888 sources = [ | 929 sources = [ |
889 _jar_path, | 930 _jar_path, |
890 ] | 931 ] |
891 output = _dex_path | 932 output = _dex_path |
892 deps = [ ":$process_jar_target_name" ] + _deps + _jar_deps | 933 deps = [ ":$process_jar_target_name" ] + _deps + _jar_deps |
893 } | 934 } |
894 } | 935 } |
895 | 936 |
| 937 if (defined(invoker.main_class)) { |
| 938 binary_script_target_name = "${_template_name}__java_binary_script" |
| 939 java_binary_script(binary_script_target_name) { |
| 940 build_config = _build_config |
| 941 jar_path = _jar_path |
| 942 main_class = invoker.main_class |
| 943 script_name = _template_name |
| 944 deps = [ |
| 945 ":$build_config_target_name", |
| 946 ] |
| 947 } |
| 948 } |
| 949 |
896 group(target_name) { | 950 group(target_name) { |
897 deps = [ | 951 deps = [ |
898 ":$process_jar_target_name", | 952 ":$process_jar_target_name", |
899 ] | 953 ] |
900 if (defined(invoker.data_deps)) { | |
901 data_deps = invoker.data_deps | |
902 } | |
903 if (_supports_android) { | 954 if (_supports_android) { |
904 deps += [ ":$dex_target_name" ] | 955 deps += [ ":$dex_target_name" ] |
905 } | 956 } |
| 957 data_deps = [] |
| 958 if (defined(invoker.data_deps)) { |
| 959 data_deps += invoker.data_deps |
| 960 } |
| 961 if (defined(invoker.main_class)) { |
| 962 data_deps += [ ":$binary_script_target_name" ] |
| 963 } |
906 } | 964 } |
907 } | 965 } |
908 | 966 |
909 # Compiles and jars a set of java files. | 967 # Compiles and jars a set of java files. |
910 # | 968 # |
911 # Outputs: | 969 # Outputs: |
912 # $jar_path.jar | 970 # $jar_path.jar |
913 # $jar_path.jar.TOC | 971 # $jar_path.jar.TOC |
914 # | 972 # |
915 # Variables | 973 # Variables |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 } | 1261 } |
1204 if (defined(invoker.manifest_entries)) { | 1262 if (defined(invoker.manifest_entries)) { |
1205 manifest_entries = invoker.manifest_entries | 1263 manifest_entries = invoker.manifest_entries |
1206 } | 1264 } |
1207 | 1265 |
1208 supports_android = _supports_android | 1266 supports_android = _supports_android |
1209 deps = build_config_deps | 1267 deps = build_config_deps |
1210 } | 1268 } |
1211 | 1269 |
1212 if (defined(invoker.main_class)) { | 1270 if (defined(invoker.main_class)) { |
1213 _final_deps += [ ":${_template_name}__binary_script" ] | 1271 _final_datadeps += [ ":${_template_name}__java_binary_script" ] |
1214 action("${_template_name}__binary_script") { | 1272 java_binary_script("${_template_name}__java_binary_script") { |
1215 script = "//build/android/gyp/create_java_binary_script.py" | 1273 build_config = _build_config |
1216 depfile = "$target_gen_dir/$target_name.d" | 1274 jar_path = _jar_path |
1217 java_script = "$root_build_dir/bin/$_template_name" | 1275 main_class = invoker.main_class |
1218 inputs = [ | 1276 script_name = _template_name |
1219 _build_config, | |
1220 ] | |
1221 outputs = [ | |
1222 depfile, | |
1223 java_script, | |
1224 ] | |
1225 _rebased_build_config = rebase_path(_build_config, root_build_dir) | |
1226 args = [ | |
1227 "--depfile", | |
1228 rebase_path(depfile, root_build_dir), | |
1229 "--output", | |
1230 rebase_path(java_script, root_build_dir), | |
1231 "--classpath=@FileArg($_rebased_build_config:java:full_classpath)", | |
1232 "--jar-path", | |
1233 rebase_path(_jar_path, root_build_dir), | |
1234 "--main-class", | |
1235 invoker.main_class, | |
1236 ] | |
1237 | |
1238 deps = build_config_deps | 1277 deps = build_config_deps |
1239 } | 1278 } |
1240 } | 1279 } |
1241 | 1280 |
1242 if (_supports_android) { | 1281 if (_supports_android) { |
1243 if (defined(invoker.chromium_code) && invoker.chromium_code) { | 1282 if (defined(invoker.chromium_code) && invoker.chromium_code) { |
1244 _android_manifest = "//build/android/AndroidManifest.xml" | 1283 _android_manifest = "//build/android/AndroidManifest.xml" |
1245 if (defined(invoker.android_manifest)) { | 1284 if (defined(invoker.android_manifest)) { |
1246 _android_manifest = invoker.android_manifest | 1285 _android_manifest = invoker.android_manifest |
1247 } | 1286 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 ] | 1620 ] |
1582 args = [ | 1621 args = [ |
1583 "--depfile", | 1622 "--depfile", |
1584 rebase_path(depfile, root_build_dir), | 1623 rebase_path(depfile, root_build_dir), |
1585 "--script-output-path", | 1624 "--script-output-path", |
1586 rebase_path(generated_script, root_build_dir), | 1625 rebase_path(generated_script, root_build_dir), |
1587 ] | 1626 ] |
1588 args += test_runner_args | 1627 args += test_runner_args |
1589 } | 1628 } |
1590 } | 1629 } |
OLD | NEW |