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",
129 "//components/core_services",
130 "//mojo/services/tracing",
135 "android/android_handler.cc",
136 "android/android_handler.h",
137 "android/android_handler_loader.cc",
138 "android/android_handler_loader.h",
139 "android/background_application_loader.cc",
140 "android/background_application_loader.h",
141 "android/native_viewport_application_loader.cc",
142 "android/native_viewport_application_loader.h",
143 "android/ui_application_loader_android.cc",
144 "android/ui_application_loader_android.h",
149 ":run_android_application_function",
150 "//components/gles2",
151 "//components/native_viewport:lib",
152 "//mojo/application:content_handler",
156 # This target includes some files behind #ifdef OS... guards. Since gn is not
157 # smart enough to understand preprocess includes, it does complains about
158 # these includes when not using the build files for that OS. Suppress checking
159 # so we can enable checking for the rest of the targets in this file.
160 # TODO: Might be better to split the files with OS-specific includes out to a
161 # separate source_set so we can leave checking on for the rest of the target.
162 check_includes = false
165 source_set("native_application_support") {
167 "native_application_support.cc",
168 "native_application_support.h",
169 "platform_handle_impl.cc",
173 "//third_party/mojo/src/mojo/public/cpp/bindings",
179 "//mojo/platform_handle:defs",
182 # This target has to include the public thunk headers, which generally
183 # shouldn't be included without picking an implementation. We are providing
184 # the implementation but the thunk header target cannot declare that we are
185 # permitted to include it since it's in the public SDK and we are not.
186 # Suppress include checking so we can still check the rest of the targets in
188 check_includes = false
191 source_set("switches") {
203 generate_jni("jni_headers") {
205 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
206 "android/apk/src/org/chromium/mojo/shell/Bootstrap.java",
207 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
208 "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java",
210 jni_package = "mojo/shell"
213 android_library("bootstrap_java") {
214 java_files = [ "android/apk/src/org/chromium/mojo/shell/Bootstrap.java" ]
220 dex_path = "$target_out_dir/bootstrap_java.dex.jar"
223 shared_library("bootstrap") {
225 "android/bootstrap.cc",
230 ":run_android_application_function",
235 # Shared header between the bootstrap and the main shell .so.
236 source_set("run_android_application_function") {
238 "android/run_android_application_function.h",
246 android_library("java") {
248 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
249 "android/apk/src/org/chromium/mojo/shell/FileHelper.java",
250 "android/apk/src/org/chromium/mojo/shell/MojoShellActivity.java",
251 "android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java",
252 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
260 android_resources("resources") {
261 resource_dirs = [ "android/apk/res" ]
262 custom_package = "org.chromium.mojo.shell"
265 mojo_runner_assets_dir = "$root_build_dir/mojo_runner_assets"
266 mojo_runner_test_assets_dir = "$root_build_dir/mojo_runner_test_assets"
268 copy_ex("copy_mojo_runner_assets") {
270 dest = mojo_runner_assets_dir
272 "$root_out_dir/lib.stripped/libbootstrap.so",
273 "$root_out_dir/network_service.mojo",
274 "$root_out_dir/obj/mojo/runner/bootstrap_java.dex.jar",
278 copy("copy_mojo_runner") {
280 "$root_out_dir/exe.stripped/mojo_runner",
283 "$root_out_dir/lib.stripped/libmojo_runner.so",
287 copy_ex("copy_mojo_runner_test_assets") {
289 dest = mojo_runner_test_assets_dir
291 "$root_out_dir/test_app.mojo",
292 "$root_out_dir/test_request_tracker_app.mojo",
296 android_apk("mojo_runner_apk") {
297 apk_name = "MojoRunner"
299 android_manifest = "android/apk/AndroidManifest.xml"
301 native_libs = [ "libmojo_runner.so" ]
303 asset_location = mojo_runner_assets_dir
307 ":copy_mojo_runner_assets",
311 "//components/native_viewport:native_viewport_java",
312 "//third_party/android_tools:google_play_services_default_resources",
316 android_library("mojo_runner_tests_java") {
318 [ "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java" ]
327 mojom("child_process_bindings") {
329 "child_process.mojom",
333 "//third_party/mojo/src/mojo/public/interfaces/application",
338 output_name = "mojo_runner_unittests"
340 "child_process_host_unittest.cc",
341 "data_pipe_peek_unittest.cc",
342 "in_process_native_runner_unittest.cc",
343 "native_runner_unittest.cc",
344 "shell_test_base.cc",
346 "shell_test_base_android.cc",
347 "shell_test_base_unittest.cc",
348 "shell_test_main.cc",
349 "url_resolver_unittest.cc",
353 ":in_process_native_runner",
357 "//base/test:test_support",
359 "//mojo/environment:chromium",
360 "//mojo/services/test_service:bindings",
362 "//mojo/util:filename_util",
364 "//third_party/mojo/src/mojo/edk/system",
365 "//third_party/mojo/src/mojo/public/cpp/bindings",
370 "//mojo/services/test_service:test_app",
371 "//mojo/services/test_service:test_request_tracker_app",
375 sources += [ "android/background_application_loader_unittest.cc" ]
377 deps += [ ":jni_headers" ]
380 ":copy_mojo_runner_test_assets",
381 ":mojo_runner_tests_java",
384 apk_asset_location = mojo_runner_test_assets_dir
388 mojo_native_application("apptests") {
389 output_name = "runner_apptests"
394 # TODO(jam): needs http_server service.
400 "//mojo/application",
401 "//mojo/application:test_support",
402 "//mojo/common:common",
403 "//mojo/runner/test:bindings",
405 #"//mojo/services/http_server/public/cpp",
406 #"//mojo/services/http_server/public/interfaces",
407 "//mojo/services/network/public/interfaces",
409 "//third_party/mojo/src/mojo/public/cpp/bindings:callback",
410 "//third_party/mojo/src/mojo/public/cpp/environment",
411 "//third_party/mojo/src/mojo/public/cpp/system:system",
414 #data_deps = [ "//services/http_server:http_server($default_toolchain)" ]