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/precache/android:precache_java",
91 "//components/variations/android:variations_java",
92 "//components/web_contents_delegate_android:web_contents_delegate_android_java",
93 "//content/public/android:content_java",
94 "//printing:printing_java",
95 "//sync/android:sync_java",
96 "//third_party/android_data_chart:android_data_chart_java",
97 "//third_party/android_media:android_media_java",
98 "//third_party/android_protobuf:protobuf_nano_javalib",
99 "//third_party/android_tools:android_support_v13_java",
100 "//third_party/android_tools:android_support_v7_appcompat_java",
101 "//third_party/android_tools:android_support_v7_mediarouter_java",
102 "//third_party/cacheinvalidation:cacheinvalidation_javalib",
103 "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
104 "//third_party/jsr-305:jsr_305_javalib",
105 "//media/base/android:media_java",
106 "//ui/android:ui_java",
107 "//ui/android:ui_java_resources",
108 google_play_services_library,
112 ":chrome_android_java_enums_srcjar",
113 ":chrome_version_srcjar",
114 ":resource_id_javagen",
115 "//chrome:page_info_connection_type_javagen",
116 "//chrome:content_setting_javagen",
117 "//chrome:content_settings_type_javagen",
118 "//components/enhanced_bookmarks:enhanced_bookmarks_launch_location_srcjar",
121 DEPRECATED_java_in_dir = "java/src"
124 # GYP: //chrome/chrome_browser.gypi:activity_type_ids_java
125 # GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java
126 # GYP: //chrome/chrome_browser.gypi:profile_sync_service_model_type_selection_java
127 # GYP: //chrome/chrome_browser.gypi:tab_load_status_java
128 # GYP: //chrome/chrome_browser.gypi:toolbar_model_security_levels_java
129 java_cpp_enum("chrome_android_java_enums_srcjar") {
131 "//chrome/browser/android/activity_type_ids.h",
132 "//chrome/browser/android/tab_android.h",
133 "//chrome/browser/profiles/profile_metrics.h",
134 "//chrome/browser/sync/profile_sync_service_android.cc",
135 "//chrome/browser/ui/toolbar/toolbar_model.h",
138 "org/chromium/chrome/browser/ActivityTypeIds.java",
139 "org/chromium/chrome/browser/TabLoadStatus.java",
140 "org/chromium/chrome/browser/profiles/ProfileAccountManagementMetrics.java",
141 "org/chromium/chrome/browser/sync/ModelTypeSelection.java",
142 "org/chromium/chrome/browser/ui/toolbar/ToolbarModelSecurityLevel.java",
146 # GYP: //chrome/chrome_browser.gypi:document_tab_model_info_proto_java
147 proto_java_library("document_tab_model_info_proto_java") {
148 proto_path = "java/src/org/chromium/chrome/browser/tabmodel/document"
150 "$proto_path/document_tab_model_info.proto",
154 # GYP: //chrome/chrome_browser.gypi:resource_id_java
155 java_cpp_template("resource_id_javagen") {
157 "java/ResourceId.template",
159 package_name = "org/chromium/chrome/browser"
161 "../browser/android/resource_id.h",
165 # GYP: //chrome/chrome_shell.gypi:libchromeshell_base
166 group("chrome_shell_base") {
168 "//chrome/browser/ui",
169 "//chrome:chrome_android_core",
172 "//content/public/app:both",
176 #[ 'order_profiling!=0', {
177 #'dependencies': [ '../tools/cygprofile/cygprofile.gyp:cygprofile', ],
181 # GYP: //chrome/chrome_shell.gypi:libchromeshell
182 shared_library("chrome_shell") {
185 "shell/chrome_main_delegate_chrome_shell_android.cc",
186 "shell/chrome_main_delegate_chrome_shell_android.h",
187 "shell/chrome_shell_entry_point.cc",
190 ":chrome_shell_base",
193 # GYP: via base/files/protect_file_posix.gypi
194 # TODO(pasko): Remove this non-trivial linker wrapping as soon as
195 # crbug.com/424562 is fixed.
196 if (!is_component_build) {
197 ldflags = [ "-Wl,--wrap=close" ]
198 deps += [ "//base:protect_file_posix" ]
202 # GYP: //chrome/chrome_shell.gypi:libchromesyncshell
203 shared_library("chrome_sync_shell") {
206 #"shell/chrome_shell_entry_point.cc",
207 #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc",
208 #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.h",
211 "//sync:test_support_sync_fake_server_android",
214 ":chrome_shell_base",
219 android_resources("chrome_shell_resources") {
221 ":chrome_java_resources",
224 resource_dirs = [ "shell/res" ]
225 custom_package = "org.chromium.chrome.shell"
229 android_library("chrome_shell_java") {
232 ":chrome_shell_resources",
235 "//content/public/android:content_java",
236 "//components/dom_distiller/android:dom_distiller_core_java",
237 "//components/web_contents_delegate_android:web_contents_delegate_android_java",
238 "//printing:printing_java",
239 "//net/android:net_java",
240 "//sync/android:sync_java",
241 "//third_party/android_tools:android_support_v13_java",
242 "//third_party/android_tools:android_support_v7_appcompat_java",
243 "//ui/android:ui_java",
245 DEPRECATED_java_in_dir = "shell/java/src"
248 chrome_shell_assets_dir = "$root_build_dir/chrome_shell/assets"
251 copy_ex("chrome_shell_assets") {
253 dest = chrome_shell_assets_dir
255 "$root_build_dir/chrome_100_percent.pak",
256 "$root_build_dir/locales/am.pak",
257 "$root_build_dir/locales/ar.pak",
258 "$root_build_dir/locales/bg.pak",
259 "$root_build_dir/locales/ca.pak",
260 "$root_build_dir/locales/cs.pak",
261 "$root_build_dir/locales/da.pak",
262 "$root_build_dir/locales/de.pak",
263 "$root_build_dir/locales/el.pak",
264 "$root_build_dir/locales/en-GB.pak",
265 "$root_build_dir/locales/en-US.pak",
266 "$root_build_dir/locales/es-419.pak",
267 "$root_build_dir/locales/es.pak",
268 "$root_build_dir/locales/fa.pak",
269 "$root_build_dir/locales/fi.pak",
270 "$root_build_dir/locales/fil.pak",
271 "$root_build_dir/locales/fr.pak",
272 "$root_build_dir/locales/he.pak",
273 "$root_build_dir/locales/hi.pak",
274 "$root_build_dir/locales/hr.pak",
275 "$root_build_dir/locales/hu.pak",
276 "$root_build_dir/locales/id.pak",
277 "$root_build_dir/locales/it.pak",
278 "$root_build_dir/locales/ja.pak",
279 "$root_build_dir/locales/ko.pak",
280 "$root_build_dir/locales/lt.pak",
281 "$root_build_dir/locales/lv.pak",
282 "$root_build_dir/locales/nb.pak",
283 "$root_build_dir/locales/nl.pak",
284 "$root_build_dir/locales/pl.pak",
285 "$root_build_dir/locales/pt-BR.pak",
286 "$root_build_dir/locales/pt-PT.pak",
287 "$root_build_dir/locales/ro.pak",
288 "$root_build_dir/locales/ru.pak",
289 "$root_build_dir/locales/sk.pak",
290 "$root_build_dir/locales/sl.pak",
291 "$root_build_dir/locales/sr.pak",
292 "$root_build_dir/locales/sv.pak",
293 "$root_build_dir/locales/sw.pak",
294 "$root_build_dir/locales/th.pak",
295 "$root_build_dir/locales/tr.pak",
296 "$root_build_dir/locales/uk.pak",
297 "$root_build_dir/locales/vi.pak",
298 "$root_build_dir/locales/zh-CN.pak",
299 "$root_build_dir/locales/zh-TW.pak",
300 "$root_build_dir/resources.pak",
303 "//chrome:packed_resources",
304 "//chrome:packed_extra_resources",
307 if (icu_use_data_file) {
308 sources += [ "$root_build_dir/icudtl.dat" ]
310 if (v8_use_external_startup_data) {
312 "$root_build_dir/natives_blob.bin",
313 "$root_build_dir/snapshot_blob.bin",
318 chrome_shell_manifest =
319 "$target_gen_dir/chrome_shell_manifest/AndroidManifest.xml"
321 # GYP: //chrome/chrome_shell.gypi:chrome_shell_manifest
322 jinja_template("chrome_shell_manifest") {
324 input = "shell/java/AndroidManifest.xml.jinja2"
325 output = chrome_shell_manifest
328 # TODO(cjhopman): This should actually be done as a build step instead of at gn
330 _version_py_path = "//build/util/version.py"
331 _chrome_version_path = "//chrome/VERSION"
332 _version_full = exec_script(_version_py_path,
335 rebase_path(_chrome_version_path, root_build_dir),
336 "-t \"@MAJOR@.@MINOR@.@BUILD@.@PATCH@\"",
339 [ _chrome_version_path ])
341 # GYP: //chrome/chrome_shell.gypi:chrome_shell_apk
342 android_apk("chrome_shell_apk") {
346 ":chrome_shell_resources",
347 ":chrome_shell_java",
348 ":chrome_shell_assets",
351 apk_name = "ChromeShell"
352 android_manifest = chrome_shell_manifest
353 native_libs = [ "libchrome_shell.so" ]
354 native_lib_version_name = _version_full
355 asset_location = chrome_shell_assets_dir
360 #['component != "shared_library" and target_arch != "arm64" and target_arch != "x64" and profiling_full_stack_frames != 1', {
361 ## Only enable the chromium linker on regular builds, since the
362 ## component build crashes on Android 4.4. See b/11379966
363 #'use_chromium_linker': '1',
369 chrome_sync_shell_manifest =
370 "$target_gen_dir/chrome_sync_shell_manifest/AndroidManifest.xml"
372 # GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_manifest
373 jinja_template("chrome_sync_shell_manifest") {
375 input = "sync_shell/java/AndroidManifest.xml.jinja2"
376 output = chrome_sync_shell_manifest
379 # GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_apk
380 android_apk("chrome_sync_shell_apk") {
384 ":chrome_shell_resources",
385 ":chrome_shell_java",
386 ":chrome_shell_assets",
387 ":chrome_sync_shell",
389 apk_name = "ChromeSyncShell"
390 android_manifest = chrome_sync_shell_manifest
391 native_libs = [ "libchrome_sync_shell.so" ]
392 asset_location = chrome_shell_assets_dir
395 # GYP: part of //chrome/chrome_tests.gypi:chrome_shell_test_apk
396 android_library("chrome_javatests") {
398 DEPRECATED_java_in_dir = "javatests/src"
401 ":chrome_java_resources",
402 ":chrome_shell_java",
403 ":chrome_shell_resources",
404 ":chrome_shell_test_java",
406 "//base:base_java_test_support",
407 "//chrome/test/android:chrome_java_test_support",
408 "//components/bookmarks/common/android:bookmarks_java",
409 "//components/dom_distiller/android:dom_distiller_core_java",
410 "//components/invalidation:java",
411 "//content/public/android:content_java",
412 "//content/public/test/android:content_java_test_support",
413 "//printing:printing_java",
414 "//sync/android:sync_java",
415 "//sync:sync_java_test_support",
416 "//third_party/android_tools:android_support_v13_java",
417 "//third_party/android_tools:android_support_v7_appcompat_java",
418 "//third_party/cacheinvalidation:cacheinvalidation_javalib",
419 "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
420 "//third_party/jsr-305:jsr_305_javalib",
421 "//ui/android:ui_java",
425 android_library("chrome_shell_test_java") {
429 ":chrome_shell_java",
431 "//base:base_java_test_support",
432 "//chrome/test/android:chrome_java_test_support",
433 "//content/public/android:content_java",
434 "//content/public/test/android:content_java_test_support",
435 "//third_party/android_tools:android_support_v13_java",
436 "//third_party/android_tools:android_support_v7_appcompat_java",
437 "//ui/android:ui_java",
439 DEPRECATED_java_in_dir = "shell/javatests/src"
442 # GYP: //chrome/chrome_tests.gypi:chrome_shell_test_apk
443 android_apk("chrome_shell_test_apk") {
447 ":chrome_shell_test_java",
448 "//sync/android:sync_javatests",
449 "//ui/android:ui_javatests",
451 apk_name = "ChromeShellTest"
452 android_manifest = "shell/javatests/AndroidManifest.xml"
455 # GYP: //chrome/chrome_tests.gypi:chrome_junit_tests
456 java_binary("chrome_junit_tests") {
458 java_files = [ "android/junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java" ]
459 main_class = "org.chromium.testing.local.JunitTestMain"
463 "//base:base_java_test_support",
464 "//testing/android/junit:junit_test_support",
468 # GYP: //chrome/chrome_tests.gypi:chrome_sync_shell_test_apk
469 android_apk("chrome_sync_shell_test_apk") {
473 ":chrome_shell_java",
474 ":chrome_shell_test_java",
476 "//base:base_java_test_support",
477 "//chrome/test/android:chrome_java_test_support",
478 "//components/invalidation:java",
479 "//content/public/android:content_java",
480 "//content/public/test/android:content_java_test_support",
481 "//sync/android:sync_java",
482 "//sync:sync_java_test_support",
483 "//third_party/android_tools:android_support_v13_java",
484 "//third_party/android_tools:android_support_v7_appcompat_java",
485 "//ui/android:ui_java",
487 apk_name = "ChromeSyncShellTest"
488 DEPRECATED_java_in_dir = "sync_shell/javatests/src"
489 android_manifest = "sync_shell/javatests/AndroidManifest.xml"
492 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests_java
493 android_library("uiautomator_tests_java") {
495 DEPRECATED_java_in_dir = "uiautomator_tests/src"
497 "//base:base_java_test_support",
498 "//third_party/android_tools:uiautomator_java",
502 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests
503 uiautomator_test("uiautomator_tests") {
506 ":uiautomator_tests_java",
510 # GYP: //chrome/chrome_android.gypi:chrome_version_java
511 chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java"
512 chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java"
513 process_version("chrome_version_java") {
514 template_file = "java/ChromeVersionConstants.java.version"
515 output = chrome_version_java_file
518 "CHANNEL=str.upper('$android_channel')",
522 zip("chrome_version_srcjar") {
524 chrome_version_java_file,
526 output = "$target_gen_dir/$target_name.srcjar"
527 base_dir = chrome_version_java_dir