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