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)
21 "//mojo/shell/application_manager:tests",
33 import("//build/config/android/config.gni")
34 import("//build/config/android/rules.gni")
37 executable("mojo_shell") {
43 "//build/config/sanitizers:deps",
45 "//mojo/environment:chromium",
50 "desktop/launcher_process.cc",
51 "desktop/launcher_process.h",
56 "android/library_loader.cc",
61 # On android, the executable is also the native library used by the apk.
62 # It means dynamic symbols must be preserved and exported.
63 ldflags = [ "-Wl,--export-dynamic" ]
67 "//components/native_viewport:lib",
68 "//mojo/shell/application_manager",
74 source_set("in_process_native_runner") {
76 "in_process_native_runner.cc",
77 "in_process_native_runner.h",
81 ":native_application_support",
82 "//mojo/shell/application_manager",
94 "child_process_host.cc",
95 "child_process_host.h",
102 "out_of_process_native_runner.cc",
103 "out_of_process_native_runner.h",
111 ":child_process_bindings",
112 ":in_process_native_runner",
113 ":native_application_support",
115 "//base/third_party/dynamic_annotations",
116 "//base:base_static",
117 "//mojo/application",
119 "//mojo/common:tracing_impl",
120 "//third_party/mojo/src/mojo/edk/system",
121 "//third_party/mojo/src/mojo/public/cpp/bindings",
122 "//third_party/mojo/src/mojo/public/interfaces/application",
123 "//mojo/services/network/public/interfaces",
124 "//mojo/shell/application_manager",
125 "//mojo/services/tracing:bindings",
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",
172 "//third_party/mojo/src/mojo/public/cpp/bindings",
180 # This target has to include the public thunk headers, which generally
181 # shouldn't be included without picking an implementation. We are providing
182 # the implementation but the thunk header target cannot declare that we are
183 # permitted to include it since it's in the public SDK and we are not.
184 # Suppress include checking so we can still check the rest of the targets in
186 check_includes = false
189 source_set("switches") {
201 generate_jni("jni_headers") {
203 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
204 "android/apk/src/org/chromium/mojo/shell/Bootstrap.java",
205 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
206 "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java",
208 jni_package = "mojo/shell"
211 android_library("bootstrap_java") {
212 java_files = [ "android/apk/src/org/chromium/mojo/shell/Bootstrap.java" ]
218 dex_path = "$target_out_dir/bootstrap_java.dex.jar"
221 shared_library("bootstrap") {
223 "android/bootstrap.cc",
228 ":run_android_application_function",
233 # Shared header between the bootstrap and the main shell .so.
234 source_set("run_android_application_function") {
236 "android/run_android_application_function.h",
244 android_library("java") {
246 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
247 "android/apk/src/org/chromium/mojo/shell/FileHelper.java",
248 "android/apk/src/org/chromium/mojo/shell/MojoShellActivity.java",
249 "android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java",
250 "android/apk/src/org/chromium/mojo/shell/ShellMain.java",
258 android_resources("resources") {
259 resource_dirs = [ "android/apk/res" ]
260 custom_package = "org.chromium.mojo.shell"
263 mojo_shell_assets_dir = "$root_build_dir/mojo_shell_assets"
264 mojo_shell_test_assets_dir = "$root_build_dir/mojo_shell_test_assets"
266 copy_ex("copy_mojo_shell_assets") {
268 dest = mojo_shell_assets_dir
270 "$root_out_dir/lib.stripped/libbootstrap.so",
271 "$root_out_dir/network_service.mojo",
272 "$root_out_dir/obj/mojo/shell/bootstrap_java.dex.jar",
276 copy("copy_mojo_shell") {
278 "$root_out_dir/exe.stripped/mojo_shell",
281 "$root_out_dir/lib.stripped/libmojo_shell.so",
285 copy_ex("copy_mojo_shell_test_assets") {
287 dest = mojo_shell_test_assets_dir
289 "$root_out_dir/test_app.mojo",
290 "$root_out_dir/test_request_tracker_app.mojo",
294 android_apk("mojo_shell_apk") {
295 apk_name = "MojoShell"
297 android_manifest = "android/apk/AndroidManifest.xml"
299 native_libs = [ "libmojo_shell.so" ]
301 asset_location = mojo_shell_assets_dir
305 ":copy_mojo_shell_assets",
309 "//components/native_viewport:native_viewport_java",
310 "//third_party/android_tools:google_play_services_default_resources",
314 android_library("mojo_shell_tests_java") {
316 [ "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java" ]
325 mojom("child_process_bindings") {
327 "child_process.mojom",
331 "//third_party/mojo/src/mojo/public/interfaces/application",
336 output_name = "mojo_shell_unittests"
339 "child_process_host_unittest.cc",
340 "data_pipe_peek_unittest.cc",
341 "in_process_native_runner_unittest.cc",
342 "native_runner_unittest.cc",
343 "shell_test_base.cc",
345 "shell_test_base_android.cc",
346 "shell_test_base_unittest.cc",
347 "shell_test_main.cc",
348 "url_resolver_unittest.cc",
352 ":in_process_native_runner",
356 "//base/test:test_support",
360 "//third_party/mojo/src/mojo/edk/system",
361 "//mojo/environment:chromium",
362 "//third_party/mojo/src/mojo/public/cpp/bindings",
363 "//mojo/services/test_service:bindings",
364 "//mojo/shell/application_manager",
368 "//mojo/services/test_service:test_app",
369 "//mojo/services/test_service:test_request_tracker_app",
373 sources += [ "android/background_application_loader_unittest.cc" ]
375 deps += [ ":jni_headers" ]
378 ":copy_mojo_shell_test_assets",
379 ":mojo_shell_tests_java",
382 apk_asset_location = mojo_shell_test_assets_dir
386 mojo_native_application("apptests") {
387 output_name = "shell_apptests"
392 # TODO(jam): needs http_server service.
398 "//mojo/application",
399 "//mojo/application:test_support",
400 "//mojo/common:common",
401 "//third_party/mojo/src/mojo/public/cpp/bindings:callback",
402 "//third_party/mojo/src/mojo/public/cpp/environment",
403 "//third_party/mojo/src/mojo/public/cpp/system:system",
405 #"//mojo/services/http_server/public/cpp",
406 #"//mojo/services/http_server/public/interfaces",
407 "//mojo/services/network/public/interfaces",
408 "//mojo/shell/test:bindings",
411 #data_deps = [ "//services/http_server:http_server($default_toolchain)" ]