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