| 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/toolchain/toolchain.gni") | 5 import("//build/toolchain/toolchain.gni") |
| 6 | 6 |
| 7 if (is_android) { | 7 if (is_android) { |
| 8 import("//build/config/android/rules.gni") | 8 import("//build/config/android/rules.gni") |
| 9 import("//build/config/zip.gni") | 9 import("//build/config/zip.gni") |
| 10 } | 10 } |
| 11 | 11 |
| 12 # Generate a binary Mojo application in a self-named directory. | 12 # Generate a binary Mojo application in a self-named directory. |
| 13 # Application resources are copied to a "resources" directory alongside the app. | 13 # Application resources are copied to a "resources" directory alongside the app. |
| 14 # The parameters of this template are those of a shared library. | 14 # The parameters of this template are those of a shared library. |
| 15 template("mojo_native_application") { | 15 template("mojo_native_application") { |
| 16 base_target_name = target_name | 16 base_target_name = target_name |
| 17 if (defined(invoker.output_name)) { | 17 if (defined(invoker.output_name)) { |
| 18 base_target_name = invoker.output_name | 18 base_target_name = invoker.output_name |
| 19 } | 19 } |
| 20 | 20 |
| 21 final_target_name = target_name | 21 final_target_name = target_name |
| 22 | 22 |
| 23 mojo_deps = [] | 23 mojo_deps = [] |
| 24 if (defined(invoker.deps)) { | 24 if (defined(invoker.deps)) { |
| 25 mojo_deps += invoker.deps | 25 mojo_deps += invoker.deps |
| 26 } | 26 } |
| 27 | 27 |
| 28 mojo_data_deps = [] |
| 29 |
| 28 if (defined(invoker.resources)) { | 30 if (defined(invoker.resources)) { |
| 29 copy_step_name = "${base_target_name}__copy_resources" | 31 copy_step_name = "${base_target_name}__copy_resources" |
| 30 copy(copy_step_name) { | 32 copy(copy_step_name) { |
| 31 sources = invoker.resources | 33 sources = invoker.resources |
| 32 outputs = [ | 34 outputs = [ |
| 33 "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}", | 35 "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}", |
| 34 ] | 36 ] |
| 35 if (defined(invoker.testonly)) { | 37 if (defined(invoker.testonly)) { |
| 36 testonly = invoker.testonly | 38 testonly = invoker.testonly |
| 37 } | 39 } |
| 38 deps = mojo_deps | 40 deps = mojo_deps |
| 39 } | 41 } |
| 40 mojo_deps += [ ":$copy_step_name" ] | 42 mojo_data_deps += [ ":$copy_step_name" ] |
| 41 } | 43 } |
| 42 | 44 |
| 43 output = base_target_name + ".mojo" | 45 output = base_target_name + ".mojo" |
| 44 library_target_name = base_target_name + "_library" | 46 library_target_name = base_target_name + "_library" |
| 45 library_name = "${shlib_prefix}${library_target_name}${shlib_extension}" | 47 library_name = "${shlib_prefix}${library_target_name}${shlib_extension}" |
| 46 | 48 |
| 47 shared_library(library_target_name) { | 49 shared_library(library_target_name) { |
| 48 if (defined(invoker.cflags)) { | 50 if (defined(invoker.cflags)) { |
| 49 cflags = invoker.cflags | 51 cflags = invoker.cflags |
| 50 } | 52 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 78 | 80 |
| 79 data_deps = [] | 81 data_deps = [] |
| 80 if (!defined(invoker.avoid_runner_cycle) || !invoker.avoid_runner_cycle) { | 82 if (!defined(invoker.avoid_runner_cycle) || !invoker.avoid_runner_cycle) { |
| 81 # Give the user an out; as some mojo services are depended on by the | 83 # Give the user an out; as some mojo services are depended on by the |
| 82 # runner. | 84 # runner. |
| 83 data_deps += [ "//mojo/shell/standalone" ] | 85 data_deps += [ "//mojo/shell/standalone" ] |
| 84 } | 86 } |
| 85 if (defined(invoker.data_deps)) { | 87 if (defined(invoker.data_deps)) { |
| 86 data_deps += invoker.data_deps | 88 data_deps += invoker.data_deps |
| 87 } | 89 } |
| 90 data_deps += mojo_data_deps |
| 88 | 91 |
| 89 deps = [ | 92 deps = [ |
| 90 "//mojo/platform_handle:for_shared_library", | 93 "//mojo/platform_handle:for_shared_library", |
| 91 "//mojo/public/c/system:for_shared_library", | 94 "//mojo/public/c/system:for_shared_library", |
| 92 ] | 95 ] |
| 93 | 96 |
| 94 deps += mojo_deps | 97 deps += mojo_deps |
| 95 if (defined(invoker.public_deps)) { | 98 if (defined(invoker.public_deps)) { |
| 96 public_deps = invoker.public_deps | 99 public_deps = invoker.public_deps |
| 97 } | 100 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 # output_name (optional): override for the output file name | 179 # output_name (optional): override for the output file name |
| 177 template("mojo_android_application") { | 180 template("mojo_android_application") { |
| 178 assert(defined(invoker.input_so)) | 181 assert(defined(invoker.input_so)) |
| 179 assert(defined(invoker.input_dex_jar)) | 182 assert(defined(invoker.input_dex_jar)) |
| 180 | 183 |
| 181 base_target_name = target_name | 184 base_target_name = target_name |
| 182 if (defined(invoker.output_name)) { | 185 if (defined(invoker.output_name)) { |
| 183 base_target_name = invoker.output_name | 186 base_target_name = invoker.output_name |
| 184 } | 187 } |
| 185 | 188 |
| 186 mojo_deps = [] | 189 mojo_data_deps = [] |
| 187 if (defined(invoker.resources)) { | 190 if (defined(invoker.resources)) { |
| 188 copy_step_name = "${base_target_name}__copy_resources" | 191 copy_step_name = "${base_target_name}__copy_resources" |
| 189 copy(copy_step_name) { | 192 copy(copy_step_name) { |
| 190 sources = invoker.resources | 193 sources = invoker.resources |
| 191 outputs = [ | 194 outputs = [ |
| 192 "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}", | 195 "${root_out_dir}/${base_target_name}/resources/{{source_file_part}}", |
| 193 ] | 196 ] |
| 194 if (defined(invoker.testonly)) { | 197 if (defined(invoker.testonly)) { |
| 195 testonly = invoker.testonly | 198 testonly = invoker.testonly |
| 196 } | 199 } |
| 197 if (defined(invoker.deps)) { | 200 if (defined(invoker.deps)) { |
| 198 deps = invoker.deps | 201 deps = invoker.deps |
| 199 } | 202 } |
| 200 } | 203 } |
| 201 mojo_deps += [ ":$copy_step_name" ] | 204 mojo_data_deps += [ ":$copy_step_name" ] |
| 202 } | 205 } |
| 203 | 206 |
| 204 zip_action_name = "${target_name}_zip" | 207 zip_action_name = "${target_name}_zip" |
| 205 zip_action_output = "$target_gen_dir/${target_name}.zip" | 208 zip_action_output = "$target_gen_dir/${target_name}.zip" |
| 206 prepend_action_name = target_name | 209 prepend_action_name = target_name |
| 207 zip(zip_action_name) { | 210 zip(zip_action_name) { |
| 208 visibility = [ ":$prepend_action_name" ] | 211 visibility = [ ":$prepend_action_name" ] |
| 209 inputs = [ | 212 inputs = [ |
| 210 invoker.input_so, | 213 invoker.input_so, |
| 211 invoker.input_dex_jar, | 214 invoker.input_dex_jar, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 235 ] | 238 ] |
| 236 | 239 |
| 237 rebase_input = rebase_path(input, root_build_dir) | 240 rebase_input = rebase_path(input, root_build_dir) |
| 238 rebase_output = rebase_path(_mojo_output, root_build_dir) | 241 rebase_output = rebase_path(_mojo_output, root_build_dir) |
| 239 args = [ | 242 args = [ |
| 240 "--input=$rebase_input", | 243 "--input=$rebase_input", |
| 241 "--output=$rebase_output", | 244 "--output=$rebase_output", |
| 242 "--line=#!mojo mojo:android_handler", | 245 "--line=#!mojo mojo:android_handler", |
| 243 ] | 246 ] |
| 244 | 247 |
| 245 deps = mojo_deps | 248 data_deps = mojo_data_deps |
| 246 | 249 |
| 247 public_deps = [ | 250 public_deps = [ |
| 248 ":$zip_action_name", | 251 ":$zip_action_name", |
| 249 ] | 252 ] |
| 250 } | 253 } |
| 251 | 254 |
| 252 android_assets("${target_name}_assets") { | 255 android_assets("${target_name}_assets") { |
| 253 forward_variables_from(invoker, [ "testonly" ]) | 256 forward_variables_from(invoker, [ "testonly" ]) |
| 254 deps = [ | 257 deps = [ |
| 255 ":$prepend_action_name", | 258 ":$prepend_action_name", |
| 256 ] | 259 ] |
| 257 renaming_sources = [ _mojo_output ] | 260 renaming_sources = [ _mojo_output ] |
| 258 renaming_destinations = [ "${base_target_name}/${base_target_name}.mojo" ] | 261 renaming_destinations = [ "${base_target_name}/${base_target_name}.mojo" ] |
| 259 if (defined(invoker.resources)) { | 262 if (defined(invoker.resources)) { |
| 260 renaming_sources += invoker.resources | 263 renaming_sources += invoker.resources |
| 261 renaming_destinations += process_file_template( | 264 renaming_destinations += process_file_template( |
| 262 invoker.resources, | 265 invoker.resources, |
| 263 [ "$base_target_name/resources/{{source_file_part}}" ]) | 266 [ "$base_target_name/resources/{{source_file_part}}" ]) |
| 264 } | 267 } |
| 265 } | 268 } |
| 266 } | 269 } |
| 267 } | 270 } |
| OLD | NEW |