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_tools:android_support_v7_appcompat_resources",
23 custom_package = "org.chromium.chrome"
26 # GYP: //chrome/chrome.gyp:chrome_strings_grd
27 java_strings_grd("chrome_strings_grd") {
28 grd_file = "java/strings/android_chrome_strings.grd"
30 "values-am/android_chrome_strings.xml",
31 "values-ar/android_chrome_strings.xml",
32 "values-bg/android_chrome_strings.xml",
33 "values-ca/android_chrome_strings.xml",
34 "values-cs/android_chrome_strings.xml",
35 "values-da/android_chrome_strings.xml",
36 "values-de/android_chrome_strings.xml",
37 "values-el/android_chrome_strings.xml",
38 "values/android_chrome_strings.xml",
39 "values-en-rGB/android_chrome_strings.xml",
40 "values-es/android_chrome_strings.xml",
41 "values-es-rUS/android_chrome_strings.xml",
42 "values-fa/android_chrome_strings.xml",
43 "values-fi/android_chrome_strings.xml",
44 "values-tl/android_chrome_strings.xml",
45 "values-fr/android_chrome_strings.xml",
46 "values-hi/android_chrome_strings.xml",
47 "values-hr/android_chrome_strings.xml",
48 "values-hu/android_chrome_strings.xml",
49 "values-in/android_chrome_strings.xml",
50 "values-it/android_chrome_strings.xml",
51 "values-iw/android_chrome_strings.xml",
52 "values-ja/android_chrome_strings.xml",
53 "values-ko/android_chrome_strings.xml",
54 "values-lt/android_chrome_strings.xml",
55 "values-lv/android_chrome_strings.xml",
56 "values-nl/android_chrome_strings.xml",
57 "values-nb/android_chrome_strings.xml",
58 "values-pl/android_chrome_strings.xml",
59 "values-pt-rBR/android_chrome_strings.xml",
60 "values-pt-rPT/android_chrome_strings.xml",
61 "values-ro/android_chrome_strings.xml",
62 "values-ru/android_chrome_strings.xml",
63 "values-sk/android_chrome_strings.xml",
64 "values-sl/android_chrome_strings.xml",
65 "values-sr/android_chrome_strings.xml",
66 "values-sv/android_chrome_strings.xml",
67 "values-sw/android_chrome_strings.xml",
68 "values-th/android_chrome_strings.xml",
69 "values-tr/android_chrome_strings.xml",
70 "values-uk/android_chrome_strings.xml",
71 "values-vi/android_chrome_strings.xml",
72 "values-zh-rCN/android_chrome_strings.xml",
73 "values-zh-rTW/android_chrome_strings.xml",
77 # GYP: //chrome/chrome.gyp:chrome_java
78 android_library("chrome_java") {
80 ":chrome_java_resources",
81 ":document_tab_model_info_proto_java",
83 "//net/android:net_java",
84 "//components/bookmarks/common/android:bookmarks_java",
85 "//components/dom_distiller/android:dom_distiller_core_java",
86 "//components/gcm_driver/android:gcm_driver_java",
87 "//components/invalidation:java",
88 "//components/navigation_interception/android:navigation_interception_java",
89 "//components/variations/android:variations_java",
90 "//components/web_contents_delegate_android:web_contents_delegate_android_java",
91 "//content/public/android:content_java",
92 "//printing:printing_java",
93 "//sync/android:sync_java",
94 "//third_party/android_data_chart:android_data_chart_java",
95 "//third_party/android_protobuf:protobuf_nano_javalib",
96 "//third_party/android_tools:android_support_v13_java",
97 "//third_party/android_tools:android_support_v7_appcompat_java",
98 "//third_party/cacheinvalidation:cacheinvalidation_javalib",
99 "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
100 "//third_party/jsr-305:jsr_305_javalib",
101 "//ui/android:ui_java",
102 "//ui/android:ui_java_resources",
103 google_play_services_library,
107 ":chrome_android_java_enums_srcjar",
108 ":chrome_version_srcjar",
109 ":resource_id_javagen",
110 "//chrome:page_info_connection_type_javagen",
111 "//chrome:content_setting_javagen",
112 "//chrome:content_settings_type_javagen",
113 "//components/enhanced_bookmarks:enhanced_bookmarks_launch_location_srcjar",
116 DEPRECATED_java_in_dir = "java/src"
119 # GYP: //chrome/chrome_browser.gypi:activity_type_ids_java
120 # GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java
121 # GYP: //chrome/chrome_browser.gypi:profile_sync_service_model_type_selection_java
122 # GYP: //chrome/chrome_browser.gypi:tab_load_status_java
123 # GYP: //chrome/chrome_browser.gypi:toolbar_model_security_levels_java
124 java_cpp_enum("chrome_android_java_enums_srcjar") {
126 "//chrome/browser/android/activity_type_ids.h",
127 "//chrome/browser/android/tab_android.h",
128 "//chrome/browser/profiles/profile_metrics.h",
129 "//chrome/browser/sync/profile_sync_service_android.cc",
130 "//chrome/browser/ui/toolbar/toolbar_model.h",
133 "org/chromium/chrome/browser/ActivityTypeIds.java",
134 "org/chromium/chrome/browser/TabLoadStatus.java",
135 "org/chromium/chrome/browser/profiles/ProfileAccountManagementMetrics.java",
136 "org/chromium/chrome/browser/sync/ModelTypeSelection.java",
137 "org/chromium/chrome/browser/ui/toolbar/ToolbarModelSecurityLevel.java",
141 # GYP: //chrome/chrome_browser.gypi:document_tab_model_info_proto_java
142 proto_java_library("document_tab_model_info_proto_java") {
143 proto_path = "java/src/org/chromium/chrome/browser/tabmodel/document"
145 "$proto_path/document_tab_model_info.proto",
149 # GYP: //chrome/chrome_browser.gypi:resource_id_java
150 java_cpp_template("resource_id_javagen") {
152 "java/ResourceId.template",
154 package_name = "org/chromium/chrome/browser"
156 "../browser/android/resource_id.h",
160 # GYP: //chrome/chrome_shell.gypi:libchromeshell_base
161 group("chrome_shell_base") {
163 "//chrome/browser/ui",
164 "//chrome:chrome_android_core",
167 "//content/public/app:both",
171 #[ 'order_profiling!=0', {
172 #'dependencies': [ '../tools/cygprofile/cygprofile.gyp:cygprofile', ],
176 # GYP: //chrome/chrome_shell.gypi:libchromeshell
177 shared_library("chrome_shell") {
180 "shell/chrome_main_delegate_chrome_shell_android.cc",
181 "shell/chrome_main_delegate_chrome_shell_android.h",
182 "shell/chrome_shell_entry_point.cc",
185 ":chrome_shell_base",
188 # GYP: via base/files/protect_file_posix.gypi
189 # TODO(pasko): Remove this non-trivial linker wrapping as soon as
190 # crbug.com/424562 is fixed.
191 if (!is_component_build) {
192 ldflags = [ "-Wl,--wrap=close" ]
193 deps += [ "//base:protect_file_posix" ]
197 # GYP: //chrome/chrome_shell.gypi:libchromesyncshell
198 shared_library("chrome_sync_shell") {
201 #"shell/chrome_shell_entry_point.cc",
202 #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc",
203 #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.h",
206 "//sync:test_support_sync_fake_server_android",
209 ":chrome_shell_base",
214 android_resources("chrome_shell_resources") {
216 ":chrome_java_resources",
219 resource_dirs = [ "shell/res" ]
220 custom_package = "org.chromium.chrome.shell"
224 android_library("chrome_shell_java") {
227 ":chrome_shell_resources",
230 "//content/public/android:content_java",
231 "//components/dom_distiller/android:dom_distiller_core_java",
232 "//components/web_contents_delegate_android:web_contents_delegate_android_java",
233 "//printing:printing_java",
234 "//net/android:net_java",
235 "//sync/android:sync_java",
236 "//third_party/android_tools:android_support_v13_java",
237 "//third_party/android_tools:android_support_v7_appcompat_java",
238 "//ui/android:ui_java",
240 DEPRECATED_java_in_dir = "shell/java/src"
243 chrome_shell_assets_dir = "$root_build_dir/chrome_shell/assets"
246 copy_ex("chrome_shell_assets") {
248 dest = chrome_shell_assets_dir
250 "$root_build_dir/chrome_100_percent.pak",
251 "$root_build_dir/locales/am.pak",
252 "$root_build_dir/locales/ar.pak",
253 "$root_build_dir/locales/bg.pak",
254 "$root_build_dir/locales/ca.pak",
255 "$root_build_dir/locales/cs.pak",
256 "$root_build_dir/locales/da.pak",
257 "$root_build_dir/locales/de.pak",
258 "$root_build_dir/locales/el.pak",
259 "$root_build_dir/locales/en-GB.pak",
260 "$root_build_dir/locales/en-US.pak",
261 "$root_build_dir/locales/es-419.pak",
262 "$root_build_dir/locales/es.pak",
263 "$root_build_dir/locales/fa.pak",
264 "$root_build_dir/locales/fi.pak",
265 "$root_build_dir/locales/fil.pak",
266 "$root_build_dir/locales/fr.pak",
267 "$root_build_dir/locales/he.pak",
268 "$root_build_dir/locales/hi.pak",
269 "$root_build_dir/locales/hr.pak",
270 "$root_build_dir/locales/hu.pak",
271 "$root_build_dir/locales/id.pak",
272 "$root_build_dir/locales/it.pak",
273 "$root_build_dir/locales/ja.pak",
274 "$root_build_dir/locales/ko.pak",
275 "$root_build_dir/locales/lt.pak",
276 "$root_build_dir/locales/lv.pak",
277 "$root_build_dir/locales/nb.pak",
278 "$root_build_dir/locales/nl.pak",
279 "$root_build_dir/locales/pl.pak",
280 "$root_build_dir/locales/pt-BR.pak",
281 "$root_build_dir/locales/pt-PT.pak",
282 "$root_build_dir/locales/ro.pak",
283 "$root_build_dir/locales/ru.pak",
284 "$root_build_dir/locales/sk.pak",
285 "$root_build_dir/locales/sl.pak",
286 "$root_build_dir/locales/sr.pak",
287 "$root_build_dir/locales/sv.pak",
288 "$root_build_dir/locales/sw.pak",
289 "$root_build_dir/locales/th.pak",
290 "$root_build_dir/locales/tr.pak",
291 "$root_build_dir/locales/uk.pak",
292 "$root_build_dir/locales/vi.pak",
293 "$root_build_dir/locales/zh-CN.pak",
294 "$root_build_dir/locales/zh-TW.pak",
295 "$root_build_dir/resources.pak",
298 "//chrome:packed_resources",
299 "//chrome:packed_extra_resources",
302 if (icu_use_data_file) {
303 sources += [ "$root_build_dir/icudtl.dat" ]
305 if (v8_use_external_startup_data) {
307 "$root_build_dir/natives_blob.bin",
308 "$root_build_dir/snapshot_blob.bin",
313 chrome_shell_manifest =
314 "$target_gen_dir/chrome_shell_manifest/AndroidManifest.xml"
316 # GYP: //chrome/chrome_shell.gypi:chrome_shell_manifest
317 jinja_template("chrome_shell_manifest") {
319 input = "shell/java/AndroidManifest.xml.jinja2"
320 output = chrome_shell_manifest
323 # TODO(cjhopman): This should actually be done as a build step instead of at gn
325 _version_py_path = "//build/util/version.py"
326 _chrome_version_path = "//chrome/VERSION"
327 _version_full = exec_script(_version_py_path,
330 rebase_path(_chrome_version_path, root_build_dir),
331 "-t \"@MAJOR@.@MINOR@.@BUILD@.@PATCH@\"",
334 [ _chrome_version_path ])
336 # GYP: //chrome/chrome_shell.gypi:chrome_shell_apk
337 android_apk("chrome_shell_apk") {
341 ":chrome_shell_resources",
342 ":chrome_shell_java",
343 ":chrome_shell_assets",
346 apk_name = "ChromeShell"
347 android_manifest = chrome_shell_manifest
348 native_libs = [ "libchrome_shell.so" ]
349 native_lib_version_name = _version_full
350 asset_location = chrome_shell_assets_dir
355 #['component != "shared_library" and target_arch != "arm64" and target_arch != "x64" and profiling_full_stack_frames != 1', {
356 ## Only enable the chromium linker on regular builds, since the
357 ## component build crashes on Android 4.4. See b/11379966
358 #'use_chromium_linker': '1',
364 chrome_sync_shell_manifest =
365 "$target_gen_dir/chrome_sync_shell_manifest/AndroidManifest.xml"
367 # GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_manifest
368 jinja_template("chrome_sync_shell_manifest") {
370 input = "sync_shell/java/AndroidManifest.xml.jinja2"
371 output = chrome_sync_shell_manifest
374 # GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_apk
375 android_apk("chrome_sync_shell_apk") {
379 ":chrome_shell_resources",
380 ":chrome_shell_java",
381 ":chrome_shell_assets",
382 ":chrome_sync_shell",
384 apk_name = "ChromeSyncShell"
385 android_manifest = chrome_sync_shell_manifest
386 native_libs = [ "libchrome_sync_shell.so" ]
387 asset_location = chrome_shell_assets_dir
390 # GYP: part of //chrome/chrome_tests.gypi:chrome_shell_test_apk
391 android_library("chrome_javatests") {
393 DEPRECATED_java_in_dir = "javatests/src"
396 ":chrome_java_resources",
397 ":chrome_shell_java",
398 ":chrome_shell_resources",
399 ":chrome_shell_test_java",
401 "//base:base_java_test_support",
402 "//chrome/test/android:chrome_java_test_support",
403 "//components/bookmarks/common/android:bookmarks_java",
404 "//components/dom_distiller/android:dom_distiller_core_java",
405 "//components/invalidation:java",
406 "//content/public/android:content_java",
407 "//content/public/test/android:content_java_test_support",
408 "//printing:printing_java",
409 "//sync/android:sync_java",
410 "//sync:sync_java_test_support",
411 "//third_party/android_tools:android_support_v13_java",
412 "//third_party/android_tools:android_support_v7_appcompat_java",
413 "//third_party/cacheinvalidation:cacheinvalidation_javalib",
414 "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
415 "//third_party/jsr-305:jsr_305_javalib",
416 "//ui/android:ui_java",
420 android_library("chrome_shell_test_java") {
424 ":chrome_shell_java",
426 "//base:base_java_test_support",
427 "//chrome/test/android:chrome_java_test_support",
428 "//content/public/android:content_java",
429 "//content/public/test/android:content_java_test_support",
430 "//third_party/android_tools:android_support_v13_java",
431 "//third_party/android_tools:android_support_v7_appcompat_java",
432 "//ui/android:ui_java",
434 DEPRECATED_java_in_dir = "shell/javatests/src"
437 # GYP: //chrome/chrome_tests.gypi:chrome_shell_test_apk
438 android_apk("chrome_shell_test_apk") {
442 ":chrome_shell_test_java",
443 "//sync/android:sync_javatests",
444 "//ui/android:ui_javatests",
446 apk_name = "ChromeShellTest"
447 android_manifest = "shell/javatests/AndroidManifest.xml"
450 # GYP: //chrome/chrome_tests.gypi:chrome_sync_shell_test_apk
451 android_apk("chrome_sync_shell_test_apk") {
455 ":chrome_shell_java",
456 ":chrome_shell_test_java",
458 "//base:base_java_test_support",
459 "//chrome/test/android:chrome_java_test_support",
460 "//components/invalidation:java",
461 "//content/public/android:content_java",
462 "//content/public/test/android:content_java_test_support",
463 "//sync/android:sync_java",
464 "//sync:sync_java_test_support",
465 "//third_party/android_tools:android_support_v13_java",
466 "//third_party/android_tools:android_support_v7_appcompat_java",
467 "//ui/android:ui_java",
469 apk_name = "ChromeSyncShellTest"
470 DEPRECATED_java_in_dir = "sync_shell/javatests/src"
471 android_manifest = "sync_shell/javatests/AndroidManifest.xml"
474 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests_java
475 android_library("uiautomator_tests_java") {
477 DEPRECATED_java_in_dir = "uiautomator_tests/src"
479 "//base:base_java_test_support",
480 "//third_party/android_tools:uiautomator_java",
484 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests
485 uiautomator_test("uiautomator_tests") {
488 ":uiautomator_tests_java",
492 # GYP: //chrome/chrome_android.gypi:chrome_version_java
493 chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java"
494 chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java"
495 process_version("chrome_version_java") {
496 template_file = "java/ChromeVersionConstants.java.version"
497 output = chrome_version_java_file
500 "CHANNEL=str.upper('$android_channel')",
504 zip("chrome_version_srcjar") {
506 chrome_version_java_file,
508 output = "$target_gen_dir/$target_name.srcjar"
509 base_dir = chrome_version_java_dir