| OLD | NEW |
| (Empty) |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import("//build/config/android/rules.gni") | |
| 6 import("//mojo/public/mojo_application.gni") | |
| 7 | |
| 8 servicess_android_path = get_path_info(".", "abspath") | |
| 9 | |
| 10 template("mojo_android_java_application") { | |
| 11 assert(defined(invoker.mojo_main)) | |
| 12 | |
| 13 dex_output_path = "$target_out_dir/${target_name}.dex.jar" | |
| 14 dex_with_manifest_output_path = | |
| 15 "$target_out_dir/${target_name}_with_manifest.dex.jar" | |
| 16 | |
| 17 android_lib_name = "__${target_name}_lib" | |
| 18 android_standalone_name = "__${target_name}_standalone" | |
| 19 android_with_manifest_name = "__${target_name}_with_manifest" | |
| 20 | |
| 21 all_deps = [ | |
| 22 "//mojo/public/java:bindings", | |
| 23 "//mojo/public/java:system", | |
| 24 ] | |
| 25 if (defined(invoker.deps)) { | |
| 26 all_deps += invoker.deps | |
| 27 } | |
| 28 | |
| 29 android_library(android_lib_name) { | |
| 30 java_files = invoker.sources | |
| 31 | |
| 32 deps = all_deps | |
| 33 } | |
| 34 | |
| 35 android_standalone_library(android_standalone_name) { | |
| 36 deps = [ ":${android_lib_name}" ] + all_deps | |
| 37 | |
| 38 dex_path = dex_output_path | |
| 39 | |
| 40 system_gen_dir = get_path_info("//mojo/public/java/BUILD.gn", "gen_dir") | |
| 41 excluded_jars = [ "${system_gen_dir}/system.dex.jar" ] | |
| 42 } | |
| 43 | |
| 44 action(android_with_manifest_name) { | |
| 45 script = "${servicess_android_path}/add_manifest_entry.py" | |
| 46 | |
| 47 deps = [ | |
| 48 ":$android_standalone_name", | |
| 49 ] | |
| 50 | |
| 51 input = dex_output_path | |
| 52 inputs = [ | |
| 53 input, | |
| 54 ] | |
| 55 | |
| 56 output = dex_with_manifest_output_path | |
| 57 outputs = [ | |
| 58 output, | |
| 59 ] | |
| 60 | |
| 61 rebase_input = rebase_path(input) | |
| 62 rebase_output = rebase_path(output) | |
| 63 mojo_main = invoker.mojo_main | |
| 64 args = [ | |
| 65 "--input=$rebase_input", | |
| 66 "--output=$rebase_output", | |
| 67 "--key=Mojo-Class", | |
| 68 "--value=$mojo_main", | |
| 69 ] | |
| 70 } | |
| 71 | |
| 72 if (defined(invoker.output_name)) { | |
| 73 mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo" | |
| 74 } else { | |
| 75 mojo_output = "$root_out_dir/" + target_name + ".mojo" | |
| 76 } | |
| 77 | |
| 78 action(target_name) { | |
| 79 script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_root) | |
| 80 | |
| 81 deps = [ | |
| 82 ":$android_with_manifest_name", | |
| 83 ] | |
| 84 | |
| 85 input = dex_with_manifest_output_path | |
| 86 inputs = [ | |
| 87 input, | |
| 88 ] | |
| 89 | |
| 90 output = mojo_output | |
| 91 outputs = [ | |
| 92 output, | |
| 93 ] | |
| 94 | |
| 95 rebase_input = rebase_path(input, root_build_dir) | |
| 96 rebase_output = rebase_path(output, root_build_dir) | |
| 97 args = [ | |
| 98 "--input=$rebase_input", | |
| 99 "--output=$rebase_output", | |
| 100 "--line=#!mojo mojo:java_handler", | |
| 101 ] | |
| 102 } | |
| 103 } | |
| OLD | NEW |