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
3 # found in the LICENSE file.
5 import("//build/config/ui.gni")
6 import("//mojo/generate_mojo_shell_assets_list.gni")
7 import("//third_party/mojo/src/mojo/public/mojo.gni")
8 import("//third_party/mojo/src/mojo/public/mojo_application.gni")
9 import("//third_party/mojo/src/mojo/public/tools/bindings/mojom.gni")
10 import("//testing/test.gni")
12 # We don't support building in the component build since mojo apps are
13 # inherently components.
14 assert(!is_component_build)
24 deps += [ ":mojo_runner_apk" ]
29 import("//build/config/android/config.gni")
30 import("//build/config/android/rules.gni")
33 source_set("mojo_runner_lib") {
39 "//build/config/sanitizers:deps",
41 "//mojo/environment:chromium",
46 "desktop/launcher_process.cc",
47 "desktop/launcher_process.h",
52 "android/context_init.h",
53 "android/library_loader.cc",
60 "//components/view_manager",
67 executable("mojo_runner") {
74 "android/context_init.cc",
77 # On android, the executable is also the native library used by the apk.
78 # It means dynamic symbols must be preserved and exported.
79 ldflags = [ "-Wl,--export-dynamic" ]
82 deps += [ "//build/config/sanitizers:deps" ]
85 source_set("in_process_native_runner") {
87 "in_process_native_runner.cc",
88 "in_process_native_runner.h",
92 ":native_application_support",
105 "child_process_host.cc",
106 "child_process_host.h",
111 "out_of_process_native_runner.cc",
112 "out_of_process_native_runner.h",
120 ":child_process_bindings",
121 ":in_process_native_runner",
122 ":native_application_support",
124 "//base/third_party/dynamic_annotations",
125 "//base:base_static",
126 "//components/devtools_service/public/interfaces",
127 "//mojo/application/public/cpp",
128 "//mojo/common:tracing_impl",
129 "//mojo/util:filename_util",
130 "//third_party/mojo/src/mojo/edk/system",
131 "//mojo/services/network/public/interfaces",
133 "//mojo/services/tracing:bindings",
143 "//components/devtools_service",
144 "//mojo/services/tracing",
149 "android/android_handler.cc",
150 "android/android_handler.h",
151 "android/android_handler_loader.cc",
152 "android/android_handler_loader.h",
153 "android/background_application_loader.cc",
154 "android/background_application_loader.h",
155 "android/ui_application_loader_android.cc",
156 "android/ui_application_loader_android.h",
161 ":run_android_application_function",
162 "//components/view_manager/gles2",
163 "//components/view_manager/native_viewport",
164 "//mojo/application/public/cpp:content_handler",
168 # This target includes some files behind #ifdef OS... guards. Since gn is not
169 # smart enough to understand preprocess includes, it does complains about
170 # these includes when not using the build files for that OS. Suppress checking
171 # so we can enable checking for the rest of the targets in this file.
172 # TODO: Might be better to split the files with OS-specific includes out to a
173 # separate source_set so we can leave checking on for the rest of the target.
174 check_includes = false
177 source_set("native_application_support") {
179 "native_application_support.cc",
180 "native_application_support.h",
181 "platform_handle_impl.cc",
185 "//third_party/mojo/src/mojo/public/cpp/bindings",
191 "//mojo/platform_handle:defs",
195 # This target has to include the public thunk headers, which generally
196 # shouldn't be included without picking an implementation. We are providing
197 # the implementation but the thunk header target cannot declare that we are
198 # permitted to include it since it's in the public SDK and we are not.
199 # Suppress include checking so we can still check the rest of the targets in
201 check_includes = false
204 source_set("switches") {
216 generate_jni("jni_headers") {
218 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
219 "android/apk/src/org/chromium/mojo/shell/Bootstrap.java",
220 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
221 "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java",
223 jni_package = "mojo/shell"
226 android_library("bootstrap_java") {
227 java_files = [ "android/apk/src/org/chromium/mojo/shell/Bootstrap.java" ]
233 dex_path = "$target_out_dir/bootstrap_java.dex.jar"
236 shared_library("bootstrap") {
238 "android/bootstrap.cc",
243 ":run_android_application_function",
248 # Shared header between the bootstrap and the main shell .so.
249 source_set("run_android_application_function") {
251 "android/run_android_application_function.h",
259 android_library("java") {
261 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
262 "android/apk/src/org/chromium/mojo/shell/FileHelper.java",
263 "android/apk/src/org/chromium/mojo/shell/MojoShellActivity.java",
264 "android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java",
265 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
274 android_resources("resources") {
275 resource_dirs = [ "android/apk/res" ]
276 custom_package = "org.chromium.mojo.shell"
279 mojo_runner_assets_dir = "$root_build_dir/mojo_runner_assets"
280 mojo_runner_test_assets_dir = "$root_build_dir/mojo_runner_test_assets"
282 copy_ex("copy_mojo_runner_assets") {
284 dest = mojo_runner_assets_dir
289 "$root_out_dir/lib.stripped/libbootstrap.so",
290 "$root_out_dir/network_service.mojo",
291 "$root_out_dir/obj/mojo/runner/bootstrap_java.dex.jar",
295 generate_mojo_shell_assets_list("build_mojo_runner_assets") {
297 ":copy_mojo_runner_assets",
299 dir = mojo_runner_assets_dir
302 copy("copy_mojo_runner") {
304 "$root_out_dir/exe.stripped/mojo_runner",
307 "$root_out_dir/lib.stripped/libmojo_runner.so",
311 copy_ex("copy_mojo_runner_test_assets") {
313 dest = mojo_runner_test_assets_dir
315 "$root_out_dir/test_app.mojo",
316 "$root_out_dir/test_request_tracker_app.mojo",
320 android_apk("mojo_runner_apk") {
321 apk_name = "MojoRunner"
323 android_manifest = "android/apk/AndroidManifest.xml"
325 native_libs = [ "libmojo_runner.so" ]
327 asset_location = mojo_runner_assets_dir
330 ":build_mojo_runner_assets",
334 "//components/view_manager:view_manager_java",
335 "//third_party/android_tools:google_play_services_default_resources",
339 generate_mojo_shell_assets_list("build_mojo_runner_test_assets") {
341 ":copy_mojo_runner_test_assets",
343 dir = mojo_runner_test_assets_dir
346 android_library("mojo_runner_tests_java") {
348 [ "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java" ]
357 mojom("child_process_bindings") {
359 "child_process.mojom",
363 "//mojo/application/public/interfaces",
366 import_dirs = [ "//mojo/services" ]
370 output_name = "mojo_runner_unittests"
372 "child_process_host_unittest.cc",
373 "data_pipe_peek_unittest.cc",
374 "in_process_native_runner_unittest.cc",
375 "native_runner_unittest.cc",
376 "shell_test_base.cc",
378 "shell_test_base_android.cc",
379 "shell_test_base_unittest.cc",
380 "shell_test_main.cc",
381 "url_resolver_unittest.cc",
385 ":in_process_native_runner",
389 "//base/test:test_support",
391 "//mojo/environment:chromium",
392 "//mojo/services/test_service:bindings",
394 "//mojo/util:filename_util",
396 "//third_party/mojo/src/mojo/edk/system",
397 "//third_party/mojo/src/mojo/public/cpp/bindings",
402 "//mojo/services/test_service:test_app",
403 "//mojo/services/test_service:test_request_tracker_app",
407 sources += [ "android/background_application_loader_unittest.cc" ]
409 deps += [ ":jni_headers" ]
412 ":build_mojo_runner_test_assets",
413 ":mojo_runner_tests_java",
416 apk_asset_location = mojo_runner_test_assets_dir
420 mojo_native_application("apptests") {
421 output_name = "runner_apptests"
426 # TODO(jam): needs http_server service.
432 "//mojo/application/public/cpp:test_support",
433 "//mojo/runner/test:bindings",
434 "//mojo/services/network/public/interfaces",
435 "//third_party/mojo/src/mojo/public/cpp/bindings:callback",