Clear wallet data when sync is disabled.
[chromium-blink-merge.git] / chrome / android / BUILD.gn
blobf56bfd05c2f907f59026aad42e6025426cbe6ebd
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_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",
23   ]
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"
30   outputs = [
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",
75   ]
78 # GYP: //chrome/chrome.gyp:chrome_java
79 android_library("chrome_java") {
80   deps = [
81     ":chrome_java_resources",
82     ":document_tab_model_info_proto_java",
83     "//base:base_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,
109   ]
111   srcjar_deps = [
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",
119   ]
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") {
130   sources = [
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",
136   ]
137   outputs = [
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",
143   ]
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"
149   sources = [
150     "$proto_path/document_tab_model_info.proto",
151   ]
154 # GYP: //chrome/chrome_browser.gypi:resource_id_java
155 java_cpp_template("resource_id_javagen") {
156   sources = [
157     "java/ResourceId.template",
158   ]
159   package_name = "org/chromium/chrome/browser"
160   inputs = [
161     "../browser/android/resource_id.h",
162   ]
165 # GYP: //chrome/chrome_shell.gypi:libchromeshell_base
166 group("chrome_shell_base") {
167   deps = [
168     "//chrome/browser/ui",
169     "//chrome:chrome_android_core",
170     "//base",
171     "//base/allocator",
172     "//content/public/app:both",
173     "//skia",
174   ]
175   # TODO(GYP):
176   #[ 'order_profiling!=0', {
177   #'dependencies': [ '../tools/cygprofile/cygprofile.gyp:cygprofile', ],
178   #}],
181 # GYP: //chrome/chrome_shell.gypi:libchromeshell
182 shared_library("chrome_shell") {
183   testonly = true
184   sources = [
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",
188   ]
189   deps = [
190     ":chrome_shell_base",
191   ]
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" ]
199   }
202 # GYP: //chrome/chrome_shell.gypi:libchromesyncshell
203 shared_library("chrome_sync_shell") {
204   testonly = true
205   sources = [
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",
209   ]
210   deps = [
211     "//sync:test_support_sync_fake_server_android",
212   ]
213   datadeps = [
214     ":chrome_shell_base",
215   ]
218 # GYP: N/A
219 android_resources("chrome_shell_resources") {
220   deps = [
221     ":chrome_java_resources",
222   ]
223   testonly = true
224   resource_dirs = [ "shell/res" ]
225   custom_package = "org.chromium.chrome.shell"
228 # GYP: N/A
229 android_library("chrome_shell_java") {
230   testonly = true
231   deps = [
232     ":chrome_shell_resources",
233     ":chrome_java",
234     "//base:base_java",
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",
244   ]
245   DEPRECATED_java_in_dir = "shell/java/src"
248 chrome_shell_assets_dir = "$root_build_dir/chrome_shell/assets"
250 # GYP: N/A
251 copy_ex("chrome_shell_assets") {
252   clear_dir = true
253   dest = chrome_shell_assets_dir
254   sources = [
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",
301   ]
302   deps = [
303     "//chrome:packed_resources",
304     "//chrome:packed_extra_resources",
305   ]
307   if (icu_use_data_file) {
308     sources += [ "$root_build_dir/icudtl.dat" ]
309   }
310   if (v8_use_external_startup_data) {
311     sources += [
312       "$root_build_dir/natives_blob.bin",
313       "$root_build_dir/snapshot_blob.bin",
314     ]
315   }
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") {
323   testonly = true
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
329 # time.
330 _version_py_path = "//build/util/version.py"
331 _chrome_version_path = "//chrome/VERSION"
332 _version_full = exec_script(_version_py_path,
333                             [
334                               "-f",
335                               rebase_path(_chrome_version_path, root_build_dir),
336                               "-t \"@MAJOR@.@MINOR@.@BUILD@.@PATCH@\"",
337                             ],
338                             "value",
339                             [ _chrome_version_path ])
341 # GYP: //chrome/chrome_shell.gypi:chrome_shell_apk
342 android_apk("chrome_shell_apk") {
343   testonly = true
344   deps = [
345     "//base:base_java",
346     ":chrome_shell_resources",
347     ":chrome_shell_java",
348     ":chrome_shell_assets",
349     ":chrome_shell",
350   ]
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
357   #TODO(GYP):
358   #'variables': {
359   #'conditions': [
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',
364   #}],
365   #],
366   #},
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") {
374   testonly = true
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") {
381   testonly = true
382   deps = [
383     "//base:base_java",
384     ":chrome_shell_resources",
385     ":chrome_shell_java",
386     ":chrome_shell_assets",
387     ":chrome_sync_shell",
388   ]
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") {
397   testonly = true
398   DEPRECATED_java_in_dir = "javatests/src"
399   deps = [
400     ":chrome_java",
401     ":chrome_java_resources",
402     ":chrome_shell_java",
403     ":chrome_shell_resources",
404     ":chrome_shell_test_java",
405     "//base:base_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",
422   ]
425 android_library("chrome_shell_test_java") {
426   testonly = true
427   deps = [
428     ":chrome_java",
429     ":chrome_shell_java",
430     "//base:base_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",
438   ]
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") {
444   testonly = true
445   deps = [
446     ":chrome_javatests",
447     ":chrome_shell_test_java",
448     "//sync/android:sync_javatests",
449     "//ui/android:ui_javatests",
450   ]
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") {
457   testonly = true
458   java_files = [ "android/junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java" ]
459   main_class = "org.chromium.testing.local.JunitTestMain"
460   deps = [
461     ":chrome_java",
462     "//base:base_java",
463     "//base:base_java_test_support",
464     "//testing/android/junit:junit_test_support",
465   ]
468 # GYP: //chrome/chrome_tests.gypi:chrome_sync_shell_test_apk
469 android_apk("chrome_sync_shell_test_apk") {
470   testonly = true
471   deps = [
472     ":chrome_java",
473     ":chrome_shell_java",
474     ":chrome_shell_test_java",
475     "//base:base_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",
486   ]
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") {
494   testonly = true
495   DEPRECATED_java_in_dir = "uiautomator_tests/src"
496   deps = [
497     "//base:base_java_test_support",
498     "//third_party/android_tools:uiautomator_java",
499   ]
502 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests
503 uiautomator_test("uiautomator_tests") {
504   testonly = true
505   deps = [
506     ":uiautomator_tests_java",
507   ]
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
516   extra_args = [
517     "-e",
518     "CHANNEL=str.upper('$android_channel')",
519   ]
522 zip("chrome_version_srcjar") {
523   inputs = [
524     chrome_version_java_file,
525   ]
526   output = "$target_gen_dir/$target_name.srcjar"
527   base_dir = chrome_version_java_dir