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 "//mojo/services/network",
292 "$root_out_dir/lib.stripped/libbootstrap.so",
293 "$root_out_dir/network_service.mojo",
294 "$root_out_dir/obj/mojo/runner/bootstrap_java.dex.jar",
298 generate_mojo_shell_assets_list("build_mojo_runner_assets") {
300 ":copy_mojo_runner_assets",
302 dir = mojo_runner_assets_dir
305 copy("copy_mojo_runner") {
307 "$root_out_dir/exe.stripped/mojo_runner",
310 "$root_out_dir/lib.stripped/libmojo_runner.so",
314 copy_ex("copy_mojo_runner_test_assets") {
316 dest = mojo_runner_test_assets_dir
318 "$root_out_dir/test_app.mojo",
319 "$root_out_dir/test_request_tracker_app.mojo",
322 "//mojo/services/test_service:test_app",
323 "//mojo/services/test_service:test_request_tracker_app",
327 android_apk("mojo_runner_apk") {
328 apk_name = "MojoRunner"
330 android_manifest = "android/apk/AndroidManifest.xml"
332 native_libs = [ "libmojo_runner.so" ]
334 asset_location = mojo_runner_assets_dir
337 ":build_mojo_runner_assets",
342 "//components/view_manager:view_manager_java",
343 "//third_party/android_tools:google_play_services_default_resources",
347 generate_mojo_shell_assets_list("build_mojo_runner_test_assets") {
349 ":copy_mojo_runner_test_assets",
351 dir = mojo_runner_test_assets_dir
354 android_library("mojo_runner_tests_java") {
356 [ "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java" ]
365 mojom("child_process_bindings") {
367 "child_process.mojom",
371 "//mojo/application/public/interfaces",
374 import_dirs = [ "//mojo/services" ]
378 output_name = "mojo_runner_unittests"
380 "child_process_host_unittest.cc",
381 "data_pipe_peek_unittest.cc",
382 "in_process_native_runner_unittest.cc",
383 "native_runner_unittest.cc",
384 "shell_test_base.cc",
386 "shell_test_base_android.cc",
387 "shell_test_base_unittest.cc",
388 "shell_test_main.cc",
389 "url_resolver_unittest.cc",
393 ":in_process_native_runner",
397 "//base/test:test_support",
399 "//mojo/environment:chromium",
400 "//mojo/services/test_service:bindings",
402 "//mojo/util:filename_util",
404 "//third_party/mojo/src/mojo/edk/system",
405 "//third_party/mojo/src/mojo/public/cpp/bindings",
410 "//mojo/services/test_service:test_app",
411 "//mojo/services/test_service:test_request_tracker_app",
415 sources += [ "android/background_application_loader_unittest.cc" ]
417 deps += [ ":jni_headers" ]
420 ":build_mojo_runner_test_assets",
421 ":mojo_runner_tests_java",
424 apk_asset_location = mojo_runner_test_assets_dir
428 mojo_native_application("apptests") {
429 output_name = "runner_apptests"
434 # TODO(jam): needs http_server service.
440 "//mojo/application/public/cpp:test_support",
441 "//mojo/runner/test:bindings",
442 "//mojo/services/network/public/interfaces",
443 "//third_party/mojo/src/mojo/public/cpp/bindings:callback",