| 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 } | 631 } |
| 632 } | 632 } |
| 633 } | 633 } |
| 634 | 634 |
| 635 # Packages resources, assets, dex, and native libraries into an apk. Signs and | 635 # Packages resources, assets, dex, and native libraries into an apk. Signs and |
| 636 # zipaligns the apk. | 636 # zipaligns the apk. |
| 637 template("create_apk") { | 637 template("create_apk") { |
| 638 set_sources_assignment_filter([]) | 638 set_sources_assignment_filter([]) |
| 639 forward_variables_from(invoker, [ "testonly" ]) | 639 forward_variables_from(invoker, [ "testonly" ]) |
| 640 | 640 |
| 641 _template_name = target_name |
| 642 assert(_template_name == _template_name) # Mark as used. |
| 643 |
| 641 _android_manifest = invoker.android_manifest | 644 _android_manifest = invoker.android_manifest |
| 642 _base_path = invoker.base_path | 645 _base_path = invoker.base_path |
| 643 _final_apk_path = invoker.apk_path | 646 _final_apk_path = invoker.apk_path |
| 644 _managed_final_apk_path_helper = | 647 _managed_final_apk_path_helper = |
| 645 process_file_template([ _final_apk_path ], | 648 process_file_template([ _final_apk_path ], |
| 646 "{{source_dir}}/{{source_name_part}}_managed.apk") | 649 "{{source_dir}}/{{source_name_part}}_managed") |
| 647 _managed_final_apk_path = _managed_final_apk_path_helper[0] | 650 _managed_final_apk_path_no_ext = _managed_final_apk_path_helper[0] |
| 651 _managed_final_apk_path = "${_managed_final_apk_path_no_ext}.apk" |
| 648 | 652 |
| 649 if (defined(invoker.resources_zip)) { | 653 if (defined(invoker.resources_zip)) { |
| 650 _resources_zip = invoker.resources_zip | 654 _resources_zip = invoker.resources_zip |
| 651 } | 655 } |
| 652 if (defined(invoker.dex_path)) { | 656 if (defined(invoker.dex_path)) { |
| 653 _dex_path = invoker.dex_path | 657 _dex_path = invoker.dex_path |
| 654 } | 658 } |
| 655 _load_library_from_apk = invoker.load_library_from_apk | 659 _load_library_from_apk = invoker.load_library_from_apk |
| 656 | 660 |
| 657 _package_deps = [] | 661 _package_deps = [] |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 if (defined(invoker.srcjar_deps)) { | 1204 if (defined(invoker.srcjar_deps)) { |
| 1201 _srcjar_deps = invoker.srcjar_deps | 1205 _srcjar_deps = invoker.srcjar_deps |
| 1202 } | 1206 } |
| 1203 | 1207 |
| 1204 _srcjars = [] | 1208 _srcjars = [] |
| 1205 if (defined(invoker.srcjars)) { | 1209 if (defined(invoker.srcjars)) { |
| 1206 _srcjars = invoker.srcjars | 1210 _srcjars = invoker.srcjars |
| 1207 } | 1211 } |
| 1208 | 1212 |
| 1209 _java_files = [] | 1213 _java_files = [] |
| 1210 if (defined(invoker.java_files)) { | 1214 if (defined(invoker.DEPRECATED_java_in_dir)) { |
| 1211 _java_files = invoker.java_files | |
| 1212 } else if (defined(invoker.DEPRECATED_java_in_dir)) { | |
| 1213 _src_dir = invoker.DEPRECATED_java_in_dir + "/src" | 1215 _src_dir = invoker.DEPRECATED_java_in_dir + "/src" |
| 1214 _src_dir_exists = exec_script("//build/dir_exists.py", | 1216 _src_dir_exists = exec_script("//build/dir_exists.py", |
| 1215 [ rebase_path(_src_dir, root_build_dir) ], | 1217 [ rebase_path(_src_dir, root_build_dir) ], |
| 1216 "string") | 1218 "string") |
| 1217 assert(_src_dir_exists == "False", | 1219 assert(_src_dir_exists == "False", |
| 1218 "In GN, java_in_dir should be the fully specified java directory " + | 1220 "In GN, java_in_dir should be the fully specified java directory " + |
| 1219 "(i.e. including the trailing \"/src\")") | 1221 "(i.e. including the trailing \"/src\")") |
| 1220 | 1222 |
| 1221 _java_files_build_rel = exec_script( | 1223 _java_files_build_rel = |
| 1222 "//build/android/gyp/find.py", | 1224 exec_script("//build/android/gyp/find.py", |
| 1223 [ | 1225 [ |
| 1224 "--pattern", | 1226 "--pattern", |
| 1225 "*.java", | 1227 "*.java", |
| 1226 rebase_path(invoker.DEPRECATED_java_in_dir, root_build_dir), | 1228 rebase_path(invoker.DEPRECATED_java_in_dir, |
| 1227 ], | 1229 root_build_dir), |
| 1228 "list lines") | 1230 ], |
| 1231 "list lines") |
| 1229 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) | 1232 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) |
| 1230 } | 1233 } |
| 1234 if (defined(invoker.java_files)) { |
| 1235 _java_files += invoker.java_files |
| 1236 } |
| 1231 assert(_java_files != [] || _srcjar_deps != [] || _srcjars != []) | 1237 assert(_java_files != [] || _srcjar_deps != [] || _srcjars != []) |
| 1232 | 1238 |
| 1233 _compile_java_target = "${_template_name}__compile_java" | 1239 _compile_java_target = "${_template_name}__compile_java" |
| 1234 _final_deps += [ ":$_compile_java_target" ] | 1240 _final_deps += [ ":$_compile_java_target" ] |
| 1235 compile_java(_compile_java_target) { | 1241 compile_java(_compile_java_target) { |
| 1236 jar_path = _jar_path | 1242 jar_path = _jar_path |
| 1237 build_config = _build_config | 1243 build_config = _build_config |
| 1238 java_files = _java_files | 1244 java_files = _java_files |
| 1239 srcjar_deps = _srcjar_deps | 1245 srcjar_deps = _srcjar_deps |
| 1240 srcjars = _srcjars | 1246 srcjars = _srcjars |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 ] | 1642 ] |
| 1637 args = [ | 1643 args = [ |
| 1638 "--depfile", | 1644 "--depfile", |
| 1639 rebase_path(depfile, root_build_dir), | 1645 rebase_path(depfile, root_build_dir), |
| 1640 "--script-output-path", | 1646 "--script-output-path", |
| 1641 rebase_path(generated_script, root_build_dir), | 1647 rebase_path(generated_script, root_build_dir), |
| 1642 ] | 1648 ] |
| 1643 args += test_runner_args | 1649 args += test_runner_args |
| 1644 } | 1650 } |
| 1645 } | 1651 } |
| OLD | NEW |