Roll src/third_party/WebKit 8b42d1d:744641d (svn 186770:186771)
[chromium-blink-merge.git] / chrome / android / BUILD.gn
blob331f3741b35553f330b1c92fffb99ca6ffee392d
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("//third_party/icu/config.gni")
10 import("channel.gni")
12 # GYP: //chrome/chrome.gyp:chrome_java (resources part)
13 android_resources("chrome_java_resources") {
14   resource_dirs = [ "java/res" ]
15   deps = [
16     ":chrome_strings_grd",
17     "//content/public/android:content_java_resources",
18     "//chrome/app:java_strings_grd",
19     "//third_party/android_tools:android_support_v7_appcompat_resources",
20   ]
21   custom_package = "org.chromium.chrome"
24 # GYP: //chrome/chrome.gyp:chrome_strings_grd
25 java_strings_grd("chrome_strings_grd") {
26   grd_file = "java/strings/android_chrome_strings.grd"
27   outputs = [
28     "values-am/android_chrome_strings.xml",
29     "values-ar/android_chrome_strings.xml",
30     "values-bg/android_chrome_strings.xml",
31     "values-ca/android_chrome_strings.xml",
32     "values-cs/android_chrome_strings.xml",
33     "values-da/android_chrome_strings.xml",
34     "values-de/android_chrome_strings.xml",
35     "values-el/android_chrome_strings.xml",
36     "values/android_chrome_strings.xml",
37     "values-en-rGB/android_chrome_strings.xml",
38     "values-es/android_chrome_strings.xml",
39     "values-es-rUS/android_chrome_strings.xml",
40     "values-fa/android_chrome_strings.xml",
41     "values-fi/android_chrome_strings.xml",
42     "values-tl/android_chrome_strings.xml",
43     "values-fr/android_chrome_strings.xml",
44     "values-hi/android_chrome_strings.xml",
45     "values-hr/android_chrome_strings.xml",
46     "values-hu/android_chrome_strings.xml",
47     "values-in/android_chrome_strings.xml",
48     "values-it/android_chrome_strings.xml",
49     "values-iw/android_chrome_strings.xml",
50     "values-ja/android_chrome_strings.xml",
51     "values-ko/android_chrome_strings.xml",
52     "values-lt/android_chrome_strings.xml",
53     "values-lv/android_chrome_strings.xml",
54     "values-nl/android_chrome_strings.xml",
55     "values-nb/android_chrome_strings.xml",
56     "values-pl/android_chrome_strings.xml",
57     "values-pt-rBR/android_chrome_strings.xml",
58     "values-pt-rPT/android_chrome_strings.xml",
59     "values-ro/android_chrome_strings.xml",
60     "values-ru/android_chrome_strings.xml",
61     "values-sk/android_chrome_strings.xml",
62     "values-sl/android_chrome_strings.xml",
63     "values-sr/android_chrome_strings.xml",
64     "values-sv/android_chrome_strings.xml",
65     "values-sw/android_chrome_strings.xml",
66     "values-th/android_chrome_strings.xml",
67     "values-tr/android_chrome_strings.xml",
68     "values-uk/android_chrome_strings.xml",
69     "values-vi/android_chrome_strings.xml",
70     "values-zh-rCN/android_chrome_strings.xml",
71     "values-zh-rTW/android_chrome_strings.xml",
72   ]
75 # GYP: //chrome/chrome.gyp:chrome_java
76 android_library("chrome_java") {
77   deps = [
78     ":chrome_java_resources",
79     "//base:base_java",
80     "//net/android:net_java",
81     "//components/bookmarks/common/android:bookmarks_java",
82     "//components/dom_distiller/android:dom_distiller_core_java",
83     "//components/gcm_driver/android:gcm_driver_java",
84     "//components/invalidation:java",
85     "//components/navigation_interception/android:navigation_interception_java",
86     "//components/variations/android:variations_java",
87     "//components/web_contents_delegate_android:web_contents_delegate_android_java",
88     "//content/public/android:content_java",
89     "//printing:printing_java",
90     "//sync/android:sync_java",
91     "//third_party/android_tools:android_support_v13_java",
92     "//third_party/android_tools:android_support_v7_appcompat_java",
93     "//third_party/cacheinvalidation:cacheinvalidation_javalib",
94     "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
95     "//third_party/jsr-305:jsr_305_javalib",
96     "//ui/android:ui_java",
97     "//ui/android:ui_java_resources",
98   ]
100   srcjar_deps = [
101     ":app_banner_metrics_ids_javagen",
102     ":chrome_android_java_enums_srcjar",
103     ":chrome_version_srcjar",
104     ":resource_id_javagen",
105     "//chrome:page_info_connection_type_javagen",
106     "//chrome:content_setting_javagen",
107     "//chrome:content_settings_type_javagen",
108   ]
110   DEPRECATED_java_in_dir = "java/src"
113 # GYP: //chrome/chrome_browser.gypi:activity_type_ids_java
114 # GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java
115 # GYP: //chrome/chrome_browser.gypi:profile_sync_service_model_type_selection_java
116 # GYP: //chrome/chrome_browser.gypi:tab_load_status_java
117 # GYP: //chrome/chrome_browser.gypi:toolbar_model_security_levels_java
118 java_cpp_enum("chrome_android_java_enums_srcjar") {
119   sources = [
120     "//chrome/browser/android/activity_type_ids.h",
121     "//chrome/browser/android/tab_android.h",
122     "//chrome/browser/profiles/profile_metrics.h",
123     "//chrome/browser/sync/profile_sync_service_android.cc",
124     "//chrome/browser/ui/toolbar/toolbar_model.h",
125   ]
126   outputs = [
127     "org/chromium/chrome/browser/ActivityTypeIds.java",
128     "org/chromium/chrome/browser/TabLoadStatus.java",
129     "org/chromium/chrome/browser/profiles/ProfileAccountManagementMetrics.java",
130     "org/chromium/chrome/browser/sync/ModelTypeSelection.java",
131     "org/chromium/chrome/browser/ui/toolbar/ToolbarModelSecurityLevel.java",
132   ]
135 # GYP: //chrome/chrome_browser.gypi:app_banner_metrics_ids_java
136 java_cpp_template("app_banner_metrics_ids_javagen") {
137   sources = [
138     "java/AppBannerMetricsIds.template",
139   ]
140   package_name = "org/chromium/chrome/browser/banners"
141   inputs = [
142     "../browser/android/banners/app_banner_metrics_id_list.h",
143   ]
146 # GYP: //chrome/chrome_browser.gypi:resource_id_java
147 java_cpp_template("resource_id_javagen") {
148   sources = [
149     "java/ResourceId.template",
150   ]
151   package_name = "org/chromium/chrome/browser"
152   inputs = [
153     "../browser/android/resource_id.h",
154   ]
157 # GYP: //chrome/chrome_shell.gypi:libchromeshell_base
158 static_library("chrome_shell_base") {
159   sources = [
160     "shell/chrome_shell_google_location_settings_helper.cc",
161     "shell/chrome_shell_google_location_settings_helper.h",
162   ]
164   deps = [
165     "//chrome/browser/ui",
166     "//chrome:chrome_android_core",
167     "//base",
168     "//base/allocator",
169     "//content/public/app:browser",
170     "//skia",
171   ]
173   # Some android targets still depend on --gc-sections to link.
174   # TODO: remove --gc-sections for Debug builds (crbug.com/159847).
175   ldflags = [ "-Wl,--gc-sections" ]
177   # TODO(GYP):
178   #[ 'order_profiling!=0', {
179   #'conditions': [
180   #[ 'OS=="android"', {
181   #'dependencies': [ '../tools/cygprofile/cygprofile.gyp:cygprofile', ],
182   #}],
183   #],
184   #}],
187 # GYP: //chrome/chrome_shell.gypi:libchromeshell
188 shared_library("chrome_shell") {
189   testonly = true
190   sources = [
191     # This file must always be included in the shared_library step to ensure
192     # JNI_OnLoad is exported.
193     "//chrome/app/android/chrome_jni_onload.cc",
194     "shell/chrome_main_delegate_chrome_shell_android.cc",
195     "shell/chrome_main_delegate_chrome_shell_android.h",
196   ]
197   deps = [
198     ":chrome_shell_base",
199   ]
201   # GYP: via base/files/protect_file_posix.gypi
202   # TODO(pasko): Remove this non-trivial linker wrapping as soon as
203   # crbug.com/424562 is fixed.
204   if (!is_component_build) {
205     ldflags = [ "-Wl,--wrap=close" ]
206     deps += [ "//base:protect_file_posix" ]
207   }
210 # GYP: //chrome/chrome_shell.gypi:libchromesyncshell
211 shared_library("chrome_sync_shell") {
212   testonly = true
213   sources = [
214     # This file must always be included in the shared_library step to ensure
215     # JNI_OnLoad is exported.
216     #"//chrome/app/android/chrome_jni_onload.cc",
217     #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc",
218     #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.h",
219   ]
220   deps = [
221     "//sync:test_support_sync_fake_server_android",
222   ]
223   datadeps = [
224     ":chrome_shell_base",
225   ]
228 # GYP: N/A
229 android_resources("chrome_shell_resources") {
230   deps = [
231     ":chrome_java_resources",
232   ]
233   testonly = true
234   resource_dirs = [ "shell/res" ]
235   custom_package = "org.chromium.chrome.shell"
238 # GYP: N/A
239 android_library("chrome_shell_java") {
240   testonly = true
241   deps = [
242     ":chrome_shell_resources",
243     ":chrome_java",
244     "//base:base_java",
245     "//content/public/android:content_java",
246     "//components/dom_distiller/android:dom_distiller_core_java",
247     "//components/web_contents_delegate_android:web_contents_delegate_android_java",
248     "//printing:printing_java",
249     "//net/android:net_java",
250     "//sync/android:sync_java",
251     "//third_party/android_tools:android_support_v13_java",
252     "//third_party/android_tools:android_support_v7_appcompat_java",
253     "//ui/android:ui_java",
254   ]
255   DEPRECATED_java_in_dir = "shell/java/src"
258 chrome_shell_assets_dir = "$root_build_dir/chrome_shell/assets"
260 # GYP: N/A
261 copy_ex("chrome_shell_assets") {
262   clear_dir = true
263   dest = chrome_shell_assets_dir
264   sources = [
265     "$root_build_dir/resources.pak",
266     "$root_build_dir/chrome_100_percent.pak",
267     "$root_build_dir/locales/am.pak",
268     "$root_build_dir/locales/ar.pak",
269     "$root_build_dir/locales/bg.pak",
270     "$root_build_dir/locales/ca.pak",
271     "$root_build_dir/locales/cs.pak",
272     "$root_build_dir/locales/da.pak",
273     "$root_build_dir/locales/de.pak",
274     "$root_build_dir/locales/el.pak",
275     "$root_build_dir/locales/en-GB.pak",
276     "$root_build_dir/locales/en-US.pak",
277     "$root_build_dir/locales/es.pak",
278     "$root_build_dir/locales/es-419.pak",
279     "$root_build_dir/locales/fa.pak",
280     "$root_build_dir/locales/fi.pak",
281     "$root_build_dir/locales/fil.pak",
282     "$root_build_dir/locales/fr.pak",
283     "$root_build_dir/locales/he.pak",
284     "$root_build_dir/locales/hi.pak",
285     "$root_build_dir/locales/hr.pak",
286     "$root_build_dir/locales/hu.pak",
287     "$root_build_dir/locales/id.pak",
288     "$root_build_dir/locales/it.pak",
289     "$root_build_dir/locales/ja.pak",
290     "$root_build_dir/locales/ko.pak",
291     "$root_build_dir/locales/lt.pak",
292     "$root_build_dir/locales/lv.pak",
293     "$root_build_dir/locales/nb.pak",
294     "$root_build_dir/locales/nl.pak",
295     "$root_build_dir/locales/pl.pak",
296     "$root_build_dir/locales/pt-BR.pak",
297     "$root_build_dir/locales/pt-PT.pak",
298     "$root_build_dir/locales/ro.pak",
299     "$root_build_dir/locales/ru.pak",
300     "$root_build_dir/locales/sk.pak",
301     "$root_build_dir/locales/sl.pak",
302     "$root_build_dir/locales/sr.pak",
303     "$root_build_dir/locales/sv.pak",
304     "$root_build_dir/locales/sw.pak",
305     "$root_build_dir/locales/th.pak",
306     "$root_build_dir/locales/tr.pak",
307     "$root_build_dir/locales/uk.pak",
308     "$root_build_dir/locales/vi.pak",
309     "$root_build_dir/locales/zh-CN.pak",
310     "$root_build_dir/locales/zh-TW.pak",
311   ]
312   deps = [
313     "//chrome:packed_resources",
314     "//chrome:packed_extra_resources",
315   ]
317   if (icu_use_data_file) {
318     sources += [ "$root_build_dir/icudtl.dat" ]
319   }
320   if (v8_use_external_startup_data) {
321     sources += [
322       "$root_gen_dir/natives_blob.bin",
323       "$root_gen_dir/snapshot_blob.bin",
324     ]
325   }
328 chrome_shell_manifest =
329     "$target_gen_dir/chrome_shell_manifest/AndroidManifest.xml"
331 # GYP: //chrome/chrome_shell.gypi:chrome_shell_manifest
332 jinja_template("chrome_shell_manifest") {
333   testonly = true
334   input = "shell/java/AndroidManifest.xml.jinja2"
335   output = chrome_shell_manifest
338 # GYP: //chrome/chrome_shell.gypi:chrome_shell_apk
339 android_apk("chrome_shell_apk") {
340   testonly = true
341   deps = [
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     ":chrome_shell_resources",
379     ":chrome_shell_java",
380     ":chrome_shell_assets",
381     ":chrome_sync_shell",
382   ]
383   apk_name = "ChromeSyncShell"
384   android_manifest = chrome_sync_shell_manifest
385   native_libs = [ "libchrome_sync_shell.so" ]
386   asset_location = chrome_shell_assets_dir
389 # GYP: part of //chrome/chrome_tests.gypi:chrome_shell_test_apk
390 android_library("chrome_javatests") {
391   testonly = true
392   DEPRECATED_java_in_dir = "javatests/src"
393   deps = [
394     ":chrome_java",
395     ":chrome_java_resources",
396     ":chrome_shell_java",
397     ":chrome_shell_resources",
398     ":chrome_shell_test_java",
399     "//base:base_java",
400     "//base:base_java_test_support",
401     "//chrome/test/android:chrome_java_test_support",
402     "//components/bookmarks/common/android:bookmarks_java",
403     "//components/dom_distiller/android:dom_distiller_core_java",
404     "//components/invalidation:java",
405     "//content/public/android:content_java",
406     "//content/public/test/android:content_java_test_support",
407     "//printing:printing_java",
408     "//sync/android:sync_java",
409     "//sync:sync_java_test_support",
410     "//third_party/android_tools:android_support_v13_java",
411     "//third_party/android_tools:android_support_v7_appcompat_java",
412     "//third_party/cacheinvalidation:cacheinvalidation_javalib",
413     "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
414     "//third_party/jsr-305:jsr_305_javalib",
415     "//ui/android:ui_java",
416   ]
419 android_library("chrome_shell_test_java") {
420   testonly = true
421   deps = [
422     ":chrome_java",
423     ":chrome_shell_java",
424     "//base:base_java",
425     "//base:base_java_test_support",
426     "//chrome/test/android:chrome_java_test_support",
427     "//content/public/android:content_java",
428     "//content/public/test/android:content_java_test_support",
429     "//ui/android:ui_java",
430   ]
431   DEPRECATED_java_in_dir = "shell/javatests/src"
434 # GYP: //chrome/chrome_tests.gypi:chrome_shell_test_apk
435 android_apk("chrome_shell_test_apk") {
436   testonly = true
437   deps = [
438     ":chrome_javatests",
439     ":chrome_shell_test_java",
440     "//sync/android:sync_javatests",
441     "//ui/android:ui_javatests",
442   ]
443   apk_name = "ChromeShellTest"
444   android_manifest = "shell/javatests/AndroidManifest.xml"
447 # GYP: //chrome/chrome_tests.gypi:chrome_sync_shell_test_apk
448 android_apk("chrome_sync_shell_test_apk") {
449   testonly = true
450   deps = [
451     ":chrome_java",
452     ":chrome_shell_java",
453     ":chrome_shell_test_java",
454     "//base:base_java",
455     "//base:base_java_test_support",
456     "//chrome/test/android:chrome_java_test_support",
457     "//components/invalidation:java",
458     "//content/public/android:content_java",
459     "//content/public/test/android:content_java_test_support",
460     "//sync/android:sync_java",
461     "//sync:sync_java_test_support",
462   ]
463   apk_name = "ChromeSyncShellTest"
464   DEPRECATED_java_in_dir = "sync_shell/javatests/src"
465   android_manifest = "sync_shell/javatests/AndroidManifest.xml"
468 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests_java
469 android_library("uiautomator_tests_java") {
470   testonly = true
471   DEPRECATED_java_in_dir = "uiautomator_tests/src"
472   deps = [
473     "//base:base_java_test_support",
474     "//third_party/android_tools:uiautomator_java",
475   ]
478 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests
479 uiautomator_test("uiautomator_tests") {
480   testonly = true
481   deps = [
482     ":uiautomator_tests_java",
483   ]
486 # GYP: //chrome/chrome_android.gypi:chrome_version_java
487 chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java"
488 chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java"
489 process_version("chrome_version_java") {
490   source = "java/ChromeVersionConstants.java.version"
491   output = chrome_version_java_file
492   extra_args = [
493     "-e",
494     "CHANNEL=str.upper('$android_channel')",
495   ]
498 zip("chrome_version_srcjar") {
499   inputs = [
500     chrome_version_java_file,
501   ]
502   output = "$target_gen_dir/$target_name.srcjar"
503   base_dir = chrome_version_java_dir