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("//third_party/mojo/src/mojo/public/mojo.gni")
7 import("//third_party/mojo/src/mojo/public/mojo_application.gni")
8 import("//third_party/mojo/src/mojo/public/tools/bindings/mojom.gni")
9 import("//testing/test.gni")
11 # We don't support building in the component build since mojo apps are
12 # inherently components.
13 assert(!is_component_build)
23 deps += [ ":mojo_runner_apk" ]
28 import("//build/config/android/config.gni")
29 import("//build/config/android/rules.gni")
32 executable("mojo_runner") {
38 "//build/config/sanitizers:deps",
40 "//mojo/environment:chromium",
45 "desktop/launcher_process.cc",
46 "desktop/launcher_process.h",
51 "android/library_loader.cc",
56 # On android, the executable is also the native library used by the apk.
57 # It means dynamic symbols must be preserved and exported.
58 ldflags = [ "-Wl,--export-dynamic" ]
62 "//components/native_viewport:lib",
69 source_set("in_process_native_runner") {
71 "in_process_native_runner.cc",
72 "in_process_native_runner.h",
76 ":native_application_support",
89 "child_process_host.cc",
90 "child_process_host.h",
95 "out_of_process_native_runner.cc",
96 "out_of_process_native_runner.h",
104 ":child_process_bindings",
105 ":in_process_native_runner",
106 ":native_application_support",
108 "//base/third_party/dynamic_annotations",
109 "//base:base_static",
110 "//mojo/application",
112 "//mojo/common:tracing_impl",
113 "//mojo/util:filename_util",
114 "//third_party/mojo/src/mojo/edk/system",
115 "//third_party/mojo/src/mojo/public/cpp/bindings",
116 "//third_party/mojo/src/mojo/public/interfaces/application",
117 "//mojo/services/network/public/interfaces",
119 "//mojo/services/tracing:bindings",
128 data_deps = [ "//mojo/services/tracing" ]
132 "android/android_handler.cc",
133 "android/android_handler.h",
134 "android/android_handler_loader.cc",
135 "android/android_handler_loader.h",
136 "android/background_application_loader.cc",
137 "android/background_application_loader.h",
138 "android/native_viewport_application_loader.cc",
139 "android/native_viewport_application_loader.h",
140 "android/ui_application_loader_android.cc",
141 "android/ui_application_loader_android.h",
146 ":run_android_application_function",
147 "//components/gles2",
148 "//components/native_viewport:lib",
149 "//mojo/application:content_handler",
153 # This target includes some files behind #ifdef OS... guards. Since gn is not
154 # smart enough to understand preprocess includes, it does complains about
155 # these includes when not using the build files for that OS. Suppress checking
156 # so we can enable checking for the rest of the targets in this file.
157 # TODO: Might be better to split the files with OS-specific includes out to a
158 # separate source_set so we can leave checking on for the rest of the target.
159 check_includes = false
162 source_set("native_application_support") {
164 "native_application_support.cc",
165 "native_application_support.h",
166 "platform_handle_impl.cc",
170 "//third_party/mojo/src/mojo/public/cpp/bindings",
176 "//mojo/platform_handle:defs",
179 # This target has to include the public thunk headers, which generally
180 # shouldn't be included without picking an implementation. We are providing
181 # the implementation but the thunk header target cannot declare that we are
182 # permitted to include it since it's in the public SDK and we are not.
183 # Suppress include checking so we can still check the rest of the targets in
185 check_includes = false
188 source_set("switches") {
200 generate_jni("jni_headers") {
202 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
203 "android/apk/src/org/chromium/mojo/shell/Bootstrap.java",
204 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
205 "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java",
207 jni_package = "mojo/shell"
210 android_library("bootstrap_java") {
211 java_files = [ "android/apk/src/org/chromium/mojo/shell/Bootstrap.java" ]
217 dex_path = "$target_out_dir/bootstrap_java.dex.jar"
220 shared_library("bootstrap") {
222 "android/bootstrap.cc",
227 ":run_android_application_function",
232 # Shared header between the bootstrap and the main shell .so.
233 source_set("run_android_application_function") {
235 "android/run_android_application_function.h",
243 android_library("java") {
245 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
246 "android/apk/src/org/chromium/mojo/shell/FileHelper.java",
247 "android/apk/src/org/chromium/mojo/shell/MojoShellActivity.java",
248 "android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java",
249 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
257 android_resources("resources") {
258 resource_dirs = [ "android/apk/res" ]
259 custom_package = "org.chromium.mojo.shell"
262 mojo_runner_assets_dir = "$root_build_dir/mojo_runner_assets"
263 mojo_runner_test_assets_dir = "$root_build_dir/mojo_runner_test_assets"
265 copy_ex("copy_mojo_runner_assets") {
267 dest = mojo_runner_assets_dir
269 "$root_out_dir/lib.stripped/libbootstrap.so",
270 "$root_out_dir/network_service.mojo",
271 "$root_out_dir/obj/mojo/runner/bootstrap_java.dex.jar",
275 copy("copy_mojo_runner") {
277 "$root_out_dir/exe.stripped/mojo_runner",
280 "$root_out_dir/lib.stripped/libmojo_runner.so",
284 copy_ex("copy_mojo_runner_test_assets") {
286 dest = mojo_runner_test_assets_dir
288 "$root_out_dir/test_app.mojo",
289 "$root_out_dir/test_request_tracker_app.mojo",
293 android_apk("mojo_runner_apk") {
294 apk_name = "MojoRunner"
296 android_manifest = "android/apk/AndroidManifest.xml"
298 native_libs = [ "libmojo_runner.so" ]
300 asset_location = mojo_runner_assets_dir
304 ":copy_mojo_runner_assets",
308 "//components/native_viewport:native_viewport_java",
309 "//third_party/android_tools:google_play_services_default_resources",
313 android_library("mojo_runner_tests_java") {
315 [ "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java" ]
324 mojom("child_process_bindings") {
326 "child_process.mojom",
330 "//third_party/mojo/src/mojo/public/interfaces/application",
335 output_name = "mojo_runner_unittests"
337 "child_process_host_unittest.cc",
338 "data_pipe_peek_unittest.cc",
339 "in_process_native_runner_unittest.cc",
340 "native_runner_unittest.cc",
341 "shell_test_base.cc",
343 "shell_test_base_android.cc",
344 "shell_test_base_unittest.cc",
345 "shell_test_main.cc",
346 "url_resolver_unittest.cc",
350 ":in_process_native_runner",
354 "//base/test:test_support",
356 "//mojo/environment:chromium",
357 "//mojo/services/test_service:bindings",
359 "//mojo/util:filename_util",
361 "//third_party/mojo/src/mojo/edk/system",
362 "//third_party/mojo/src/mojo/public/cpp/bindings",
367 "//mojo/services/test_service:test_app",
368 "//mojo/services/test_service:test_request_tracker_app",
372 sources += [ "android/background_application_loader_unittest.cc" ]
374 deps += [ ":jni_headers" ]
377 ":copy_mojo_runner_test_assets",
378 ":mojo_runner_tests_java",
381 apk_asset_location = mojo_runner_test_assets_dir
385 mojo_native_application("apptests") {
386 output_name = "runner_apptests"
391 # TODO(jam): needs http_server service.
397 "//mojo/application",
398 "//mojo/application:test_support",
399 "//mojo/common:common",
400 "//mojo/runner/test:bindings",
402 #"//mojo/services/http_server/public/cpp",
403 #"//mojo/services/http_server/public/interfaces",
404 "//mojo/services/network/public/interfaces",
406 "//third_party/mojo/src/mojo/public/cpp/bindings:callback",
407 "//third_party/mojo/src/mojo/public/cpp/environment",
408 "//third_party/mojo/src/mojo/public/cpp/system:system",
411 #data_deps = [ "//services/http_server:http_server($default_toolchain)" ]