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)
26 ":mojo_shell_tests_apk",
35 "//mojo/shell/application_manager:mojo_application_manager_unittests",
40 import("//build/config/android/config.gni")
41 import("//build/config/android/rules.gni")
44 executable("mojo_shell") {
51 "//build/config/sanitizers:deps",
53 "//mojo/environment:chromium",
58 "desktop/launcher_process.cc",
59 "desktop/launcher_process.h",
64 "android/library_loader.cc",
69 # On android, the executable is also the native library used by the apk.
70 # It means dynamic symbols must be preserved and exported.
71 ldflags = [ "-Wl,--export-dynamic" ]
75 "//mojo/services/native_viewport:lib",
76 "//mojo/shell/application_manager",
93 source_set("in_process_native_runner") {
95 "in_process_native_runner.cc",
96 "in_process_native_runner.h",
100 ":native_application_support",
101 "//mojo/shell/application_manager",
113 "child_process_host.cc",
114 "child_process_host.h",
119 "out_of_process_native_runner.cc",
120 "out_of_process_native_runner.h",
128 ":child_process_bindings",
130 ":in_process_native_runner",
131 ":native_application_support",
133 "//base/third_party/dynamic_annotations",
134 "//base:base_static",
135 "//mojo/application",
137 "//mojo/common:tracing_impl",
138 "//third_party/mojo/src/mojo/edk/system",
139 "//third_party/mojo/src/mojo/public/cpp/bindings",
140 "//third_party/mojo/src/mojo/public/interfaces/application",
141 "//mojo/services/network/public/interfaces",
142 "//mojo/shell/application_manager",
143 "//mojo/services/tracing:bindings",
153 "android/android_handler.cc",
154 "android/android_handler.h",
155 "android/android_handler_loader.cc",
156 "android/android_handler_loader.h",
157 "android/background_application_loader.cc",
158 "android/background_application_loader.h",
159 "android/keyboard_impl.cc",
160 "android/keyboard_impl.h",
161 "android/native_viewport_application_loader.cc",
162 "android/native_viewport_application_loader.h",
163 "android/ui_application_loader_android.cc",
164 "android/ui_application_loader_android.h",
169 ":run_android_application_function",
170 "//mojo/application:content_handler",
171 "//mojo/services/keyboard/public/interfaces",
172 "//mojo/services/gles2",
173 "//mojo/services/native_viewport:lib",
177 # This target includes some files behind #ifdef OS... guards. Since gn is not
178 # smart enough to understand preprocess includes, it does complains about
179 # these includes when not using the build files for that OS. Suppress checking
180 # so we can enable checking for the rest of the targets in this file.
181 # TODO: Might be better to split the files with OS-specific includes out to a
182 # separate source_set so we can leave checking on for the rest of the target.
183 check_includes = false
186 source_set("native_application_support") {
188 "native_application_support.cc",
189 "native_application_support.h",
193 "//third_party/mojo/src/mojo/public/cpp/bindings",
201 # This target has to include the public thunk headers, which generally
202 # shouldn't be included without picking an implementation. We are providing
203 # the implementation but the thunk header target cannot declare that we are
204 # permitted to include it since it's in the public SDK and we are not.
205 # Suppress include checking so we can still check the rest of the targets in
207 check_includes = false
210 source_set("switches") {
222 generate_jni("jni_headers") {
224 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
225 "android/apk/src/org/chromium/mojo/shell/Bootstrap.java",
226 "android/apk/src/org/chromium/mojo/shell/Keyboard.java",
227 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
228 "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java",
230 jni_package = "mojo/shell"
233 android_library("bootstrap_java") {
234 java_files = [ "android/apk/src/org/chromium/mojo/shell/Bootstrap.java" ]
240 dex_path = "$target_out_dir/bootstrap_java.dex.jar"
243 shared_library("bootstrap") {
245 "android/bootstrap.cc",
250 ":run_android_application_function",
255 # Shared header between the bootstrap and the main shell .so.
256 source_set("run_android_application_function") {
258 "android/run_android_application_function.h",
266 android_library("java") {
268 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
269 "android/apk/src/org/chromium/mojo/shell/FileHelper.java",
270 "android/apk/src/org/chromium/mojo/shell/Keyboard.java",
271 "android/apk/src/org/chromium/mojo/shell/MojoShellActivity.java",
272 "android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java",
273 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
281 android_resources("resources") {
282 resource_dirs = [ "android/apk/res" ]
283 custom_package = "org.chromium.mojo.shell"
286 mojo_shell_assets_dir = "$root_build_dir/mojo_shell_assets"
287 mojo_shell_test_assets_dir = "$root_build_dir/mojo_shell_test_assets"
289 copy_ex("copy_mojo_shell_assets") {
291 dest = mojo_shell_assets_dir
293 "$root_out_dir/lib.stripped/libbootstrap.so",
294 "$root_out_dir/network_service.mojo",
295 "$root_out_dir/obj/mojo/shell/bootstrap_java.dex.jar",
299 copy("copy_mojo_shell") {
301 "$root_out_dir/exe.stripped/mojo_shell",
304 "$root_out_dir/lib.stripped/libmojo_shell.so",
308 copy_ex("copy_mojo_shell_test_assets") {
310 dest = mojo_shell_test_assets_dir
312 "$root_out_dir/test_app.mojo",
313 "$root_out_dir/test_request_tracker_app.mojo",
317 android_apk("mojo_shell_apk") {
318 apk_name = "MojoShell"
320 android_manifest = "android/apk/AndroidManifest.xml"
322 native_libs = [ "libmojo_shell.so" ]
324 asset_location = mojo_shell_assets_dir
328 ":copy_mojo_shell_assets",
332 "//mojo/services/native_viewport:native_viewport_java",
333 "//third_party/android_tools:google_play_services_default_resources",
337 android_library("mojo_shell_tests_java") {
339 [ "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java" ]
348 mojom("child_process_bindings") {
350 "child_process.mojom",
354 "//third_party/mojo/src/mojo/public/interfaces/application",
358 # GYP version: mojo/mojo.gyp:mojo_shell_tests
359 test("mojo_shell_tests") {
361 "child_process_host_unittest.cc",
362 "data_pipe_peek_unittest.cc",
363 "in_process_native_runner_unittest.cc",
364 "native_runner_unittest.cc",
365 "shell_test_base.cc",
367 "shell_test_base_android.cc",
368 "shell_test_base_unittest.cc",
369 "shell_test_main.cc",
370 "url_resolver_unittest.cc",
374 ":in_process_native_runner",
378 "//base/test:test_support",
382 "//third_party/mojo/src/mojo/edk/system",
383 "//mojo/environment:chromium",
384 "//third_party/mojo/src/mojo/public/cpp/bindings",
385 "//mojo/services/test_service:bindings",
386 "//mojo/shell/application_manager",
390 "//mojo/services/test_service:test_app",
391 "//mojo/services/test_service:test_request_tracker_app",
395 sources += [ "android/background_application_loader_unittest.cc" ]
397 deps += [ ":jni_headers" ]
400 ":copy_mojo_shell_test_assets",
401 ":mojo_shell_tests_java",
404 apk_asset_location = mojo_shell_test_assets_dir
408 # GYP version: mojo/mojo.gyp:mojo_shell_test_support
409 source_set("test_support") {
411 "shell_test_helper.cc",
412 "shell_test_helper.h",
419 "//third_party/mojo/src/mojo/edk/system",
420 "//mojo/shell/application_manager",
424 mojo_native_application("apptests") {
425 output_name = "shell_apptests"
430 # TODO(jam): needs http_server service.
436 "//mojo/application",
437 "//mojo/application:test_support",
438 "//mojo/common:common",
439 "//third_party/mojo/src/mojo/public/cpp/bindings:callback",
440 "//third_party/mojo/src/mojo/public/cpp/environment",
441 "//third_party/mojo/src/mojo/public/cpp/system:system",
443 #"//mojo/services/http_server/public/cpp",
444 #"//mojo/services/http_server/public/interfaces",
445 "//mojo/services/network/public/interfaces",
446 "//mojo/shell/test:bindings",
449 #data_deps = [ "//services/http_server:http_server($default_toolchain)" ]