blob: f18d61d0a8e8f48c473e10bcc6df44c924cb8521 [file] [log] [blame]
James Robinson646469d2014-10-03 15:33:28 -07001# 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.
4
Aaron Boodmana10f6712014-10-23 10:01:51 -07005import("//build/config/ui.gni")
Aaron Boodmanf9b1d792014-10-23 13:35:57 -07006import("//mojo/public/mojo.gni")
Aaron Boodmanb34bcbf2015-03-02 10:05:31 -08007import("//mojo/public/mojo_application.gni")
Aaron Boodmanf9b1d792014-10-23 13:35:57 -07008import("//mojo/public/tools/bindings/mojom.gni")
Benjamin Lermandc3d1932015-03-09 11:17:39 +01009import("//mojo/tools/embed/rules.gni")
James Robinson5e66a792015-01-21 17:02:08 -080010import("//testing/test.gni")
James Robinson646469d2014-10-03 15:33:28 -070011
James Robinson1d532712014-11-03 14:50:36 -080012# We don't support building in the component build since mojo apps are
13# inherently components.
14assert(!is_component_build)
15
James Robinsonb4b7af22014-12-05 11:21:01 -080016group("shell") {
17 testonly = true
18
19 deps = [
Dale Sather958af742016-01-06 13:59:32 -080020 ":copy_symbols",
James Robinsonb4b7af22014-12-05 11:21:01 -080021 ":mojo_shell",
22 ":tests",
23 ]
24
Benjamin Lermanfbbee732014-12-08 17:05:48 +010025 if (is_android) {
Benjamin Lerman7d036f02014-12-23 10:39:19 +010026 deps += [
27 ":mojo_shell_apk",
Benjamin Lerman2cb62372015-01-22 13:25:11 +010028 ":mojo_shell_tests_apk",
Benjamin Lerman7d036f02014-12-23 10:39:19 +010029 ]
Benjamin Lermanfbbee732014-12-08 17:05:48 +010030 }
James Robinsonb4b7af22014-12-05 11:21:01 -080031}
32
33group("tests") {
34 testonly = true
35 deps = [
James Robinson25dfab22015-08-24 15:20:18 -070036 ":apptests",
James Robinsonb4b7af22014-12-05 11:21:01 -080037 ":mojo_shell_tests",
Andrew Wilson7d0e7952015-06-29 11:21:09 -070038 ":shell_nfc_apptests",
Przemysław Pietrzkiewicz6384d092015-01-15 16:03:17 -080039 "//shell/application_manager:mojo_application_manager_unittests",
James Robinsonb4b7af22014-12-05 11:21:01 -080040 ]
James Robinson04362ac2015-09-18 18:24:02 -070041
craig stout34776a72015-10-22 08:17:33 -070042 # TODO(cstout): fix breakpad build for fnl/musl
43 # https://code.google.com/p/google-breakpad/issues/detail?id=631
44 if ((is_android || is_linux) && !is_fnl) {
James Robinson04362ac2015-09-18 18:24:02 -070045 deps += [ "//shell/crash:crash_unittests" ]
46 }
James Robinsonb4b7af22014-12-05 11:21:01 -080047}
48
Dave Moorec9728322014-10-23 20:55:51 -070049if (is_android) {
50 import("//build/config/android/config.gni")
51 import("//build/config/android/rules.gni")
52}
53
Scott Violet912f52f2015-03-26 07:30:24 -070054if (!mojo_use_prebuilt_mojo_shell) {
Benjamin Lerman8e4554d2015-04-13 23:47:21 +020055 shell_common_deps = [
Viet-Trung Luu988b4be2015-05-15 13:00:15 -070056 ":parent_lib",
Benjamin Lerman8e4554d2015-04-13 23:47:21 +020057 "//base",
58 "//base/allocator",
59 "//build/config/sanitizers:deps",
Benjamin Lerman8e4554d2015-04-13 23:47:21 +020060 "//mojo/environment:chromium",
James Robinson94ade6b2015-08-25 13:02:06 -070061 "//mojo/message_pump",
Benjamin Lerman8e4554d2015-04-13 23:47:21 +020062 ]
63 shell_common_data_deps = [ ":mojo_shell_child" ]
Aaron Boodmanf9b1d792014-10-23 13:35:57 -070064
craig stout34776a72015-10-22 08:17:33 -070065 # TODO(cstout): fix breakpad build for fnl/musl
66 # (see comment above)
67 if ((is_android || is_linux) && !is_fnl) {
James Robinson04362ac2015-09-18 18:24:02 -070068 shell_common_deps += [ "//shell/crash" ]
69 }
70
Benjamin Lerman8e4554d2015-04-13 23:47:21 +020071 if (is_android) {
72 shared_library("mojo_shell") {
73 sources = [
Benjamin Lerman5308b712014-12-12 17:52:00 +010074 "android/library_loader.cc",
Viet-Trung Luu7cc14662015-03-30 11:06:27 -070075 "android/main.cc",
76 "android/main.h",
Benjamin Lerman5308b712014-12-12 17:52:00 +010077 ]
78
Benjamin Lerman8e4554d2015-04-13 23:47:21 +020079 deps = shell_common_deps + [
80 ":jni_headers",
cdotstoutc45263e2015-09-21 13:41:21 -070081 "//gpu/config",
James Robinson27257282015-04-16 17:11:15 -070082 "//mojo/android:libsystem_java",
Benjamin Lerman11bc6052015-11-13 17:10:48 +010083 "//mojo/common",
Benjamin Lerman8e4554d2015-04-13 23:47:21 +020084 "//services/native_viewport:lib",
Benjamin Lermaned52cc12016-03-30 09:30:49 +020085 "//services/ui/launcher:bindings",
Benjamin Lerman8e4554d2015-04-13 23:47:21 +020086 "//shell/application_manager",
87 "//ui/gl",
88 ]
Benjamin Lerman5308b712014-12-12 17:52:00 +010089
Benjamin Lerman8e4554d2015-04-13 23:47:21 +020090 data_deps = shell_common_data_deps
91 }
92 } else {
93 executable("mojo_shell") {
94 sources = [
95 "desktop/main.cc",
Benjamin Lerman5308b712014-12-12 17:52:00 +010096 ]
Benjamin Lerman8e4554d2015-04-13 23:47:21 +020097
Sean Kleina7ffbe02015-09-15 17:30:28 -070098 deps = shell_common_deps + [ ":mojo_shell_child_32_bit" ]
Benjamin Lerman8e4554d2015-04-13 23:47:21 +020099
100 data_deps = shell_common_data_deps
Benjamin Lerman5308b712014-12-12 17:52:00 +0100101 }
James Robinson8bcf28e2014-12-03 17:39:48 -0800102 }
Viet-Trung Luue0a4a182015-04-07 16:28:01 -0700103
104 executable("mojo_shell_child") {
105 sources = [
106 "child_main.cc",
107 ]
108
109 deps = [
Viet-Trung Luue0a4a182015-04-07 16:28:01 -0700110 ":child_controller_bindings",
Viet-Trung Luudd63a382015-04-08 16:03:57 -0700111 ":common_lib",
Viet-Trung Luue0a4a182015-04-07 16:28:01 -0700112 "//base",
113 "//base/allocator",
114 "//build/config/sanitizers:deps",
Viet-Trung Luu1da183c2015-11-18 15:41:35 -0800115 "//mojo/edk/base_edk",
Viet-Trung Luue0a4a182015-04-07 16:28:01 -0700116 "//mojo/edk/system",
117 "//mojo/environment:chromium",
James Robinson94ade6b2015-08-25 13:02:06 -0700118 "//mojo/message_pump",
Viet-Trung Luue0a4a182015-04-07 16:28:01 -0700119 ]
120 }
Sean Kleina7ffbe02015-09-15 17:30:28 -0700121
122 if (current_cpu == "x86") {
123 # The 32-bit version of the mojo_shell_child should be accessible in the
124 # root build directory, just like the regular mojo_shell_child, so that
125 # the 32-bit version can be accessed by simply adding a suffix to the path.
126 copy("mojo_shell_child_32_bit_copy") {
127 sources = [
128 "${root_out_dir}/mojo_shell_child",
129 ]
130 outputs = [
131 "${root_build_dir}/mojo_shell_child_32",
132 ]
133 deps = [
134 ":mojo_shell_child",
135 ]
136 }
137 }
138
139 group("mojo_shell_child_32_bit") {
140 # This group is required to run any 32-bit child process.
141 deps = []
Craig Stout0e7c2c32015-09-17 15:14:08 -0700142 if ((target_cpu == "x64" || target_cpu == "x86") && is_linux && !is_fnl) {
Sean Kleina7ffbe02015-09-15 17:30:28 -0700143 # The toolchain is hardcoded as 32-bit clang here -- although it must
144 # be 32 bit (for nonsfi), it assumes clang. Ideally, the toolchain would
145 # be defined as the 32 bit variant of whatever is being used (be it clang,
146 # gcc, or something else).
147 deps = [
148 ":mojo_shell_child_32_bit_copy(//build/toolchain/linux:clang_x86)",
149 ]
150 }
151 }
Scott Violet912f52f2015-03-26 07:30:24 -0700152} # !mojo_use_prebuilt_mojo_shell
Aaron Boodmanf9b1d792014-10-23 13:35:57 -0700153
Viet-Trung Luudd63a382015-04-08 16:03:57 -0700154# Files used both by mojo_shell and mojo_shell_child (and tests).
155source_set("common_lib") {
Chris Masone246b59b2014-12-01 15:43:53 -0800156 sources = [
Viet-Trung Luu988b4be2015-05-15 13:00:15 -0700157 "child_switches.cc",
158 "child_switches.h",
Chris Masone246b59b2014-12-01 15:43:53 -0800159 "init.cc",
160 "init.h",
161 ]
162
163 deps = [
164 "//base",
165 ]
Viet-Trung Luudd63a382015-04-08 16:03:57 -0700166
167 public_deps = [
168 ":native_application_support",
Viet-Trung Luudd63a382015-04-08 16:03:57 -0700169 ]
Chris Masone246b59b2014-12-01 15:43:53 -0800170}
171
Viet-Trung Luu988b4be2015-05-15 13:00:15 -0700172source_set("parent_lib") {
James Robinson646469d2014-10-03 15:33:28 -0700173 sources = [
Benjamin Lerman5d429aa2015-05-07 16:21:00 +0200174 "background_application_loader.cc",
175 "background_application_loader.h",
James Robinson646469d2014-10-03 15:33:28 -0700176 "child_process_host.cc",
177 "child_process_host.h",
Benjamin Lerman4fc210c2014-12-18 18:18:06 +0100178 "command_line_util.cc",
179 "command_line_util.h",
James Robinson646469d2014-10-03 15:33:28 -0700180 "context.cc",
181 "context.h",
James Robinson24218d72014-10-20 16:18:41 -0700182 "filename_util.cc",
183 "filename_util.h",
Viet-Trung Luu463c4d72015-04-08 14:55:01 -0700184 "in_process_native_runner.cc",
185 "in_process_native_runner.h",
Viet-Trung Luu47e2e352015-03-04 16:38:18 -0800186 "out_of_process_native_runner.cc",
187 "out_of_process_native_runner.h",
Viet-Trung Luu988b4be2015-05-15 13:00:15 -0700188 "switches.cc",
189 "switches.h",
James Robinson646469d2014-10-03 15:33:28 -0700190 "task_runners.cc",
191 "task_runners.h",
James Robinsonf0f18602015-04-10 11:29:47 -0700192 "tracer.cc",
193 "tracer.h",
Nick Brayf54e4652015-03-12 17:07:42 -0700194 "url_resolver.cc",
195 "url_resolver.h",
Benjamin Lerman5d429aa2015-05-07 16:21:00 +0200196 "url_response_disk_cache_loader.cc",
197 "url_response_disk_cache_loader.h",
James Robinson646469d2014-10-03 15:33:28 -0700198 ]
199
Dave Moorec9728322014-10-23 20:55:51 -0700200 deps = [
Viet-Trung Luuf09c0d92015-04-01 14:38:57 -0700201 ":child_controller_bindings",
Dave Moorec9728322014-10-23 20:55:51 -0700202 "//base",
Dave Moorec9728322014-10-23 20:55:51 -0700203 "//base:base_static",
Dale Sather958af742016-01-06 13:59:32 -0800204 "//base/third_party/dynamic_annotations",
Dave Moorec9728322014-10-23 20:55:51 -0700205 "//mojo/application",
Dave Moorec9728322014-10-23 20:55:51 -0700206 "//mojo/common",
James Robinson85ccf052014-12-01 16:31:03 -0800207 "//mojo/common:tracing_impl",
James Robinson94ade6b2015-08-25 13:02:06 -0700208 "//mojo/data_pipe_utils",
Viet-Trung Luu1da183c2015-11-18 15:41:35 -0800209 "//mojo/edk/base_edk",
Dave Moorec9728322014-10-23 20:55:51 -0700210 "//mojo/edk/system",
James Robinsona600ca52014-11-21 13:13:55 -0800211 "//mojo/public/cpp/bindings",
Dave Moorec9728322014-10-23 20:55:51 -0700212 "//mojo/public/interfaces/application",
Viet-Trung Luu2e11a3f2015-10-13 13:20:30 -0700213 "//mojo/services/network/interfaces",
Viet-Trung Luu0f4f3ba2015-10-10 01:08:40 -0700214 "//mojo/services/tracing/interfaces",
Benjamin Lerman5d429aa2015-05-07 16:21:00 +0200215 "//services/url_response_disk_cache",
Benjamin Lermanf87cd452015-06-26 14:29:23 +0200216 "//shell/application_manager",
James Robinson85ccf052014-12-01 16:31:03 -0800217 "//url",
Dave Moorec9728322014-10-23 20:55:51 -0700218 ]
219
Scott Violetef1cb8c2015-03-13 14:01:39 -0700220 public_deps = [
Viet-Trung Luudd63a382015-04-08 16:03:57 -0700221 ":common_lib",
Scott Violetef1cb8c2015-03-13 14:01:39 -0700222 ]
223
James Robinson646469d2014-10-03 15:33:28 -0700224 if (is_android) {
James Robinson646469d2014-10-03 15:33:28 -0700225 sources += [
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100226 "android/android_handler.cc",
Scott Violetbc1184a2014-12-16 08:55:34 -0800227 "android/android_handler.h",
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100228 "android/android_handler_loader.cc",
Scott Violetbc1184a2014-12-16 08:55:34 -0800229 "android/android_handler_loader.h",
Benjamin Lermanf212dd42015-06-22 15:10:46 +0200230 "android/java_application_loader.cc",
231 "android/java_application_loader.h",
Benjamin Lermane15069c2015-11-18 13:59:29 +0100232 "android/native_handler_thread.cc",
233 "android/native_handler_thread.h",
Scott Violetc5399f82014-12-17 07:59:05 -0800234 "android/native_viewport_application_loader.cc",
235 "android/native_viewport_application_loader.h",
Scott Violetbc1184a2014-12-16 08:55:34 -0800236 "android/ui_application_loader_android.cc",
237 "android/ui_application_loader_android.h",
Benjamin Lermanc440c742015-09-28 13:52:53 +0200238 "android/url_response_disk_cache_delegate_impl.cc",
239 "android/url_response_disk_cache_delegate_impl.h",
James Robinson646469d2014-10-03 15:33:28 -0700240 ]
Dave Moorec9728322014-10-23 20:55:51 -0700241
242 deps += [
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100243 ":jni_headers",
Przemyslaw Pietrzkiewicz78ab4132014-12-03 16:49:32 +0100244 ":run_android_application_function",
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100245 "//mojo/application:content_handler",
Viet-Trung Luu08e339a2015-10-10 01:03:09 -0700246 "//mojo/services/content_handler/interfaces",
Viet-Trung Luu84765c42015-10-10 01:07:51 -0700247 "//mojo/services/gpu/interfaces",
248 "//mojo/services/native_viewport/interfaces",
James Robinsonc9b163e2014-12-03 13:31:32 -0800249 "//services/gles2",
250 "//services/native_viewport:lib",
Dave Moorec9728322014-10-23 20:55:51 -0700251 ]
252 }
James Robinson04362ac2015-09-18 18:24:02 -0700253
254 if (is_mac) {
255 sources -= [
256 "url_response_disk_cache_loader.cc",
257 "url_response_disk_cache_loader.h",
258 ]
259
260 deps -= [ "//services/url_response_disk_cache" ]
261 }
Dave Moorec9728322014-10-23 20:55:51 -0700262}
263
Viet-Trung Luu463c4d72015-04-08 14:55:01 -0700264# This is a separate target mainly since it suppresses check_includes.
265# TODO(vtl): Make it so that the suppression isn't needed.
Viet-Trung Luue126c862015-03-30 19:20:45 -0700266source_set("native_application_support") {
267 sources = [
268 "native_application_support.cc",
269 "native_application_support.h",
Forrest Reiling74b0cac2016-03-02 16:21:15 -0800270 "platform_handle_impl.cc",
Viet-Trung Luue126c862015-03-30 19:20:45 -0700271 ]
272
273 public_deps = [
274 "//mojo/public/cpp/bindings",
275 ]
276
277 deps = [
278 "//base",
James Robinsonaec09ca2015-08-24 10:37:59 -0700279 "//mojo/gles2:control_thunks",
280 "//mojo/gles2:gles2",
James Robinson1e96a132015-08-13 13:08:17 -0700281 "//mojo/gles2:mgl",
Forrest Reiling74b0cac2016-03-02 16:21:15 -0800282 "//mojo/public/platform/native:platform_handle_api",
Viet-Trung Luue126c862015-03-30 19:20:45 -0700283 ]
284
285 # This target has to include the public thunk headers, which generally
286 # shouldn't be included without picking an implementation. We are providing
287 # the implementation but the thunk header target cannot declare that we are
288 # permitted to include it since it's in the public SDK and we are not.
289 # Suppress include checking so we can still check the rest of the targets in
290 # this file.
291 check_includes = false
292}
293
Dave Moorec9728322014-10-23 20:55:51 -0700294if (is_android) {
295 generate_jni("jni_headers") {
296 sources = [
Benjamin Lermanada61382014-12-19 16:05:51 +0100297 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
298 "android/apk/src/org/chromium/mojo/shell/Bootstrap.java",
Benjamin Lermanf212dd42015-06-22 15:10:46 +0200299 "android/apk/src/org/chromium/mojo/shell/JavaApplicationRegistry.java",
Benjamin Lermane15069c2015-11-18 13:59:29 +0100300 "android/apk/src/org/chromium/mojo/shell/NativeHandlerThread.java",
Etienne Membrivesd2627452015-08-05 15:42:53 +0200301 "android/apk/src/org/chromium/mojo/shell/ShellService.java",
Benjamin Lerman7d036f02014-12-23 10:39:19 +0100302 "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java",
Dave Moorec9728322014-10-23 20:55:51 -0700303 ]
Scott Violetbc1184a2014-12-16 08:55:34 -0800304 jni_package = "mojo/shell"
Dave Moorec9728322014-10-23 20:55:51 -0700305 }
306
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100307 android_library("bootstrap_java") {
Benjamin Lermanada61382014-12-19 16:05:51 +0100308 java_files = [ "android/apk/src/org/chromium/mojo/shell/Bootstrap.java" ]
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100309
310 deps = [
311 "//base:base_java",
312 ]
313
314 dex_path = "$target_out_dir/bootstrap_java.dex.jar"
315 }
316
317 shared_library("bootstrap") {
318 sources = [
319 "android/bootstrap.cc",
320 ]
321 deps = [
322 ":jni_headers",
Przemyslaw Pietrzkiewicz78ab4132014-12-03 16:49:32 +0100323 ":run_android_application_function",
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100324 "//base",
Przemyslaw Pietrzkiewicz78ab4132014-12-03 16:49:32 +0100325 ]
326 }
327
328 # Shared header between the bootstrap and the main shell .so.
329 source_set("run_android_application_function") {
330 sources = [
331 "android/run_android_application_function.h",
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100332 ]
Scott Violetc5399f82014-12-17 07:59:05 -0800333
334 deps = [
335 "//base",
336 ]
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100337 }
338
Dave Moorec9728322014-10-23 20:55:51 -0700339 android_library("java") {
340 java_files = [
Benjamin Lerman9842dd72015-11-24 16:33:21 +0100341 "android/apk/src/org/chromium/mojo/shell/AndroidFactory.java",
Benjamin Lermanada61382014-12-19 16:05:51 +0100342 "android/apk/src/org/chromium/mojo/shell/AndroidHandler.java",
Benjamin Lerman7a6f76b2015-11-02 15:24:04 +0100343 "android/apk/src/org/chromium/mojo/shell/BaseActivity.java",
Benjamin Lermanada61382014-12-19 16:05:51 +0100344 "android/apk/src/org/chromium/mojo/shell/FileHelper.java",
Benjamin Lerman785958d2015-11-12 15:11:11 +0100345 "android/apk/src/org/chromium/mojo/shell/InputFactory.java",
Etienne Membrivese1907052015-08-13 14:17:07 +0200346 "android/apk/src/org/chromium/mojo/shell/IntentReceiverActivity.java",
Benjamin Lerman1a8ef402015-04-08 13:47:49 +0200347 "android/apk/src/org/chromium/mojo/shell/IntentReceiverRegistry.java",
Benjamin Lermanf212dd42015-06-22 15:10:46 +0200348 "android/apk/src/org/chromium/mojo/shell/JavaApplicationRegistry.java",
349 "android/apk/src/org/chromium/mojo/shell/KeyboardFactory.java",
Benjamin Lermanada61382014-12-19 16:05:51 +0100350 "android/apk/src/org/chromium/mojo/shell/MojoShellActivity.java",
351 "android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java",
Benjamin Lermane15069c2015-11-18 13:59:29 +0100352 "android/apk/src/org/chromium/mojo/shell/NativeHandlerThread.java",
Etienne Membrivesfbd9af02015-08-07 16:26:09 +0200353 "android/apk/src/org/chromium/mojo/shell/NativeViewportSupportApplicationDelegate.java",
Andrew Wilson7d0e7952015-06-29 11:21:09 -0700354 "android/apk/src/org/chromium/mojo/shell/NfcApplicationDelegate.java",
355 "android/apk/src/org/chromium/mojo/shell/NfcDbManager.java",
356 "android/apk/src/org/chromium/mojo/shell/NfcImpl.java",
357 "android/apk/src/org/chromium/mojo/shell/NfcReceiverActivity.java",
358 "android/apk/src/org/chromium/mojo/shell/NfcServiceFactoryBinder.java",
P.Y. Laligande9d96fe2015-07-15 11:11:10 -0700359 "android/apk/src/org/chromium/mojo/shell/SharingActivity.java",
360 "android/apk/src/org/chromium/mojo/shell/SharingApplicationDelegate.java",
Etienne Membrivesd2627452015-08-05 15:42:53 +0200361 "android/apk/src/org/chromium/mojo/shell/ShellService.java",
Etienne Membrivesfbd9af02015-08-07 16:26:09 +0200362 "android/apk/src/org/chromium/mojo/shell/ViewportActivity.java",
Dave Moorec9728322014-10-23 20:55:51 -0700363 ]
364
365 deps = [
Andrew Wilsond4335732015-06-16 12:36:22 -0700366 ":resources",
Dave Moorec9728322014-10-23 20:55:51 -0700367 "//base:base_java",
James Robinson27257282015-04-16 17:11:15 -0700368 "//mojo/android:system_java",
Benjamin Lermanf212dd42015-06-22 15:10:46 +0200369 "//mojo/public/interfaces/application:application_java",
370 "//mojo/public/java:application",
Benjamin Lerman56e17052015-04-22 13:59:00 +0200371 "//mojo/public/java:bindings",
James Robinson27257282015-04-16 17:11:15 -0700372 "//mojo/public/java:system",
Benjamin Lerman9842dd72015-11-24 16:33:21 +0100373 "//mojo/services/android/interfaces:interfaces_java",
Benjamin Lerman785958d2015-11-12 15:11:11 +0100374 "//mojo/services/input/interfaces:interfaces_java",
Viet-Trung Luu84765c42015-10-10 01:07:51 -0700375 "//mojo/services/keyboard/interfaces:interfaces_java",
Benjamin Lerman785958d2015-11-12 15:11:11 +0100376 "//mojo/services/nfc/interfaces:interfaces_java",
Benjamin Lerman9842dd72015-11-24 16:33:21 +0100377 "//services/android",
Benjamin Lermana6fb7a22015-09-08 13:48:28 +0200378 "//services/authentication",
Benjamin Lerman785958d2015-11-12 15:11:11 +0100379 "//services/input",
Benjamin Lermanf212dd42015-06-22 15:10:46 +0200380 "//services/intent_receiver:bindings_java",
Benjamin Lerman785958d2015-11-12 15:11:11 +0100381 "//services/keyboard",
382 "//services/location",
Etienne Membrivesfbd9af02015-08-07 16:26:09 +0200383 "//services/native_viewport:interfaces_java",
Benjamin Lerman785958d2015-11-12 15:11:11 +0100384 "//services/native_viewport:native_viewport_java",
Andrew Wilson7d0e7952015-06-29 11:21:09 -0700385 "//services/nfc_message_sink:bindings_java",
P.Y. Laligande9d96fe2015-07-15 11:11:10 -0700386 "//services/sharing_sink:bindings_java",
Benjamin Lerman7a6f76b2015-11-02 15:24:04 +0100387 "//third_party/android_tools:android_support_v13_java",
Benjamin Lermane8809852016-02-17 19:47:04 +0100388 "//ui/gl:gl_java",
Dave Moorec9728322014-10-23 20:55:51 -0700389 ]
390 }
391
Etienne Membrives2c315ae2015-06-02 13:16:25 +0200392 if (is_official_build) {
393 icon_dir = "android/apk/res-official"
394 } else {
395 icon_dir = "android/apk/res-dev"
396 }
397
Dave Moorec9728322014-10-23 20:55:51 -0700398 android_resources("resources") {
Etienne Membrives2c315ae2015-06-02 13:16:25 +0200399 resource_dirs = [
400 "android/apk/res",
401 icon_dir,
402 ]
Benjamin Lermanada61382014-12-19 16:05:51 +0100403 custom_package = "org.chromium.mojo.shell"
Dave Moorec9728322014-10-23 20:55:51 -0700404 }
405
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100406 mojo_shell_assets_dir = "$root_build_dir/mojo_shell_assets"
Benjamin Lerman7d036f02014-12-23 10:39:19 +0100407 mojo_shell_test_assets_dir = "$root_build_dir/mojo_shell_test_assets"
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100408
409 copy_ex("copy_mojo_shell_assets") {
410 clear_dir = true
411 dest = mojo_shell_assets_dir
412 sources = [
Viet-Trung Luue0a4a182015-04-07 16:28:01 -0700413 "$root_out_dir/exe.stripped/mojo_shell_child",
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100414 "$root_out_dir/lib.stripped/libbootstrap.so",
Przemyslaw Pietrzkiewicz170449d2014-12-11 11:00:01 +0100415 "$root_out_dir/network_service.mojo",
Benjamin Lerman6f062922014-12-09 15:20:54 +0100416 "$root_out_dir/obj/shell/bootstrap_java.dex.jar",
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100417 ]
Craig Stout677be222015-08-04 15:15:18 -0700418 deps = [
Craig Stout677be222015-08-04 15:15:18 -0700419 ":bootstrap",
420 ":bootstrap_java",
Dale Sather958af742016-01-06 13:59:32 -0800421 ":mojo_shell_child",
Craig Stout677be222015-08-04 15:15:18 -0700422 "//mojo/public/tools:copy_network_service",
423 ]
Benjamin Lermanc440c742015-09-28 13:52:53 +0200424
425 if (!is_debug) {
426 sources += [
427 "$root_out_dir/authenticating_url_loader_interceptor.mojo",
Benjamin Lerman352cf9f2016-03-21 15:08:58 +0100428 "$root_out_dir/compositor_service.mojo",
Benjamin Lermanc440c742015-09-28 13:52:53 +0200429 "$root_out_dir/dart_content_handler.mojo",
Benjamin Lerman352cf9f2016-03-21 15:08:58 +0100430 "$root_out_dir/files.mojo",
Benjamin Lermanc440c742015-09-28 13:52:53 +0200431 "$root_out_dir/icu_data.mojo",
Benjamin Lerman352cf9f2016-03-21 15:08:58 +0100432 "$root_out_dir/input_manager_service.mojo",
Benjamin Lermanc440c742015-09-28 13:52:53 +0200433 "$root_out_dir/java_handler.mojo",
Benjamin Lerman352cf9f2016-03-21 15:08:58 +0100434 "$root_out_dir/launcher.mojo",
435 "$root_out_dir/speech_recognizer.mojo",
Benjamin Lermanc440c742015-09-28 13:52:53 +0200436 "$root_out_dir/tracing.mojo",
Benjamin Lerman352cf9f2016-03-21 15:08:58 +0100437 "$root_out_dir/view_manager_service.mojo",
Benjamin Lermanc440c742015-09-28 13:52:53 +0200438 ]
439
440 deps += [
441 "//services/authenticating_url_loader_interceptor",
Benjamin Lermanc440c742015-09-28 13:52:53 +0200442 "//services/dart:dart_content_handler",
Benjamin Lerman352cf9f2016-03-21 15:08:58 +0100443 "//services/files",
444 "//services/gfx/compositor",
Benjamin Lermanc440c742015-09-28 13:52:53 +0200445 "//services/icu_data",
Dale Sather958af742016-01-06 13:59:32 -0800446 "//services/java_handler",
Benjamin Lerman352cf9f2016-03-21 15:08:58 +0100447 "//services/speech_recognizer",
Benjamin Lermanc440c742015-09-28 13:52:53 +0200448 "//services/tracing",
Benjamin Lerman352cf9f2016-03-21 15:08:58 +0100449 "//services/ui/input_manager",
450 "//services/ui/launcher",
451 "//services/ui/view_manager",
Benjamin Lermanc440c742015-09-28 13:52:53 +0200452 ]
453 }
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100454 }
455
Benjamin Lerman7d036f02014-12-23 10:39:19 +0100456 copy_ex("copy_mojo_shell_test_assets") {
457 clear_dir = true
458 dest = mojo_shell_test_assets_dir
459 sources = [
460 "$root_out_dir/test_app.mojo",
461 "$root_out_dir/test_request_tracker_app.mojo",
462 ]
Craig Stout677be222015-08-04 15:15:18 -0700463 deps = [
464 "//services/test_service:test_app",
465 "//services/test_service:test_request_tracker_app",
466 ]
Benjamin Lerman7d036f02014-12-23 10:39:19 +0100467 }
468
Etienne Membrives0ebb0e62015-06-01 09:46:42 +0200469 if (!is_official_build) {
470 manifest_package = "org.chromium.mojo.shell"
471 apk_name = "Mojo Shell (dev)"
Benjamin Lerman3b02af62015-11-12 15:46:00 +0100472 debuggable = "true"
Etienne Membrives0ebb0e62015-06-01 09:46:42 +0200473 } else {
Etienne Membrives79888662015-06-17 13:00:21 +0200474 manifest_package = "io.mojoapps.launcher"
Etienne Membrives0ebb0e62015-06-01 09:46:42 +0200475 apk_name = "Mojo Shell"
Benjamin Lerman3b02af62015-11-12 15:46:00 +0100476 debuggable = "false"
Etienne Membrives0ebb0e62015-06-01 09:46:42 +0200477 }
478
Etienne Membrives54b7b1a2015-06-01 15:20:33 +0200479 if (is_official_build) {
480 # Force GN to re-generate ninja files when a new commit is present.
481 read_file("//.git/index", "")
482 version_code =
483 exec_script("//mojo/public/tools/gn/last_commit_timestamp.py",
484 [
485 "--directory",
486 rebase_path("//", root_build_dir),
487 ],
488 "trim string")
Etienne Membrives79888662015-06-17 13:00:21 +0200489
490 # Download the keystore for signing.
491 keystore_path = "$root_build_dir/mojo_shell-official.keystore"
492 action("download_keystore") {
493 script = "//mojo/tools/download_keystore.py"
494 outputs = [
495 keystore_path,
496 ]
Etienne Membrives3f274992015-06-18 18:55:07 +0200497 args = [
498 "keystore_file",
499 rebase_path(keystore_path, root_build_dir),
500 ]
Etienne Membrives79888662015-06-17 13:00:21 +0200501 }
Etienne Membrives3f274992015-06-18 18:55:07 +0200502 keystore_password = exec_script("//mojo/tools/download_keystore.py",
503 [ "keystore_password" ],
504 "trim string")
Etienne Membrives54b7b1a2015-06-01 15:20:33 +0200505 } else {
506 version_code = "1"
507 }
508 version_name = "0.0.1"
509
Etienne Membrives0ebb0e62015-06-01 09:46:42 +0200510 jinja_variables = [
511 "manifest_package=$manifest_package",
512 "apk_name=$apk_name",
Benjamin Lerman3b02af62015-11-12 15:46:00 +0100513 "debuggable=$debuggable",
Etienne Membrives54b7b1a2015-06-01 15:20:33 +0200514 "version_code=$version_code",
515 "version_name=$version_name",
Etienne Membrives0ebb0e62015-06-01 09:46:42 +0200516 ]
517
518 mojo_shell_manifest =
519 "$target_gen_dir/mojo_shell_manifest/AndroidManifest.xml"
520
521 jinja_template("mojo_shell_manifest") {
522 variables = jinja_variables
523 input = "android/apk/AndroidManifest.xml.jinja2"
524 output = mojo_shell_manifest
525 }
526
Dave Moorec9728322014-10-23 20:55:51 -0700527 android_apk("mojo_shell_apk") {
528 apk_name = "MojoShell"
529
Etienne Membrives0ebb0e62015-06-01 09:46:42 +0200530 android_manifest = mojo_shell_manifest
Dave Moorec9728322014-10-23 20:55:51 -0700531
James Robinson8bcf28e2014-12-03 17:39:48 -0800532 native_libs = [ "libmojo_shell.so" ]
Dave Moorec9728322014-10-23 20:55:51 -0700533
Benjamin Lerman2cb62372015-01-22 13:25:11 +0100534 asset_location = mojo_shell_assets_dir
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100535
Dave Moorec9728322014-10-23 20:55:51 -0700536 deps = [
Przemyslaw Pietrzkiewicz168bb122014-11-25 20:15:15 +0100537 ":copy_mojo_shell_assets",
Dave Moorec9728322014-10-23 20:55:51 -0700538 ":java",
Benjamin Lerman8e4554d2015-04-13 23:47:21 +0200539 ":mojo_shell",
Craig Stout677be222015-08-04 15:15:18 -0700540 ":mojo_shell_manifest",
Dave Moorec9728322014-10-23 20:55:51 -0700541 ":resources",
James Robinson5e66a792015-01-21 17:02:08 -0800542 "//base:base_java",
James Robinsonc9b163e2014-12-03 13:31:32 -0800543 "//services/native_viewport:native_viewport_java",
Alhaad Gokhale08a35432015-03-10 12:41:33 -0700544 "//third_party/android_tools:google_play_services_default_resources",
Dave Moorec9728322014-10-23 20:55:51 -0700545 ]
Etienne Membrives79888662015-06-17 13:00:21 +0200546
547 if (is_official_build) {
548 deps += [ ":download_keystore" ]
549 keystore_path = keystore_path
550 keystore_name = "official"
551 keystore_password = keystore_password
552 }
James Robinson646469d2014-10-03 15:33:28 -0700553 }
Benjamin Lerman7d036f02014-12-23 10:39:19 +0100554
555 android_library("mojo_shell_tests_java") {
556 java_files =
557 [ "android/tests/src/org/chromium/mojo/shell/ShellTestBase.java" ]
558
559 deps = [
560 ":java",
561 "//base:base_java",
562 ]
563 }
James Robinson646469d2014-10-03 15:33:28 -0700564}
565
Viet-Trung Luuf09c0d92015-04-01 14:38:57 -0700566mojom("child_controller_bindings") {
James Robinson646469d2014-10-03 15:33:28 -0700567 sources = [
Viet-Trung Luuf09c0d92015-04-01 14:38:57 -0700568 "child_controller.mojom",
James Robinson646469d2014-10-03 15:33:28 -0700569 ]
Przemyslaw Pietrzkiewicza121d2c2015-01-27 18:27:02 +0100570
571 deps = [
572 "//mojo/public/interfaces/application",
573 ]
James Robinson646469d2014-10-03 15:33:28 -0700574}
575
James Robinson646469d2014-10-03 15:33:28 -0700576test("mojo_shell_tests") {
Dave Moorec9728322014-10-23 20:55:51 -0700577 sources = [
Benjamin Lerman5d429aa2015-05-07 16:21:00 +0200578 "background_application_loader_unittest.cc",
Viet-Trung Luu2cdfa552015-04-01 14:27:43 -0700579 "child_process_host_unittest.cc",
Benjamin Lerman4fc210c2014-12-18 18:18:06 +0100580 "command_line_util_unittest.cc",
Viet-Trung Luucf6436b2015-04-07 12:32:41 -0700581 "context_unittest.cc",
Viet-Trung Luu47e2e352015-03-04 16:38:18 -0800582 "in_process_native_runner_unittest.cc",
Aaron Boodman5e7f9042015-02-24 17:37:34 -0800583 "native_runner_unittest.cc",
Dave Moorec9728322014-10-23 20:55:51 -0700584 "shell_test_base.cc",
585 "shell_test_base.h",
Nick Brayf54e4652015-03-12 17:07:42 -0700586 "shell_test_base_android.cc",
Dave Moorec9728322014-10-23 20:55:51 -0700587 "shell_test_base_unittest.cc",
588 "shell_test_main.cc",
Dave Moore2a897b02015-02-10 11:44:32 -0800589 "url_resolver_unittest.cc",
Dave Moorec9728322014-10-23 20:55:51 -0700590 ]
591
James Robinson646469d2014-10-03 15:33:28 -0700592 deps = [
Viet-Trung Luu988b4be2015-05-15 13:00:15 -0700593 ":parent_lib",
James Robinson646469d2014-10-03 15:33:28 -0700594 "//base",
James Robinson94ade6b2015-08-25 13:02:06 -0700595 "//base:i18n",
Dale Sather958af742016-01-06 13:59:32 -0800596 "//base/test:test_support",
James Robinson646469d2014-10-03 15:33:28 -0700597 "//mojo/common",
598 "//mojo/edk/system",
599 "//mojo/environment:chromium",
James Robinson94ade6b2015-08-25 13:02:06 -0700600 "//mojo/message_pump",
James Robinsona600ca52014-11-21 13:13:55 -0800601 "//mojo/public/cpp/bindings",
James Robinson63b637a2014-12-03 14:46:39 -0800602 "//services/test_service:bindings",
Przemysław Pietrzkiewicz6384d092015-01-15 16:03:17 -0800603 "//shell/application_manager",
James Robinson94ade6b2015-08-25 13:02:06 -0700604 "//testing/gtest",
605 "//url",
James Robinson646469d2014-10-03 15:33:28 -0700606 ]
607
Viet-Trung Luue0a4a182015-04-07 16:28:01 -0700608 data_deps = [
609 ":mojo_shell_child",
James Robinson63b637a2014-12-03 14:46:39 -0800610 "//services/test_service:test_app",
611 "//services/test_service:test_request_tracker_app",
James Robinson646469d2014-10-03 15:33:28 -0700612 ]
613
James Robinson646469d2014-10-03 15:33:28 -0700614 if (is_android) {
Benjamin Lerman2cb62372015-01-22 13:25:11 +0100615 deps += [ ":jni_headers" ]
616
617 apk_deps = [
James Robinson5e66a792015-01-21 17:02:08 -0800618 ":copy_mojo_shell_test_assets",
619 ":mojo_shell_tests_java",
James Robinson646469d2014-10-03 15:33:28 -0700620 ]
James Robinson5e66a792015-01-21 17:02:08 -0800621
Benjamin Lerman2cb62372015-01-22 13:25:11 +0100622 apk_asset_location = mojo_shell_test_assets_dir
James Robinson646469d2014-10-03 15:33:28 -0700623 }
624}
625
Craig Stout677be222015-08-04 15:15:18 -0700626# Shared library propagation will happen up to executable, shared library,
627# or complete static library boundaries.
628# Workaround from brettw to prevent gn from linking pingable app into the
629# apptests executable.
630static_library("pingable_app_dummy") {
631 complete_static_lib = true
632 testonly = true
633 public_deps = [
634 "//shell/test:pingable_app($default_toolchain)",
635 ]
James Robinson04362ac2015-09-18 18:24:02 -0700636 sources = [
637 "pingable_app_dummy_empty.cc",
638 ]
Craig Stout677be222015-08-04 15:15:18 -0700639}
640
Benjamin Lermandc3d1932015-03-09 11:17:39 +0100641embed_file("embed_pingable") {
642 source = "$root_build_dir/pingable_app.mojo"
Viet-Trung Luubd07e3a2015-04-09 12:43:29 -0700643 namespace = "shell::test"
Benjamin Lermandc3d1932015-03-09 11:17:39 +0100644 variable = "kPingable"
645 testonly = true
Benjamin Lermandc3d1932015-03-09 11:17:39 +0100646 deps = [
Craig Stout677be222015-08-04 15:15:18 -0700647 ":pingable_app_dummy",
Benjamin Lermandc3d1932015-03-09 11:17:39 +0100648 ]
649}
650
Aaron Boodmanb34bcbf2015-03-02 10:05:31 -0800651mojo_native_application("apptests") {
652 output_name = "shell_apptests"
653
654 testonly = true
655
656 sources = [
657 "shell_apptest.cc",
658 ]
659
660 deps = [
Dale Sather958af742016-01-06 13:59:32 -0800661 ":embed_pingable",
Aaron Boodmanb34bcbf2015-03-02 10:05:31 -0800662 "//base",
663 "//mojo/application",
664 "//mojo/application:test_support",
James Robinsonc4d0fb22016-01-28 14:31:21 -0800665 "//mojo/converters/base",
James Robinson94ade6b2015-08-25 13:02:06 -0700666 "//mojo/data_pipe_utils",
Aaron Boodmanb34bcbf2015-03-02 10:05:31 -0800667 "//mojo/public/cpp/bindings:callback",
668 "//mojo/public/cpp/environment",
669 "//mojo/public/cpp/system:system",
Viet-Trung Luu199850d2015-11-16 15:20:58 -0800670 "//mojo/public/interfaces/application",
Viet-Trung Luu84765c42015-10-10 01:07:51 -0700671 "//mojo/services/http_server/cpp",
672 "//mojo/services/http_server/interfaces",
Viet-Trung Luufe25adb2016-04-28 10:33:45 -0700673 "//mojo/services/http_server/interfaces:interfaces_sync",
Viet-Trung Luu2e11a3f2015-10-13 13:20:30 -0700674 "//mojo/services/network/interfaces",
Aaron Boodmanb34bcbf2015-03-02 10:05:31 -0800675 "//shell/test:bindings",
676 ]
677
Benjamin Lerman7a6f76b2015-11-02 15:24:04 +0100678 data_deps = [
679 "//services/http_server:http_server($default_toolchain)",
680 ]
Aaron Boodmanb34bcbf2015-03-02 10:05:31 -0800681}
Andrew Wilson7d0e7952015-06-29 11:21:09 -0700682
683mojo_native_application("shell_nfc_apptests") {
684 output_name = "shell_nfc_apptests"
685
686 testonly = true
687
688 sources = [
689 "android/nfc_apptest.cc",
690 ]
691
692 deps = [
693 "//base",
694 "//mojo/application",
695 "//mojo/application:test_support",
696 "//mojo/common:common",
697 "//mojo/public/cpp/bindings:callback",
698 "//mojo/public/cpp/environment",
699 "//mojo/public/cpp/system:system",
Viet-Trung Luu0f4f3ba2015-10-10 01:08:40 -0700700 "//mojo/services/nfc/interfaces",
Andrew Wilson7d0e7952015-06-29 11:21:09 -0700701 "//shell/test:bindings",
702 ]
703}
Benjamin Lermanf961e5e2015-07-16 11:43:38 +0200704
705copy("copy_symbols") {
706 testonly = true
707
708 deps = [
709 ":mojo_shell",
Craig Stout677be222015-08-04 15:15:18 -0700710 ":mojo_shell_child",
Benjamin Lermanf961e5e2015-07-16 11:43:38 +0200711 ]
712 if (is_android) {
713 deps += [ ":bootstrap" ]
714 }
715
716 sources = [
717 "${root_out_dir}/mojo_shell_child",
718 ]
719 if (is_android) {
720 sources += [
721 "${root_out_dir}/libbootstrap.so",
722 "${root_out_dir}/libmojo_shell.so",
723 ]
724 } else {
725 sources += [ "${root_out_dir}/mojo_shell" ]
726 }
727
728 outputs = [
729 "${root_out_dir}/symbols/{{source_file_part}}",
730 ]
731}