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/variations/android:variations_java",
91 "//components/web_contents_delegate_android:web_contents_delegate_android_java",
92 "//content/public/android:content_java",
93 "//printing:printing_java",
94 "//sync/android:sync_java",
95 "//third_party/android_data_chart:android_data_chart_java",
96 "//third_party/android_media:android_media_java",
97 "//third_party/android_protobuf:protobuf_nano_javalib",
98 "//third_party/android_tools:android_support_v13_java",
99 "//third_party/android_tools:android_support_v7_appcompat_java",
100 "//third_party/android_tools:android_support_v7_mediarouter_java",
101 "//third_party/cacheinvalidation:cacheinvalidation_javalib",
102 "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
103 "//third_party/jsr-305:jsr_305_javalib",
104 "//media/base/android:media_java",
105 "//ui/android:ui_java",
106 "//ui/android:ui_java_resources",
107 google_play_services_library,
111 ":chrome_android_java_enums_srcjar",
112 ":chrome_version_srcjar",
113 ":resource_id_javagen",
114 "//chrome:page_info_connection_type_javagen",
115 "//chrome:content_setting_javagen",
116 "//chrome:content_settings_type_javagen",
117 "//components/enhanced_bookmarks:enhanced_bookmarks_launch_location_srcjar",
120 DEPRECATED_java_in_dir = "java/src"
123 # GYP: //chrome/chrome_browser.gypi:activity_type_ids_java
124 # GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java
125 # GYP: //chrome/chrome_browser.gypi:profile_sync_service_model_type_selection_java
126 # GYP: //chrome/chrome_browser.gypi:tab_load_status_java
127 # GYP: //chrome/chrome_browser.gypi:toolbar_model_security_levels_java
128 java_cpp_enum("chrome_android_java_enums_srcjar") {
130 "//chrome/browser/android/activity_type_ids.h",
131 "//chrome/browser/android/tab_android.h",
132 "//chrome/browser/profiles/profile_metrics.h",
133 "//chrome/browser/sync/profile_sync_service_android.cc",
134 "//chrome/browser/ui/toolbar/toolbar_model.h",
137 "org/chromium/chrome/browser/ActivityTypeIds.java",
138 "org/chromium/chrome/browser/TabLoadStatus.java",
139 "org/chromium/chrome/browser/profiles/ProfileAccountManagementMetrics.java",
140 "org/chromium/chrome/browser/sync/ModelTypeSelection.java",
141 "org/chromium/chrome/browser/ui/toolbar/ToolbarModelSecurityLevel.java",
145 # GYP: //chrome/chrome_browser.gypi:document_tab_model_info_proto_java
146 proto_java_library("document_tab_model_info_proto_java") {
147 proto_path = "java/src/org/chromium/chrome/browser/tabmodel/document"
149 "$proto_path/document_tab_model_info.proto",
153 # GYP: //chrome/chrome_browser.gypi:resource_id_java
154 java_cpp_template("resource_id_javagen") {
156 "java/ResourceId.template",
158 package_name = "org/chromium/chrome/browser"
160 "../browser/android/resource_id.h",
164 # GYP: //chrome/chrome_shell.gypi:libchromeshell_base
165 group("chrome_shell_base") {
167 "//chrome/browser/ui",
168 "//chrome:chrome_android_core",
171 "//content/public/app:both",
175 #[ 'order_profiling!=0', {
176 #'dependencies': [ '../tools/cygprofile/cygprofile.gyp:cygprofile', ],
180 # GYP: //chrome/chrome_shell.gypi:libchromeshell
181 shared_library("chrome_shell") {
184 "shell/chrome_main_delegate_chrome_shell_android.cc",
185 "shell/chrome_main_delegate_chrome_shell_android.h",
186 "shell/chrome_shell_entry_point.cc",
189 ":chrome_shell_base",
192 # GYP: via base/files/protect_file_posix.gypi
193 # TODO(pasko): Remove this non-trivial linker wrapping as soon as
194 # crbug.com/424562 is fixed.
195 if (!is_component_build) {
196 ldflags = [ "-Wl,--wrap=close" ]
197 deps += [ "//base:protect_file_posix" ]
201 # GYP: //chrome/chrome_shell.gypi:libchromesyncshell
202 shared_library("chrome_sync_shell") {
205 #"shell/chrome_shell_entry_point.cc",
206 #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc",
207 #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.h",
210 "//sync:test_support_sync_fake_server_android",
213 ":chrome_shell_base",
218 android_resources("chrome_shell_resources") {
220 ":chrome_java_resources",
223 resource_dirs = [ "shell/res" ]
224 custom_package = "org.chromium.chrome.shell"
228 android_library("chrome_shell_java") {
231 ":chrome_shell_resources",
234 "//content/public/android:content_java",
235 "//components/dom_distiller/android:dom_distiller_core_java",
236 "//components/web_contents_delegate_android:web_contents_delegate_android_java",
237 "//printing:printing_java",
238 "//net/android:net_java",
239 "//sync/android:sync_java",
240 "//third_party/android_tools:android_support_v13_java",
241 "//third_party/android_tools:android_support_v7_appcompat_java",
242 "//ui/android:ui_java",
244 DEPRECATED_java_in_dir = "shell/java/src"
247 chrome_shell_assets_dir = "$root_build_dir/chrome_shell/assets"
250 copy_ex("chrome_shell_assets") {
252 dest = chrome_shell_assets_dir
254 "$root_build_dir/chrome_100_percent.pak",
255 "$root_build_dir/locales/am.pak",
256 "$root_build_dir/locales/ar.pak",
257 "$root_build_dir/locales/bg.pak",
258 "$root_build_dir/locales/ca.pak",
259 "$root_build_dir/locales/cs.pak",
260 "$root_build_dir/locales/da.pak",
261 "$root_build_dir/locales/de.pak",
262 "$root_build_dir/locales/el.pak",
263 "$root_build_dir/locales/en-GB.pak",
264 "$root_build_dir/locales/en-US.pak",
265 "$root_build_dir/locales/es-419.pak",
266 "$root_build_dir/locales/es.pak",
267 "$root_build_dir/locales/fa.pak",
268 "$root_build_dir/locales/fi.pak",
269 "$root_build_dir/locales/fil.pak",
270 "$root_build_dir/locales/fr.pak",
271 "$root_build_dir/locales/he.pak",
272 "$root_build_dir/locales/hi.pak",
273 "$root_build_dir/locales/hr.pak",
274 "$root_build_dir/locales/hu.pak",
275 "$root_build_dir/locales/id.pak",
276 "$root_build_dir/locales/it.pak",
277 "$root_build_dir/locales/ja.pak",
278 "$root_build_dir/locales/ko.pak",
279 "$root_build_dir/locales/lt.pak",
280 "$root_build_dir/locales/lv.pak",
281 "$root_build_dir/locales/nb.pak",
282 "$root_build_dir/locales/nl.pak",
283 "$root_build_dir/locales/pl.pak",
284 "$root_build_dir/locales/pt-BR.pak",
285 "$root_build_dir/locales/pt-PT.pak",
286 "$root_build_dir/locales/ro.pak",
287 "$root_build_dir/locales/ru.pak",
288 "$root_build_dir/locales/sk.pak",
289 "$root_build_dir/locales/sl.pak",
290 "$root_build_dir/locales/sr.pak",
291 "$root_build_dir/locales/sv.pak",
292 "$root_build_dir/locales/sw.pak",
293 "$root_build_dir/locales/th.pak",
294 "$root_build_dir/locales/tr.pak",
295 "$root_build_dir/locales/uk.pak",
296 "$root_build_dir/locales/vi.pak",
297 "$root_build_dir/locales/zh-CN.pak",
298 "$root_build_dir/locales/zh-TW.pak",
299 "$root_build_dir/resources.pak",
302 "//chrome:packed_resources",
303 "//chrome:packed_extra_resources",
306 if (icu_use_data_file) {
307 sources += [ "$root_build_dir/icudtl.dat" ]
309 if (v8_use_external_startup_data) {
311 "$root_build_dir/natives_blob.bin",
312 "$root_build_dir/snapshot_blob.bin",
317 chrome_shell_manifest =
318 "$target_gen_dir/chrome_shell_manifest/AndroidManifest.xml"
320 # GYP: //chrome/chrome_shell.gypi:chrome_shell_manifest
321 jinja_template("chrome_shell_manifest") {
323 input = "shell/java/AndroidManifest.xml.jinja2"
324 output = chrome_shell_manifest
327 # TODO(cjhopman): This should actually be done as a build step instead of at gn
329 _version_py_path = "//build/util/version.py"
330 _chrome_version_path = "//chrome/VERSION"
331 _version_full = exec_script(_version_py_path,
334 rebase_path(_chrome_version_path, root_build_dir),
335 "-t \"@MAJOR@.@MINOR@.@BUILD@.@PATCH@\"",
338 [ _chrome_version_path ])
340 # GYP: //chrome/chrome_shell.gypi:chrome_shell_apk
341 android_apk("chrome_shell_apk") {
345 ":chrome_shell_resources",
346 ":chrome_shell_java",
347 ":chrome_shell_assets",
350 apk_name = "ChromeShell"
351 android_manifest = chrome_shell_manifest
352 native_libs = [ "libchrome_shell.so" ]
353 native_lib_version_name = _version_full
354 asset_location = chrome_shell_assets_dir
359 #['component != "shared_library" and target_arch != "arm64" and target_arch != "x64" and profiling_full_stack_frames != 1', {
360 ## Only enable the chromium linker on regular builds, since the
361 ## component build crashes on Android 4.4. See b/11379966
362 #'use_chromium_linker': '1',
368 chrome_sync_shell_manifest =
369 "$target_gen_dir/chrome_sync_shell_manifest/AndroidManifest.xml"
371 # GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_manifest
372 jinja_template("chrome_sync_shell_manifest") {
374 input = "sync_shell/java/AndroidManifest.xml.jinja2"
375 output = chrome_sync_shell_manifest
378 # GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_apk
379 android_apk("chrome_sync_shell_apk") {
383 ":chrome_shell_resources",
384 ":chrome_shell_java",
385 ":chrome_shell_assets",
386 ":chrome_sync_shell",
388 apk_name = "ChromeSyncShell"
389 android_manifest = chrome_sync_shell_manifest
390 native_libs = [ "libchrome_sync_shell.so" ]
391 asset_location = chrome_shell_assets_dir
394 # GYP: part of //chrome/chrome_tests.gypi:chrome_shell_test_apk
395 android_library("chrome_javatests") {
397 DEPRECATED_java_in_dir = "javatests/src"
400 ":chrome_java_resources",
401 ":chrome_shell_java",
402 ":chrome_shell_resources",
403 ":chrome_shell_test_java",
405 "//base:base_java_test_support",
406 "//chrome/test/android:chrome_java_test_support",
407 "//components/bookmarks/common/android:bookmarks_java",
408 "//components/dom_distiller/android:dom_distiller_core_java",
409 "//components/invalidation:java",
410 "//content/public/android:content_java",
411 "//content/public/test/android:content_java_test_support",
412 "//printing:printing_java",
413 "//sync/android:sync_java",
414 "//sync:sync_java_test_support",
415 "//third_party/android_tools:android_support_v13_java",
416 "//third_party/android_tools:android_support_v7_appcompat_java",
417 "//third_party/cacheinvalidation:cacheinvalidation_javalib",
418 "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
419 "//third_party/jsr-305:jsr_305_javalib",
420 "//ui/android:ui_java",
424 android_library("chrome_shell_test_java") {
428 ":chrome_shell_java",
430 "//base:base_java_test_support",
431 "//chrome/test/android:chrome_java_test_support",
432 "//content/public/android:content_java",
433 "//content/public/test/android:content_java_test_support",
434 "//third_party/android_tools:android_support_v13_java",
435 "//third_party/android_tools:android_support_v7_appcompat_java",
436 "//ui/android:ui_java",
438 DEPRECATED_java_in_dir = "shell/javatests/src"
441 # GYP: //chrome/chrome_tests.gypi:chrome_shell_test_apk
442 android_apk("chrome_shell_test_apk") {
446 ":chrome_shell_test_java",
447 "//sync/android:sync_javatests",
448 "//ui/android:ui_javatests",
450 apk_name = "ChromeShellTest"
451 android_manifest = "shell/javatests/AndroidManifest.xml"
454 # GYP: //chrome/chrome_tests.gypi:chrome_shell_unit_tests
455 java_binary("chrome_shell_unit_tests") {
457 java_files = [ "android/junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java" ]
458 main_class = "org.chromium.testing.local.JunitTestMain"
462 "//base:base_java_test_support",
463 "//testing/android/junit:junit_test_support",
467 # GYP: //chrome/chrome_tests.gypi:chrome_sync_shell_test_apk
468 android_apk("chrome_sync_shell_test_apk") {
472 ":chrome_shell_java",
473 ":chrome_shell_test_java",
475 "//base:base_java_test_support",
476 "//chrome/test/android:chrome_java_test_support",
477 "//components/invalidation:java",
478 "//content/public/android:content_java",
479 "//content/public/test/android:content_java_test_support",
480 "//sync/android:sync_java",
481 "//sync:sync_java_test_support",
482 "//third_party/android_tools:android_support_v13_java",
483 "//third_party/android_tools:android_support_v7_appcompat_java",
484 "//ui/android:ui_java",
486 apk_name = "ChromeSyncShellTest"
487 DEPRECATED_java_in_dir = "sync_shell/javatests/src"
488 android_manifest = "sync_shell/javatests/AndroidManifest.xml"
491 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests_java
492 android_library("uiautomator_tests_java") {
494 DEPRECATED_java_in_dir = "uiautomator_tests/src"
496 "//base:base_java_test_support",
497 "//third_party/android_tools:uiautomator_java",
501 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests
502 uiautomator_test("uiautomator_tests") {
505 ":uiautomator_tests_java",
509 # GYP: //chrome/chrome_android.gypi:chrome_version_java
510 chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java"
511 chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java"
512 process_version("chrome_version_java") {
513 template_file = "java/ChromeVersionConstants.java.version"
514 output = chrome_version_java_file
517 "CHANNEL=str.upper('$android_channel')",
521 zip("chrome_version_srcjar") {
523 chrome_version_java_file,
525 output = "$target_gen_dir/$target_name.srcjar"
526 base_dir = chrome_version_java_dir