OLD | NEW |
| (Empty) |
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. | |
4 | |
5 import("//build/config/ui.gni") | |
6 import("//mojo/public/mojo.gni") | |
7 import("//mojo/public/tools/bindings/mojom.gni") | |
8 | |
9 # We don't support building in the component build since mojo apps are | |
10 # inherently components. | |
11 assert(!is_component_build) | |
12 | |
13 if (is_android) { | |
14 import("//build/config/android/config.gni") | |
15 import("//build/config/android/rules.gni") | |
16 } | |
17 | |
18 if (!use_prebuilt_mojo_shell) { | |
19 executable("mojo_shell") { | |
20 sources = [ | |
21 "desktop/mojo_main.cc", | |
22 ] | |
23 | |
24 deps = [ | |
25 ":init", | |
26 ":lib", | |
27 "//base", | |
28 "//build/config/sanitizers:deps", | |
29 "//mojo/common", | |
30 "//mojo/environment:chromium", | |
31 ] | |
32 } | |
33 } # !use_prebuilt_mojo_shell | |
34 | |
35 executable("mojo_launcher") { | |
36 sources = [ | |
37 "launcher_main.cc", | |
38 ] | |
39 | |
40 deps = [ | |
41 ":external_application_registrar_bindings", | |
42 ":external_application_registrar_connection", | |
43 ":init", | |
44 ":in_process_dynamic_service_runner", | |
45 "//base", | |
46 "//build/config/sanitizers:deps", | |
47 "//mojo/common", | |
48 "//mojo/edk/system", | |
49 "//mojo/environment:chromium", | |
50 "//url", | |
51 ] | |
52 } | |
53 | |
54 source_set("init") { | |
55 sources = [ | |
56 "init.cc", | |
57 "init.h", | |
58 ] | |
59 | |
60 deps = [ | |
61 "//base", | |
62 ] | |
63 } | |
64 | |
65 source_set("in_process_dynamic_service_runner") { | |
66 sources = [ | |
67 "dynamic_service_runner.cc", | |
68 "dynamic_service_runner.h", | |
69 "in_process_dynamic_service_runner.cc", | |
70 "in_process_dynamic_service_runner.h", | |
71 ] | |
72 | |
73 deps = [ | |
74 "//base", | |
75 "//mojo/gles2", | |
76 "//mojo/public/cpp/system", | |
77 ] | |
78 | |
79 # This target has to include the public thunk headers, which generally | |
80 # shouldn't be included without picking an implementation. We are providing | |
81 # the implementation but the thunk header target cannot declare that we are | |
82 # permitted to include it since it's in the public SDK and we are not. | |
83 # Suppress include checking so we can still check the rest of the targets in | |
84 # this file. | |
85 check_includes = false | |
86 } | |
87 | |
88 source_set("lib") { | |
89 sources = [ | |
90 "app_child_process.cc", | |
91 "app_child_process.h", | |
92 "app_child_process_host.cc", | |
93 "app_child_process_host.h", | |
94 "child_process.cc", | |
95 "child_process.h", | |
96 "child_process_host.cc", | |
97 "child_process_host.h", | |
98 "context.cc", | |
99 "context.h", | |
100 "data_pipe_peek.cc", | |
101 "data_pipe_peek.h", | |
102 "dynamic_application_loader.cc", | |
103 "dynamic_application_loader.h", | |
104 "external_application_listener.h", | |
105 "external_application_listener_posix.cc", | |
106 "external_application_listener_win.cc", | |
107 "filename_util.cc", | |
108 "filename_util.h", | |
109 "incoming_connection_listener_posix.cc", | |
110 "incoming_connection_listener_posix.h", | |
111 "mojo_url_resolver.cc", | |
112 "mojo_url_resolver.h", | |
113 "out_of_process_dynamic_service_runner.cc", | |
114 "out_of_process_dynamic_service_runner.h", | |
115 "switches.cc", | |
116 "switches.h", | |
117 "task_runners.cc", | |
118 "task_runners.h", | |
119 "test_child_process.cc", | |
120 "test_child_process.h", | |
121 "ui_application_loader_android.cc", | |
122 "ui_application_loader_android.h", | |
123 ] | |
124 | |
125 deps = [ | |
126 ":app_child_process_bindings", | |
127 ":external_application_registrar_bindings", | |
128 ":init", | |
129 ":in_process_dynamic_service_runner", | |
130 "//base", | |
131 "//base/third_party/dynamic_annotations", | |
132 "//base:base_static", | |
133 "//mojo/application", | |
134 "//mojo/application_manager", | |
135 "//mojo/common", | |
136 "//mojo/common:tracing_impl", | |
137 "//mojo/edk/system", | |
138 "//mojo/public/cpp/bindings", | |
139 "//mojo/public/interfaces/application", | |
140 "//mojo/services/public/interfaces/network", | |
141 "//mojo/shell/domain_socket", | |
142 "//mojo/spy", | |
143 "//services/tracing:bindings", | |
144 "//url", | |
145 ] | |
146 | |
147 if (is_win) { | |
148 deps -= [ "//mojo/shell/domain_socket" ] | |
149 } | |
150 | |
151 if (is_android) { | |
152 sources += [ | |
153 "android/android_handler.h", | |
154 "android/android_handler.cc", | |
155 "android/android_handler_loader.h", | |
156 "android/android_handler_loader.cc", | |
157 "network_application_loader.cc", | |
158 "network_application_loader.h", | |
159 ] | |
160 | |
161 deps += [ | |
162 ":jni_headers", | |
163 ":run_android_application_function", | |
164 "//mojo/application:content_handler", | |
165 "//mojo/services/network:lib", | |
166 "//services/gles2", | |
167 "//services/native_viewport:lib", | |
168 ] | |
169 } | |
170 | |
171 # This target includes some files behind #ifdef OS... guards. Since gn is not | |
172 # smart enough to understand preprocess includes, it does complains about | |
173 # these includes when not using the build files for that OS. Suppress checking | |
174 # so we can enable checking for the rest of the targets in this file. | |
175 # TODO: Might be better to split the files with OS-specific includes out to a | |
176 # separate source_set so we can leave checking on for the rest of the target. | |
177 check_includes = false | |
178 } | |
179 | |
180 if (is_android) { | |
181 generate_jni("jni_headers") { | |
182 sources = [ | |
183 "android/apk/src/org/chromium/mojo_shell_apk/AndroidHandler.java", | |
184 "android/apk/src/org/chromium/mojo_shell_apk/Bootstrap.java", | |
185 "android/apk/src/org/chromium/mojo_shell_apk/MojoMain.java", | |
186 ] | |
187 jni_package = "mojo" | |
188 } | |
189 | |
190 android_library("bootstrap_java") { | |
191 java_files = | |
192 [ "android/apk/src/org/chromium/mojo_shell_apk/Bootstrap.java" ] | |
193 | |
194 deps = [ | |
195 "//base:base_java", | |
196 ] | |
197 | |
198 dex_path = "$target_out_dir/bootstrap_java.dex.jar" | |
199 } | |
200 | |
201 shared_library("bootstrap") { | |
202 sources = [ | |
203 "android/bootstrap.cc", | |
204 ] | |
205 deps = [ | |
206 ":jni_headers", | |
207 ":lib", | |
208 ":run_android_application_function", | |
209 "//base", | |
210 ] | |
211 } | |
212 | |
213 # Shared header between the bootstrap and the main shell .so. | |
214 source_set("run_android_application_function") { | |
215 sources = [ | |
216 "android/run_android_application_function.h", | |
217 ] | |
218 } | |
219 | |
220 android_library("java") { | |
221 java_files = [ | |
222 "android/apk/src/org/chromium/mojo_shell_apk/AndroidHandler.java", | |
223 "android/apk/src/org/chromium/mojo_shell_apk/FileHelper.java", | |
224 "android/apk/src/org/chromium/mojo_shell_apk/MojoMain.java", | |
225 "android/apk/src/org/chromium/mojo_shell_apk/MojoShellActivity.java", | |
226 "android/apk/src/org/chromium/mojo_shell_apk/MojoShellApplication.java", | |
227 ] | |
228 | |
229 deps = [ | |
230 "//base:base_java", | |
231 "//net/android:net_java", | |
232 ] | |
233 } | |
234 | |
235 android_resources("resources") { | |
236 resource_dirs = [ "android/apk/res" ] | |
237 custom_package = "org.chromium.mojo_shell_apk" | |
238 } | |
239 | |
240 shared_library("libmojo_shell") { | |
241 sources = [ | |
242 "android/library_loader.cc", | |
243 "android/mojo_main.cc", | |
244 "android/mojo_main.h", | |
245 ] | |
246 deps = [ | |
247 ":jni_headers", | |
248 ":lib", | |
249 "//mojo/application_manager", | |
250 "//net", | |
251 "//services/native_viewport:lib", | |
252 "//ui/gl", | |
253 ] | |
254 } | |
255 | |
256 mojo_shell_assets_dir = "$root_build_dir/mojo_shell_assets" | |
257 | |
258 copy_ex("copy_mojo_shell_assets") { | |
259 clear_dir = true | |
260 dest = mojo_shell_assets_dir | |
261 sources = [ | |
262 "$root_out_dir/lib.stripped/libbootstrap.so", | |
263 "$root_out_dir/obj/mojo/shell/bootstrap_java.dex.jar", | |
264 ] | |
265 } | |
266 | |
267 android_apk("mojo_shell_apk") { | |
268 apk_name = "MojoShell" | |
269 | |
270 android_manifest = "android/apk/AndroidManifest.xml" | |
271 | |
272 native_libs = [ "libmojo_shell.so" ] | |
273 | |
274 asset_location = mojo_shell_assets_dir | |
275 | |
276 deps = [ | |
277 ":copy_mojo_shell_assets", | |
278 ":java", | |
279 ":libmojo_shell", | |
280 ":resources", | |
281 "//services/native_viewport:native_viewport_java", | |
282 ] | |
283 } | |
284 } | |
285 | |
286 mojom("app_child_process_bindings") { | |
287 sources = [ | |
288 "app_child_process.mojom", | |
289 ] | |
290 } | |
291 | |
292 mojom("external_application_registrar_bindings") { | |
293 sources = [ | |
294 "external_application_registrar.mojom", | |
295 ] | |
296 | |
297 deps = [ | |
298 "//mojo/public/interfaces/application", | |
299 ] | |
300 } | |
301 | |
302 source_set("external_application_registrar_connection") { | |
303 sources = [ | |
304 "external_application_registrar_connection.cc", | |
305 "external_application_registrar_connection.h", | |
306 ] | |
307 | |
308 deps = [ | |
309 ":external_application_registrar_bindings", | |
310 "//base", | |
311 "//mojo/common", | |
312 "//mojo/edk/system", | |
313 "//mojo/public/cpp/bindings", | |
314 "//mojo/public/interfaces/application", | |
315 "//mojo/shell/domain_socket", | |
316 "//url", | |
317 ] | |
318 | |
319 if (is_win) { | |
320 deps -= [ "//mojo/shell/domain_socket" ] | |
321 } | |
322 } | |
323 | |
324 # GYP version: mojo/mojo.gyp:mojo_shell_tests | |
325 test("mojo_shell_tests") { | |
326 sources = [ | |
327 "child_process_host_unittest.cc", | |
328 "data_pipe_peek_unittest.cc", | |
329 "dynamic_application_loader_unittest.cc", | |
330 "in_process_dynamic_service_runner_unittest.cc", | |
331 "mojo_url_resolver_unittest.cc", | |
332 "shell_test_base.cc", | |
333 "shell_test_base.h", | |
334 "shell_test_base_unittest.cc", | |
335 "shell_test_main.cc", | |
336 ] | |
337 | |
338 deps = [ | |
339 ":in_process_dynamic_service_runner", | |
340 ":lib", | |
341 "//base", | |
342 "//base:i18n", | |
343 "//base/test:test_support", | |
344 "//testing/gtest", | |
345 "//net:test_support", | |
346 "//url", | |
347 "//mojo/application_manager", | |
348 "//mojo/common", | |
349 "//mojo/edk/system", | |
350 "//mojo/environment:chromium", | |
351 "//mojo/public/cpp/bindings", | |
352 "//services/test_service:bindings", | |
353 ] | |
354 | |
355 datadeps = [ | |
356 "//services/test_service:test_app", | |
357 "//services/test_service:test_request_tracker_app", | |
358 ] | |
359 | |
360 if (is_android) { | |
361 deps += [ | |
362 # TODO(GYP): | |
363 #'../testing/android/native_test.gyp:native_test_native_code', | |
364 ] | |
365 } | |
366 } | |
367 | |
368 # GYP version: mojo/mojo.gyp:mojo_shell_test_support | |
369 source_set("test_support") { | |
370 sources = [ | |
371 "shell_test_helper.cc", | |
372 "shell_test_helper.h", | |
373 ] | |
374 | |
375 deps = [ | |
376 ":init", | |
377 ":lib", | |
378 "//base", | |
379 "//mojo/application_manager", | |
380 "//mojo/edk/system", | |
381 ] | |
382 } | |
383 | |
384 test("external_application_unittests") { | |
385 sources = [ | |
386 "incoming_connection_listener_unittest.cc", | |
387 "external_application_listener_unittest.cc", | |
388 "external_application_test_main.cc", | |
389 ] | |
390 | |
391 deps = [ | |
392 ":lib", | |
393 ":external_application_registrar_connection", | |
394 ":external_application_registrar_bindings", | |
395 "//base", | |
396 "//base/test:test_support", | |
397 "//testing/gtest", | |
398 "//url", | |
399 "//mojo/application", | |
400 "//mojo/application_manager", | |
401 "//mojo/common", | |
402 "//mojo/edk/system", | |
403 "//mojo/environment:chromium", | |
404 "//mojo/shell/domain_socket", | |
405 "//mojo/shell/domain_socket:tests", | |
406 ] | |
407 | |
408 if (is_win) { | |
409 sources -= [ | |
410 "incoming_connection_listener_unittest.cc", | |
411 "external_application_listener_unittest.cc", | |
412 ] | |
413 | |
414 deps -= [ | |
415 ":lib", | |
416 ":external_application_registrar_connection", | |
417 ":external_application_registrar_bindings", | |
418 "//mojo/shell/domain_socket", | |
419 "//mojo/shell/domain_socket:tests", | |
420 ] | |
421 } | |
422 } | |
OLD | NEW |