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