Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / chrome / android / BUILD.gn
bloba8fd756acb9196a2e20533e27e973bfcf9d6d71b
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")
11 import("channel.gni")
13 # GYP: //chrome/chrome.gyp:chrome_java (resources part)
14 android_resources("chrome_java_resources") {
15   resource_dirs = [ "java/res" ]
16   deps = [
17     ":chrome_strings_grd",
18     "//content/public/android:content_java_resources",
19     "//chrome/app:java_strings_grd",
20     "//third_party/android_tools:android_support_v7_appcompat_resources",
21   ]
22   custom_package = "org.chromium.chrome"
25 # GYP: //chrome/chrome.gyp:chrome_strings_grd
26 java_strings_grd("chrome_strings_grd") {
27   grd_file = "java/strings/android_chrome_strings.grd"
28   outputs = [
29     "values-am/android_chrome_strings.xml",
30     "values-ar/android_chrome_strings.xml",
31     "values-bg/android_chrome_strings.xml",
32     "values-ca/android_chrome_strings.xml",
33     "values-cs/android_chrome_strings.xml",
34     "values-da/android_chrome_strings.xml",
35     "values-de/android_chrome_strings.xml",
36     "values-el/android_chrome_strings.xml",
37     "values/android_chrome_strings.xml",
38     "values-en-rGB/android_chrome_strings.xml",
39     "values-es/android_chrome_strings.xml",
40     "values-es-rUS/android_chrome_strings.xml",
41     "values-fa/android_chrome_strings.xml",
42     "values-fi/android_chrome_strings.xml",
43     "values-tl/android_chrome_strings.xml",
44     "values-fr/android_chrome_strings.xml",
45     "values-hi/android_chrome_strings.xml",
46     "values-hr/android_chrome_strings.xml",
47     "values-hu/android_chrome_strings.xml",
48     "values-in/android_chrome_strings.xml",
49     "values-it/android_chrome_strings.xml",
50     "values-iw/android_chrome_strings.xml",
51     "values-ja/android_chrome_strings.xml",
52     "values-ko/android_chrome_strings.xml",
53     "values-lt/android_chrome_strings.xml",
54     "values-lv/android_chrome_strings.xml",
55     "values-nl/android_chrome_strings.xml",
56     "values-nb/android_chrome_strings.xml",
57     "values-pl/android_chrome_strings.xml",
58     "values-pt-rBR/android_chrome_strings.xml",
59     "values-pt-rPT/android_chrome_strings.xml",
60     "values-ro/android_chrome_strings.xml",
61     "values-ru/android_chrome_strings.xml",
62     "values-sk/android_chrome_strings.xml",
63     "values-sl/android_chrome_strings.xml",
64     "values-sr/android_chrome_strings.xml",
65     "values-sv/android_chrome_strings.xml",
66     "values-sw/android_chrome_strings.xml",
67     "values-th/android_chrome_strings.xml",
68     "values-tr/android_chrome_strings.xml",
69     "values-uk/android_chrome_strings.xml",
70     "values-vi/android_chrome_strings.xml",
71     "values-zh-rCN/android_chrome_strings.xml",
72     "values-zh-rTW/android_chrome_strings.xml",
73   ]
76 # GYP: //chrome/chrome.gyp:chrome_java
77 android_library("chrome_java") {
78   deps = [
79     ":chrome_java_resources",
80     ":document_tab_model_info_proto_java",
81     "//base:base_java",
82     "//net/android:net_java",
83     "//components/bookmarks/common/android:bookmarks_java",
84     "//components/dom_distiller/android:dom_distiller_core_java",
85     "//components/gcm_driver/android:gcm_driver_java",
86     "//components/invalidation:java",
87     "//components/navigation_interception/android:navigation_interception_java",
88     "//components/variations/android:variations_java",
89     "//components/web_contents_delegate_android:web_contents_delegate_android_java",
90     "//content/public/android:content_java",
91     "//printing:printing_java",
92     "//sync/android:sync_java",
93     "//third_party/android_protobuf:protobuf_nano_javalib",
94     "//third_party/android_tools:android_support_v13_java",
95     "//third_party/android_tools:android_support_v7_appcompat_java",
96     "//third_party/cacheinvalidation:cacheinvalidation_javalib",
97     "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
98     "//third_party/jsr-305:jsr_305_javalib",
99     "//third_party/libaddressinput:android_addressinput_widget_java",
100     "//third_party/libaddressinput:android_addressinput_widget_resources",
101     "//ui/android:ui_java",
102     "//ui/android:ui_java_resources",
103   ]
105   srcjar_deps = [
106     ":app_banner_metrics_ids_javagen",
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   ]
115   DEPRECATED_java_in_dir = "java/src"
118 # GYP: //chrome/chrome_browser.gypi:activity_type_ids_java
119 # GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java
120 # GYP: //chrome/chrome_browser.gypi:profile_sync_service_model_type_selection_java
121 # GYP: //chrome/chrome_browser.gypi:tab_load_status_java
122 # GYP: //chrome/chrome_browser.gypi:toolbar_model_security_levels_java
123 java_cpp_enum("chrome_android_java_enums_srcjar") {
124   sources = [
125     "//chrome/browser/android/activity_type_ids.h",
126     "//chrome/browser/android/tab_android.h",
127     "//chrome/browser/profiles/profile_metrics.h",
128     "//chrome/browser/sync/profile_sync_service_android.cc",
129     "//chrome/browser/ui/toolbar/toolbar_model.h",
130   ]
131   outputs = [
132     "org/chromium/chrome/browser/ActivityTypeIds.java",
133     "org/chromium/chrome/browser/TabLoadStatus.java",
134     "org/chromium/chrome/browser/profiles/ProfileAccountManagementMetrics.java",
135     "org/chromium/chrome/browser/sync/ModelTypeSelection.java",
136     "org/chromium/chrome/browser/ui/toolbar/ToolbarModelSecurityLevel.java",
137   ]
140 # GYP: //chrome/chrome_browser.gypi:app_banner_metrics_ids_java
141 java_cpp_template("app_banner_metrics_ids_javagen") {
142   sources = [
143     "java/AppBannerMetricsIds.template",
144   ]
145   package_name = "org/chromium/chrome/browser/banners"
146   inputs = [
147     "../browser/android/banners/app_banner_metrics_id_list.h",
148   ]
151 # GYP: //chrome/chrome_browser.gypi:document_tab_model_info_proto_java
152 proto_java_library("document_tab_model_info_proto_java") {
153   proto_path = "java/src/org/chromium/chrome/browser/tabmodel/document"
154   sources = [
155     "$proto_path/document_tab_model_info.proto",
156   ]
159 # GYP: //chrome/chrome_browser.gypi:resource_id_java
160 java_cpp_template("resource_id_javagen") {
161   sources = [
162     "java/ResourceId.template",
163   ]
164   package_name = "org/chromium/chrome/browser"
165   inputs = [
166     "../browser/android/resource_id.h",
167   ]
170 # GYP: //chrome/chrome_shell.gypi:libchromeshell_base
171 group("chrome_shell_base") {
172   deps = [
173     "//chrome/browser/ui",
174     "//chrome:chrome_android_core",
175     "//base",
176     "//base/allocator",
177     "//content/public/app:browser",
178     "//skia",
179   ]
180   # TODO(GYP):
181   #[ 'order_profiling!=0', {
182   #'dependencies': [ '../tools/cygprofile/cygprofile.gyp:cygprofile', ],
183   #}],
186 # GYP: //chrome/chrome_shell.gypi:libchromeshell
187 shared_library("chrome_shell") {
188   testonly = true
189   sources = [
190     # This file must always be included in the shared_library step to ensure
191     # JNI_OnLoad is exported.
192     "//chrome/app/android/chrome_jni_onload.cc",
193     "shell/chrome_main_delegate_chrome_shell_android.cc",
194     "shell/chrome_main_delegate_chrome_shell_android.h",
195   ]
196   deps = [
197     ":chrome_shell_base",
198   ]
200   # GYP: via base/files/protect_file_posix.gypi
201   # TODO(pasko): Remove this non-trivial linker wrapping as soon as
202   # crbug.com/424562 is fixed.
203   if (!is_component_build) {
204     ldflags = [ "-Wl,--wrap=close" ]
205     deps += [ "//base:protect_file_posix" ]
206   }
209 # GYP: //chrome/chrome_shell.gypi:libchromesyncshell
210 shared_library("chrome_sync_shell") {
211   testonly = true
212   sources = [
213     # This file must always be included in the shared_library step to ensure
214     # JNI_OnLoad is exported.
215     #"//chrome/app/android/chrome_jni_onload.cc",
216     #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc",
217     #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.h",
218   ]
219   deps = [
220     "//sync:test_support_sync_fake_server_android",
221   ]
222   datadeps = [
223     ":chrome_shell_base",
224   ]
227 # GYP: N/A
228 android_resources("chrome_shell_resources") {
229   deps = [
230     ":chrome_java_resources",
231   ]
232   testonly = true
233   resource_dirs = [ "shell/res" ]
234   custom_package = "org.chromium.chrome.shell"
237 # GYP: N/A
238 android_library("chrome_shell_java") {
239   testonly = true
240   deps = [
241     ":chrome_shell_resources",
242     ":chrome_java",
243     "//base:base_java",
244     "//content/public/android:content_java",
245     "//components/dom_distiller/android:dom_distiller_core_java",
246     "//components/web_contents_delegate_android:web_contents_delegate_android_java",
247     "//printing:printing_java",
248     "//net/android:net_java",
249     "//sync/android:sync_java",
250     "//third_party/android_tools:android_support_v13_java",
251     "//third_party/android_tools:android_support_v7_appcompat_java",
252     "//ui/android:ui_java",
253   ]
254   DEPRECATED_java_in_dir = "shell/java/src"
257 chrome_shell_assets_dir = "$root_build_dir/chrome_shell/assets"
259 # GYP: N/A
260 copy_ex("chrome_shell_assets") {
261   clear_dir = true
262   dest = chrome_shell_assets_dir
263   sources = [
264     "$root_build_dir/resources.pak",
265     "$root_build_dir/chrome_100_percent.pak",
266     "$root_build_dir/locales/am.pak",
267     "$root_build_dir/locales/ar.pak",
268     "$root_build_dir/locales/bg.pak",
269     "$root_build_dir/locales/ca.pak",
270     "$root_build_dir/locales/cs.pak",
271     "$root_build_dir/locales/da.pak",
272     "$root_build_dir/locales/de.pak",
273     "$root_build_dir/locales/el.pak",
274     "$root_build_dir/locales/en-GB.pak",
275     "$root_build_dir/locales/en-US.pak",
276     "$root_build_dir/locales/es.pak",
277     "$root_build_dir/locales/es-419.pak",
278     "$root_build_dir/locales/fa.pak",
279     "$root_build_dir/locales/fi.pak",
280     "$root_build_dir/locales/fil.pak",
281     "$root_build_dir/locales/fr.pak",
282     "$root_build_dir/locales/he.pak",
283     "$root_build_dir/locales/hi.pak",
284     "$root_build_dir/locales/hr.pak",
285     "$root_build_dir/locales/hu.pak",
286     "$root_build_dir/locales/id.pak",
287     "$root_build_dir/locales/it.pak",
288     "$root_build_dir/locales/ja.pak",
289     "$root_build_dir/locales/ko.pak",
290     "$root_build_dir/locales/lt.pak",
291     "$root_build_dir/locales/lv.pak",
292     "$root_build_dir/locales/nb.pak",
293     "$root_build_dir/locales/nl.pak",
294     "$root_build_dir/locales/pl.pak",
295     "$root_build_dir/locales/pt-BR.pak",
296     "$root_build_dir/locales/pt-PT.pak",
297     "$root_build_dir/locales/ro.pak",
298     "$root_build_dir/locales/ru.pak",
299     "$root_build_dir/locales/sk.pak",
300     "$root_build_dir/locales/sl.pak",
301     "$root_build_dir/locales/sr.pak",
302     "$root_build_dir/locales/sv.pak",
303     "$root_build_dir/locales/sw.pak",
304     "$root_build_dir/locales/th.pak",
305     "$root_build_dir/locales/tr.pak",
306     "$root_build_dir/locales/uk.pak",
307     "$root_build_dir/locales/vi.pak",
308     "$root_build_dir/locales/zh-CN.pak",
309     "$root_build_dir/locales/zh-TW.pak",
310   ]
311   deps = [
312     "//chrome:packed_resources",
313     "//chrome:packed_extra_resources",
314   ]
316   if (icu_use_data_file) {
317     sources += [ "$root_build_dir/icudtl.dat" ]
318   }
319   if (v8_use_external_startup_data) {
320     sources += [
321       "$root_build_dir/natives_blob.bin",
322       "$root_build_dir/snapshot_blob.bin",
323     ]
324   }
327 chrome_shell_manifest =
328     "$target_gen_dir/chrome_shell_manifest/AndroidManifest.xml"
330 # GYP: //chrome/chrome_shell.gypi:chrome_shell_manifest
331 jinja_template("chrome_shell_manifest") {
332   testonly = true
333   input = "shell/java/AndroidManifest.xml.jinja2"
334   output = chrome_shell_manifest
337 # GYP: //chrome/chrome_shell.gypi:chrome_shell_apk
338 android_apk("chrome_shell_apk") {
339   testonly = true
340   deps = [
341     "//base:base_java",
342     ":chrome_shell_resources",
343     ":chrome_shell_java",
344     ":chrome_shell_assets",
345     ":chrome_shell",
346   ]
347   apk_name = "ChromeShell"
348   android_manifest = chrome_shell_manifest
349   native_libs = [ "libchrome_shell.so" ]
350   asset_location = chrome_shell_assets_dir
352   #TODO(GYP):
353   #'variables': {
354   #'conditions': [
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',
359   #}],
360   #],
361   #},
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") {
369   testonly = true
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") {
376   testonly = true
377   deps = [
378     "//base:base_java",
379     ":chrome_shell_resources",
380     ":chrome_shell_java",
381     ":chrome_shell_assets",
382     ":chrome_sync_shell",
383   ]
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") {
392   testonly = true
393   DEPRECATED_java_in_dir = "javatests/src"
394   deps = [
395     ":chrome_java",
396     ":chrome_java_resources",
397     ":chrome_shell_java",
398     ":chrome_shell_resources",
399     ":chrome_shell_test_java",
400     "//base:base_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",
417   ]
420 android_library("chrome_shell_test_java") {
421   testonly = true
422   deps = [
423     ":chrome_java",
424     ":chrome_shell_java",
425     "//base:base_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",
433   ]
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") {
439   testonly = true
440   deps = [
441     ":chrome_javatests",
442     ":chrome_shell_test_java",
443     "//sync/android:sync_javatests",
444     "//ui/android:ui_javatests",
445   ]
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") {
452   testonly = true
453   deps = [
454     ":chrome_java",
455     ":chrome_shell_java",
456     ":chrome_shell_test_java",
457     "//base:base_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   ]
468   apk_name = "ChromeSyncShellTest"
469   DEPRECATED_java_in_dir = "sync_shell/javatests/src"
470   android_manifest = "sync_shell/javatests/AndroidManifest.xml"
473 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests_java
474 android_library("uiautomator_tests_java") {
475   testonly = true
476   DEPRECATED_java_in_dir = "uiautomator_tests/src"
477   deps = [
478     "//base:base_java_test_support",
479     "//third_party/android_tools:uiautomator_java",
480   ]
483 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests
484 uiautomator_test("uiautomator_tests") {
485   testonly = true
486   deps = [
487     ":uiautomator_tests_java",
488   ]
491 # GYP: //chrome/chrome_android.gypi:chrome_version_java
492 chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java"
493 chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java"
494 process_version("chrome_version_java") {
495   source = "java/ChromeVersionConstants.java.version"
496   output = chrome_version_java_file
497   extra_args = [
498     "-e",
499     "CHANNEL=str.upper('$android_channel')",
500   ]
503 zip("chrome_version_srcjar") {
504   inputs = [
505     chrome_version_java_file,
506   ]
507   output = "$target_gen_dir/$target_name.srcjar"
508   base_dir = chrome_version_java_dir