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",
111 "app_child_process_host.cc",
112 "app_child_process_host.h",
115 "child_process_host.cc",
116 "child_process_host.h",
117 "command_line_util.cc",
118 "command_line_util.h",
123 "out_of_process_native_runner.cc",
124 "out_of_process_native_runner.h",
132 ":app_child_process_bindings",
134 ":in_process_native_runner",
135 ":native_application_support",
137 "//base/third_party/dynamic_annotations",
138 "//base:base_static",
139 "//mojo/application",
141 "//mojo/common:tracing_impl",
142 "//third_party/mojo/src/mojo/edk/system",
143 "//third_party/mojo/src/mojo/public/cpp/bindings",
144 "//third_party/mojo/src/mojo/public/interfaces/application",
145 "//mojo/services/network/public/interfaces",
146 "//mojo/shell/application_manager",
147 "//mojo/services/tracing:bindings",
157 "android/android_handler.cc",
158 "android/android_handler.h",
159 "android/android_handler_loader.cc",
160 "android/android_handler_loader.h",
161 "android/background_application_loader.cc",
162 "android/background_application_loader.h",
163 "android/keyboard_impl.cc",
164 "android/keyboard_impl.h",
165 "android/native_viewport_application_loader.cc",
166 "android/native_viewport_application_loader.h",
167 "android/ui_application_loader_android.cc",
168 "android/ui_application_loader_android.h",
173 ":run_android_application_function",
174 "//mojo/application:content_handler",
175 "//mojo/services/keyboard/public/interfaces",
176 "//mojo/services/gles2",
177 "//mojo/services/native_viewport:lib",
181 # This target includes some files behind #ifdef OS... guards. Since gn is not
182 # smart enough to understand preprocess includes, it does complains about
183 # these includes when not using the build files for that OS. Suppress checking
184 # so we can enable checking for the rest of the targets in this file.
185 # TODO: Might be better to split the files with OS-specific includes out to a
186 # separate source_set so we can leave checking on for the rest of the target.
187 check_includes = false
190 source_set("native_application_support") {
192 "native_application_support.cc",
193 "native_application_support.h",
197 "//third_party/mojo/src/mojo/public/cpp/bindings",
205 # This target has to include the public thunk headers, which generally
206 # shouldn't be included without picking an implementation. We are providing
207 # the implementation but the thunk header target cannot declare that we are
208 # permitted to include it since it's in the public SDK and we are not.
209 # Suppress include checking so we can still check the rest of the targets in
211 check_includes = false
214 source_set("switches") {
226 generate_jni("jni_headers") {
228 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
229 "android/apk/src/org/chromium/mojo/shell/Bootstrap.java",
230 "android/apk/src/org/chromium/mojo/shell/Keyboard.java",
231 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
232 "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java",
234 jni_package = "mojo/shell"
237 android_library("bootstrap_java") {
238 java_files = [ "android/apk/src/org/chromium/mojo/shell/Bootstrap.java" ]
244 dex_path = "$target_out_dir/bootstrap_java.dex.jar"
247 shared_library("bootstrap") {
249 "android/bootstrap.cc",
254 ":run_android_application_function",
259 # Shared header between the bootstrap and the main shell .so.
260 source_set("run_android_application_function") {
262 "android/run_android_application_function.h",
270 android_library("java") {
272 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
273 "android/apk/src/org/chromium/mojo/shell/FileHelper.java",
274 "android/apk/src/org/chromium/mojo/shell/Keyboard.java",
275 "android/apk/src/org/chromium/mojo/shell/MojoShellActivity.java",
276 "android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java",
277 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
285 android_resources("resources") {
286 resource_dirs = [ "android/apk/res" ]
287 custom_package = "org.chromium.mojo.shell"
290 mojo_shell_assets_dir = "$root_build_dir/mojo_shell_assets"
291 mojo_shell_test_assets_dir = "$root_build_dir/mojo_shell_test_assets"
293 copy_ex("copy_mojo_shell_assets") {
295 dest = mojo_shell_assets_dir
297 "$root_out_dir/lib.stripped/libbootstrap.so",
298 "$root_out_dir/network_service.mojo",
299 "$root_out_dir/obj/mojo/shell/bootstrap_java.dex.jar",
303 copy("copy_mojo_shell") {
305 "$root_out_dir/exe.stripped/mojo_shell",
308 "$root_out_dir/lib.stripped/libmojo_shell.so",
312 copy_ex("copy_mojo_shell_test_assets") {
314 dest = mojo_shell_test_assets_dir
316 "$root_out_dir/test_app.mojo",
317 "$root_out_dir/test_request_tracker_app.mojo",
321 android_apk("mojo_shell_apk") {
322 apk_name = "MojoShell"
324 android_manifest = "android/apk/AndroidManifest.xml"
326 native_libs = [ "libmojo_shell.so" ]
328 asset_location = mojo_shell_assets_dir
332 ":copy_mojo_shell_assets",
336 "//mojo/services/native_viewport:native_viewport_java",
337 "//third_party/android_tools:google_play_services_default_resources",
341 android_library("mojo_shell_tests_java") {
343 [ "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java" ]
352 mojom("app_child_process_bindings") {
354 "app_child_process.mojom",
358 "//third_party/mojo/src/mojo/public/interfaces/application",
362 # GYP version: mojo/mojo.gyp:mojo_shell_tests
363 test("mojo_shell_tests") {
365 "app_child_process_host_unittest.cc",
366 "command_line_util_unittest.cc",
367 "data_pipe_peek_unittest.cc",
368 "in_process_native_runner_unittest.cc",
369 "native_runner_unittest.cc",
370 "shell_test_base.cc",
372 "shell_test_base_android.cc",
373 "shell_test_base_unittest.cc",
374 "shell_test_main.cc",
375 "url_resolver_unittest.cc",
379 ":in_process_native_runner",
383 "//base/test:test_support",
387 "//third_party/mojo/src/mojo/edk/system",
388 "//mojo/environment:chromium",
389 "//third_party/mojo/src/mojo/public/cpp/bindings",
390 "//mojo/services/test_service:bindings",
391 "//mojo/shell/application_manager",
395 "//mojo/services/test_service:test_app",
396 "//mojo/services/test_service:test_request_tracker_app",
400 sources += [ "android/background_application_loader_unittest.cc" ]
402 deps += [ ":jni_headers" ]
405 ":copy_mojo_shell_test_assets",
406 ":mojo_shell_tests_java",
409 apk_asset_location = mojo_shell_test_assets_dir
413 # GYP version: mojo/mojo.gyp:mojo_shell_test_support
414 source_set("test_support") {
416 "shell_test_helper.cc",
417 "shell_test_helper.h",
424 "//third_party/mojo/src/mojo/edk/system",
425 "//mojo/shell/application_manager",
429 mojo_native_application("apptests") {
430 output_name = "shell_apptests"
435 # TODO(jam): needs http_server service.
441 "//mojo/application",
442 "//mojo/application:test_support",
443 "//mojo/common:common",
444 "//third_party/mojo/src/mojo/public/cpp/bindings:callback",
445 "//third_party/mojo/src/mojo/public/cpp/environment",
446 "//third_party/mojo/src/mojo/public/cpp/system:system",
448 #"//mojo/services/http_server/public/cpp",
449 #"//mojo/services/http_server/public/interfaces",
450 "//mojo/services/network/public/interfaces",
451 "//mojo/shell/test:bindings",
454 #data_deps = [ "//services/http_server:http_server($default_toolchain)" ]