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/android/config.gni")
6 import("//build/config/android/rules.gni")
7 import("//build/module_args/v8.gni")
8 import("//chrome/version.gni")
9 import("//testing/test.gni")
10 import("//third_party/icu/config.gni")
13 # GYP: //chrome/chrome.gyp:chrome_java (resources part)
14 android_resources("chrome_java_resources") {
15 resource_dirs = [ "java/res" ]
17 ":chrome_strings_grd",
18 "//content/public/android:content_java_resources",
19 "//chrome/app:java_strings_grd",
20 "//third_party/android_data_chart:android_data_chart_java_resources",
21 "//third_party/android_media:android_media_resources",
22 "//third_party/android_tools:android_support_v7_appcompat_resources",
24 custom_package = "org.chromium.chrome"
27 # GYP: //chrome/chrome.gyp:chrome_strings_grd
28 java_strings_grd("chrome_strings_grd") {
29 grd_file = "java/strings/android_chrome_strings.grd"
31 "values-am/android_chrome_strings.xml",
32 "values-ar/android_chrome_strings.xml",
33 "values-bg/android_chrome_strings.xml",
34 "values-ca/android_chrome_strings.xml",
35 "values-cs/android_chrome_strings.xml",
36 "values-da/android_chrome_strings.xml",
37 "values-de/android_chrome_strings.xml",
38 "values-el/android_chrome_strings.xml",
39 "values/android_chrome_strings.xml",
40 "values-en-rGB/android_chrome_strings.xml",
41 "values-es/android_chrome_strings.xml",
42 "values-es-rUS/android_chrome_strings.xml",
43 "values-fa/android_chrome_strings.xml",
44 "values-fi/android_chrome_strings.xml",
45 "values-tl/android_chrome_strings.xml",
46 "values-fr/android_chrome_strings.xml",
47 "values-hi/android_chrome_strings.xml",
48 "values-hr/android_chrome_strings.xml",
49 "values-hu/android_chrome_strings.xml",
50 "values-in/android_chrome_strings.xml",
51 "values-it/android_chrome_strings.xml",
52 "values-iw/android_chrome_strings.xml",
53 "values-ja/android_chrome_strings.xml",
54 "values-ko/android_chrome_strings.xml",
55 "values-lt/android_chrome_strings.xml",
56 "values-lv/android_chrome_strings.xml",
57 "values-nl/android_chrome_strings.xml",
58 "values-nb/android_chrome_strings.xml",
59 "values-pl/android_chrome_strings.xml",
60 "values-pt-rBR/android_chrome_strings.xml",
61 "values-pt-rPT/android_chrome_strings.xml",
62 "values-ro/android_chrome_strings.xml",
63 "values-ru/android_chrome_strings.xml",
64 "values-sk/android_chrome_strings.xml",
65 "values-sl/android_chrome_strings.xml",
66 "values-sr/android_chrome_strings.xml",
67 "values-sv/android_chrome_strings.xml",
68 "values-sw/android_chrome_strings.xml",
69 "values-th/android_chrome_strings.xml",
70 "values-tr/android_chrome_strings.xml",
71 "values-uk/android_chrome_strings.xml",
72 "values-vi/android_chrome_strings.xml",
73 "values-zh-rCN/android_chrome_strings.xml",
74 "values-zh-rTW/android_chrome_strings.xml",
78 # GYP: //chrome/chrome.gyp:chrome_java
79 android_library("chrome_java") {
81 ":chrome_java_resources",
82 ":document_tab_model_info_proto_java",
84 "//net/android:net_java",
85 "//components/bookmarks/common/android:bookmarks_java",
86 "//components/dom_distiller/android:dom_distiller_core_java",
87 "//components/gcm_driver/android:gcm_driver_java",
88 "//components/invalidation:java",
89 "//components/navigation_interception/android:navigation_interception_java",
90 "//components/service_tab_launcher:service_tab_launcher_java",
91 "//components/precache/android:precache_java",
92 "//components/variations/android:variations_java",
93 "//components/web_contents_delegate_android:web_contents_delegate_android_java",
94 "//content/public/android:content_java",
95 "//printing:printing_java",
96 "//sync/android:sync_java",
97 "//third_party/android_data_chart:android_data_chart_java",
98 "//third_party/android_media:android_media_java",
99 "//third_party/android_protobuf:protobuf_nano_javalib",
100 "//third_party/android_tools:android_gcm_java",
101 "//third_party/android_swipe_refresh:android_swipe_refresh_java",
102 "//third_party/android_tools:android_support_v13_java",
103 "//third_party/android_tools:android_support_v7_appcompat_java",
104 "//third_party/android_tools:android_support_v7_mediarouter_java",
105 "//third_party/cacheinvalidation:cacheinvalidation_javalib",
106 "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
107 "//third_party/jsr-305:jsr_305_javalib",
108 "//media/base/android:media_java",
109 "//media/midi:midi_java",
110 "//ui/android:ui_java",
111 "//ui/android:ui_java_resources",
112 google_play_services_library,
116 ":chrome_android_java_enums_srcjar",
117 ":chrome_version_srcjar",
118 ":resource_id_javagen",
119 "//chrome:page_info_connection_type_javagen",
120 "//chrome:content_setting_javagen",
121 "//chrome:content_settings_type_javagen",
122 "//components/enhanced_bookmarks:enhanced_bookmarks_launch_location_srcjar",
125 DEPRECATED_java_in_dir = "java/src"
128 # GYP: //chrome/chrome_browser.gypi:activity_type_ids_java
129 # GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java
130 # GYP: //chrome/chrome_browser.gypi:profile_sync_service_model_type_selection_java
131 # GYP: //chrome/chrome_browser.gypi:connection_security_helper_security_levels_java
132 # GYP: //chrome/chrome_browser.gypi:tab_load_status_java
133 java_cpp_enum("chrome_android_java_enums_srcjar") {
135 "//chrome/browser/android/activity_type_ids.h",
136 "//chrome/browser/android/tab_android.h",
137 "//chrome/browser/profiles/profile_metrics.h",
138 "//chrome/browser/ssl/connection_security_helper.h",
139 "//chrome/browser/sync/profile_sync_service_android.cc",
142 "org/chromium/chrome/browser/ActivityTypeIds.java",
143 "org/chromium/chrome/browser/TabLoadStatus.java",
144 "org/chromium/chrome/browser/profiles/ProfileAccountManagementMetrics.java",
145 "org/chromium/chrome/browser/ssl/ConnectionSecurityHelperSecurityLevel.java",
146 "org/chromium/chrome/browser/sync/ModelTypeSelection.java",
150 # GYP: //chrome/chrome_browser.gypi:document_tab_model_info_proto_java
151 proto_java_library("document_tab_model_info_proto_java") {
152 proto_path = "java/src/org/chromium/chrome/browser/tabmodel/document"
154 "$proto_path/document_tab_model_info.proto",
158 # GYP: //chrome/chrome_browser.gypi:resource_id_java
159 java_cpp_template("resource_id_javagen") {
161 "java/ResourceId.template",
163 package_name = "org/chromium/chrome/browser"
165 "../browser/android/resource_id.h",
169 # GYP: //chrome/chrome_shell.gypi:libchromeshell_base
170 group("chrome_shell_base") {
172 "//chrome/browser/ui",
173 "//chrome:chrome_android_core",
176 "//content/public/app:both",
180 #[ 'order_profiling!=0', {
181 #'dependencies': [ '../tools/cygprofile/cygprofile.gyp:cygprofile', ],
185 # GYP: //chrome/chrome_shell.gypi:libchromeshell
186 shared_library("chrome_shell") {
189 "shell/chrome_main_delegate_chrome_shell_android.cc",
190 "shell/chrome_main_delegate_chrome_shell_android.h",
191 "shell/chrome_shell_entry_point.cc",
194 ":chrome_shell_base",
198 # GYP: //chrome/chrome_shell.gypi:libchromesyncshell
199 shared_library("chrome_sync_shell") {
202 #"shell/chrome_shell_entry_point.cc",
203 #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc",
204 #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.h",
207 "//sync:test_support_sync_fake_server_android",
210 ":chrome_shell_base",
215 android_resources("chrome_shell_resources") {
217 ":chrome_java_resources",
220 resource_dirs = [ "shell/res" ]
221 custom_package = "org.chromium.chrome.shell"
225 android_library("chrome_shell_java") {
228 ":chrome_shell_resources",
231 "//content/public/android:content_java",
232 "//components/dom_distiller/android:dom_distiller_content_java",
233 "//components/dom_distiller/android:dom_distiller_core_java",
234 "//components/service_tab_launcher:service_tab_launcher_java",
235 "//components/web_contents_delegate_android:web_contents_delegate_android_java",
236 "//printing:printing_java",
237 "//net/android:net_java",
238 "//sync/android:sync_java",
239 "//third_party/android_tools:android_support_v13_java",
240 "//third_party/android_tools:android_support_v7_appcompat_java",
241 "//ui/android:ui_java",
243 DEPRECATED_java_in_dir = "shell/java/src"
246 chrome_shell_assets_dir = "$root_build_dir/chrome_shell/assets"
249 copy_ex("chrome_shell_assets") {
251 dest = chrome_shell_assets_dir
253 "$root_build_dir/chrome_100_percent.pak",
254 "$root_build_dir/locales/am.pak",
255 "$root_build_dir/locales/ar.pak",
256 "$root_build_dir/locales/bg.pak",
257 "$root_build_dir/locales/ca.pak",
258 "$root_build_dir/locales/cs.pak",
259 "$root_build_dir/locales/da.pak",
260 "$root_build_dir/locales/de.pak",
261 "$root_build_dir/locales/el.pak",
262 "$root_build_dir/locales/en-GB.pak",
263 "$root_build_dir/locales/en-US.pak",
264 "$root_build_dir/locales/es-419.pak",
265 "$root_build_dir/locales/es.pak",
266 "$root_build_dir/locales/fa.pak",
267 "$root_build_dir/locales/fi.pak",
268 "$root_build_dir/locales/fil.pak",
269 "$root_build_dir/locales/fr.pak",
270 "$root_build_dir/locales/he.pak",
271 "$root_build_dir/locales/hi.pak",
272 "$root_build_dir/locales/hr.pak",
273 "$root_build_dir/locales/hu.pak",
274 "$root_build_dir/locales/id.pak",
275 "$root_build_dir/locales/it.pak",
276 "$root_build_dir/locales/ja.pak",
277 "$root_build_dir/locales/ko.pak",
278 "$root_build_dir/locales/lt.pak",
279 "$root_build_dir/locales/lv.pak",
280 "$root_build_dir/locales/nb.pak",
281 "$root_build_dir/locales/nl.pak",
282 "$root_build_dir/locales/pl.pak",
283 "$root_build_dir/locales/pt-BR.pak",
284 "$root_build_dir/locales/pt-PT.pak",
285 "$root_build_dir/locales/ro.pak",
286 "$root_build_dir/locales/ru.pak",
287 "$root_build_dir/locales/sk.pak",
288 "$root_build_dir/locales/sl.pak",
289 "$root_build_dir/locales/sr.pak",
290 "$root_build_dir/locales/sv.pak",
291 "$root_build_dir/locales/sw.pak",
292 "$root_build_dir/locales/th.pak",
293 "$root_build_dir/locales/tr.pak",
294 "$root_build_dir/locales/uk.pak",
295 "$root_build_dir/locales/vi.pak",
296 "$root_build_dir/locales/zh-CN.pak",
297 "$root_build_dir/locales/zh-TW.pak",
298 "$root_build_dir/resources.pak",
301 "//chrome:packed_resources",
302 "//chrome:packed_extra_resources",
305 if (icu_use_data_file) {
306 sources += [ "$root_build_dir/icudtl.dat" ]
308 if (v8_use_external_startup_data) {
310 "$root_build_dir/natives_blob.bin",
311 "$root_build_dir/snapshot_blob.bin",
316 chrome_shell_manifest =
317 "$target_gen_dir/chrome_shell_manifest/AndroidManifest.xml"
319 # GYP: //chrome/chrome_shell.gypi:chrome_shell_manifest
320 jinja_template("chrome_shell_manifest") {
322 input = "shell/java/AndroidManifest.xml.jinja2"
323 output = chrome_shell_manifest
326 # TODO(cjhopman): This should actually be done as a build step instead of at gn
328 _version_py_path = "//build/util/version.py"
329 _chrome_version_path = "//chrome/VERSION"
330 _version_full = exec_script(_version_py_path,
333 rebase_path(_chrome_version_path, root_build_dir),
334 "-t \"@MAJOR@.@MINOR@.@BUILD@.@PATCH@\"",
337 [ _chrome_version_path ])
339 # GYP: //chrome/chrome_shell.gypi:chrome_shell_apk
340 android_apk("chrome_shell_apk") {
344 ":chrome_shell_resources",
345 ":chrome_shell_java",
346 ":chrome_shell_assets",
349 apk_name = "ChromeShell"
350 android_manifest = chrome_shell_manifest
351 native_libs = [ "libchrome_shell.so" ]
352 native_lib_version_name = _version_full
353 asset_location = chrome_shell_assets_dir
358 #['component != "shared_library" and target_arch != "arm64" and target_arch != "x64" and profiling_full_stack_frames != 1', {
359 ## Only enable the chromium linker on regular builds, since the
360 ## component build crashes on Android 4.4. See b/11379966
361 #'use_chromium_linker': '1',
367 chrome_sync_shell_manifest =
368 "$target_gen_dir/chrome_sync_shell_manifest/AndroidManifest.xml"
370 # GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_manifest
371 jinja_template("chrome_sync_shell_manifest") {
373 input = "sync_shell/java/AndroidManifest.xml.jinja2"
374 output = chrome_sync_shell_manifest
377 # GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_apk
378 android_apk("chrome_sync_shell_apk") {
382 ":chrome_shell_resources",
383 ":chrome_shell_java",
384 ":chrome_shell_assets",
385 ":chrome_sync_shell",
387 apk_name = "ChromeSyncShell"
388 android_manifest = chrome_sync_shell_manifest
389 native_libs = [ "libchrome_sync_shell.so" ]
390 asset_location = chrome_shell_assets_dir
393 # GYP: part of //chrome/chrome_tests.gypi:chrome_shell_test_apk
394 android_library("chrome_javatests") {
396 DEPRECATED_java_in_dir = "javatests_shell/src"
399 ":chrome_java_resources",
400 ":chrome_shell_java",
401 ":chrome_shell_resources",
402 ":chrome_shell_test_java",
404 "//base:base_java_test_support",
405 "//chrome/test/android:chrome_java_test_support",
406 "//components/bookmarks/common/android:bookmarks_java",
407 "//components/dom_distiller/android:dom_distiller_core_java",
408 "//components/invalidation:java",
409 "//components/invalidation:javatests",
410 "//components/navigation_interception/android:navigation_interception_java",
411 "//components/precache/android:precache_java",
412 "//components/precache/android:precache_javatests",
413 "//content/public/android:content_java",
414 "//content/public/test/android:content_java_test_support",
415 "//printing:printing_java",
416 "//sync/android:sync_java",
417 "//sync/android:sync_javatests",
418 "//sync:sync_java_test_support",
419 "//third_party/android_protobuf:protobuf_nano_javalib",
420 "//third_party/android_tools:android_support_v13_java",
421 "//third_party/android_tools:android_support_v7_appcompat_java",
422 "//third_party/cacheinvalidation:cacheinvalidation_javalib",
423 "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
424 "//third_party/jsr-305:jsr_305_javalib",
425 "//ui/android:ui_java",
429 android_library("chrome_shell_test_java") {
433 ":chrome_shell_java",
435 "//base:base_java_test_support",
436 "//chrome/test/android:chrome_java_test_support",
437 "//content/public/android:content_java",
438 "//content/public/test/android:content_java_test_support",
439 "//third_party/android_tools:android_support_v13_java",
440 "//third_party/android_tools:android_support_v7_appcompat_java",
441 "//ui/android:ui_java",
443 DEPRECATED_java_in_dir = "shell/javatests/src"
446 # GYP: //chrome/chrome_tests.gypi:chrome_shell_test_apk
447 android_apk("chrome_shell_test_apk") {
449 apk_under_test = ":chrome_shell_apk"
452 ":chrome_shell_test_java",
453 "//sync/android:sync_javatests",
454 "//testing/android/broker:broker_java",
455 "//ui/android:ui_javatests",
458 "//testing/android/driver:driver_apk",
460 apk_name = "ChromeShellTest"
461 android_manifest = "shell/javatests/AndroidManifest.xml"
464 # GYP: //chrome/chrome_tests.gypi:chrome_junit_tests
465 junit_binary("chrome_junit_tests") {
467 "junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java",
468 "junit/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteControllerTest.java",
469 "junit/src/org/chromium/chrome/browser/media/remote/MediaUrlResolverTest.java",
470 "junit/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfoTest.java",
471 "junit/src/org/chromium/chrome/browser/media/remote/TransportControlTest.java",
476 "//base:base_java_test_support",
477 "//third_party/junit:hamcrest",
478 "//third_party/android_tools:android_support_v7_mediarouter_java",
482 # GYP: //chrome/chrome_tests.gypi:chrome_sync_shell_test_apk
484 # TODO(GYP): We need sync/sync_tests.gypi:test_support_sync_proto_java to be ported.
486 android_apk("chrome_sync_shell_test_apk") {
487 apk_under_test = ":chrome_sync_shell_apk"
491 ":chrome_shell_java",
492 ":chrome_shell_test_java",
494 "//base:base_java_test_support",
495 "//chrome/test/android:chrome_java_test_support",
496 "//components/invalidation:java",
497 "//content/public/android:content_java",
498 "//content/public/test/android:content_java_test_support",
499 "//sync/android:sync_java",
500 "//sync:sync_java_test_support",
501 "//third_party/android_tools:android_support_v13_java",
502 "//third_party/android_tools:android_support_v7_appcompat_java",
503 "//ui/android:ui_java",
505 apk_name = "ChromeSyncShellTest"
506 DEPRECATED_java_in_dir = "sync_shell/javatests/src"
507 android_manifest = "sync_shell/javatests/AndroidManifest.xml"
511 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests_java
512 android_library("uiautomator_tests_java") {
514 DEPRECATED_java_in_dir = "uiautomator_tests/src"
516 "//base:base_java_test_support",
517 "//third_party/android_tools:uiautomator_java",
521 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests
522 uiautomator_test("uiautomator_tests") {
525 ":uiautomator_tests_java",
529 # GYP: //chrome/chrome_android.gypi:chrome_version_java
530 chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java"
531 chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java"
532 process_version("chrome_version_java") {
533 template_file = "java/ChromeVersionConstants.java.version"
534 output = chrome_version_java_file
537 "CHANNEL=str.upper('$android_channel')",
541 zip("chrome_version_srcjar") {
543 chrome_version_java_file,
545 output = "$target_gen_dir/$target_name.srcjar"
546 base_dir = chrome_version_java_dir