Make chrome_shell_apk build
[chromium-blink-merge.git] / chrome / android / BUILD.gn
blob202fcd39be40321baff969d4850ca487a7291456
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("//chrome/version.gni")
8 import("//third_party/icu/config.gni")
11 # GYP: //chrome/chrome.gyp:chrome_java (resources part)
12 android_resources("chrome_java_resources") {
13   resource_dirs = [
14     "java/res",
15   ]
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     "//base:base_java",
81     "//net/android:net_java",
82     "//components/bookmarks/common/android:bookmarks_java",
83     "//components/dom_distiller/android:dom_distiller_core_java",
84     "//components/gcm_driver/android:gcm_driver_java",
85     "//components/invalidation:java",
86     "//components/navigation_interception/android:navigation_interception_java",
87     "//components/variations/android:variations_java",
88     "//components/web_contents_delegate_android:web_contents_delegate_android_java",
89     "//content/public/android:content_java",
90     "//printing:printing_java",
91     "//sync/android:sync_java",
92     "//third_party/android_tools:android_support_v13_java",
93     "//third_party/android_tools:android_support_v7_appcompat_java",
94     "//third_party/cacheinvalidation:cacheinvalidation_javalib",
95     "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
96     "//third_party/jsr-305:jsr_305_javalib",
97     "//ui/android:ui_java",
98     "//ui/android:ui_java_resources",
99   ]
101   srcjar_deps = [
102     ":activity_type_ids_javagen",
103     ":app_banner_metrics_ids_javagen",
104     ":profile_account_management_metrics_javagen",
105     ":profile_sync_service_model_type_selection_javagen",
106     ":resource_id_javagen",
107     ":toolbar_model_security_levels_javagen",
108     ":tab_load_status_javagen",
109     ":chrome_version_srcjar",
110     "//chrome:page_info_connection_type_javagen",
111   ]
113   DEPRECATED_java_in_dir = "java/src"
116 # GYP: //chrome/chrome_browser.gypi:activity_type_ids_java
117 java_cpp_template("activity_type_ids_javagen") {
118   sources = [
119     "java/ActivityTypeIds.template",
120   ]
121   package_name = "org/chromium/chrome/browser"
122   inputs = [
123     "../browser/android/activity_type_id_list.h"
124   ]
127 # GYP: //chrome/chrome_browser.gypi:app_banner_metrics_ids_java
128 java_cpp_template("app_banner_metrics_ids_javagen") {
129   sources = [
130     "java/AppBannerMetricsIds.template",
131   ]
132   package_name = "org/chromium/chrome/browser/banners"
133   inputs = [
134     "../browser/android/banners/app_banner_metrics_id_list.h"
135   ]
138 # GYP: //chrome/chrome_browser.gypi:resource_id_java
139 java_cpp_template("resource_id_javagen") {
140   sources = [
141     "java/ResourceId.template",
142   ]
143   package_name = "org/chromium/chrome/browser"
144   inputs = [
145     "../browser/android/resource_id.h"
146   ]
149 # GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java
150 java_cpp_template("profile_account_management_metrics_javagen") {
151   sources = [
152     "java/ProfileAccountManagementMetrics.template",
153   ]
154   package_name = "org/chromium/chrome/browser/profiles"
155   inputs = [
156     "../browser/profiles/profile_metrics_list.h"
157   ]
160 # GYP: //chrome/chrome_browser.gypi:profile_sync_service_model_type_selection_java
161 java_cpp_template("profile_sync_service_model_type_selection_javagen") {
162   sources = [
163     "java/ModelTypeSelection.template",
164   ]
165   package_name = "org/chromium/chrome/browser/sync"
166   inputs = [
167     "../browser/sync/profile_sync_service_model_type_selection_android.h"
168   ]
171 # GYP: //chrome/chrome_browser.gypi:toolbar_model_security_levels_java
172 java_cpp_template("toolbar_model_security_levels_javagen") {
173   sources = [
174     "java/ToolbarModelSecurityLevel.template",
175   ]
176   package_name = "org/chromium/chrome/browser/ui/toolbar"
177   inputs = [
178     "../browser/ui/toolbar/toolbar_model_security_level_list.h"
179   ]
182 # GYP: //chrome/chrome_browser.gypi:tab_load_status_java
183 java_cpp_template("tab_load_status_javagen") {
184   sources = [
185     "java/TabLoadStatus.template",
186   ]
187   package_name = "org/chromium/chrome/browser"
188   inputs = [
189     "../browser/android/tab_load_status.h"
190   ]
193 # GYP: //chrome/chrome_shell.gypi:libchromeshell_base
194 static_library("chrome_shell_base") {
195   sources = [
196     "shell/chrome_shell_google_location_settings_helper.cc",
197     "shell/chrome_shell_google_location_settings_helper.h",
198   ]
200   deps = [
201     "//chrome/browser/ui",
202     "//chrome:chrome_android_core",
203     "//base",
204     "//base/allocator",
205     "//content/public/app:browser",
206     "//skia",
207   ]
209   # TODO(GYP):
210   #[ 'order_profiling!=0', {
211   #'conditions': [
212   #[ 'OS=="android"', {
213   #'dependencies': [ '../tools/cygprofile/cygprofile.gyp:cygprofile', ],
214   #}],
215   #],
216   #}],
219 # TODO(GYP, cjhopman): make chrome_shell_base actually link and then move it to
220 # deps. Also, actually compile the main delegates at that point.
221 # GYP: //chrome/chrome_browser.gypi:libchromeshell
222 shared_library("chrome_shell") {
223   testonly = true
224   sources = [
225     # This file must always be included in the shared_library step to ensure
226     # JNI_OnLoad is exported.
227 #"//chrome/app/android/chrome_jni_onload.cc",
228 #"shell/chrome_main_delegate_chrome_shell_android.cc",
229 #"shell/chrome_main_delegate_chrome_shell_android.h",
230   ]
231   deps = [
232 #":chrome_shell_base",
233   ]
234   deps = [ ":chrome_java" ]
235   datadeps = [
236     ":chrome_shell_base"
237   ]
240 # GYP: //chrome/chrome_browser.gypi:libchromesyncshell
241 shared_library("chrome_sync_shell") {
242   testonly = true
243   sources = [
244     # This file must always be included in the shared_library step to ensure
245     # JNI_OnLoad is exported.
246 #"//chrome/app/android/chrome_jni_onload.cc",
247 #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc",
248 #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.h",
249   ]
250   deps = [
251     "//sync:test_support_sync_fake_server_android",
252   ]
253   datadeps = [
254     ":chrome_shell_base",
255   ]
258 # GYP: N/A
259 android_resources("chrome_shell_resources") {
260   deps = [
261     ":chrome_java_resources",
262   ]
263   testonly = true
264   resource_dirs = [ "shell/res" ]
265   custom_package = "org.chromium.chrome.shell"
268 # GYP: N/A
269 android_library("chrome_shell_java") {
270   testonly = true
271   deps = [
272     ":chrome_shell_resources",
273     ":chrome_java",
274     "//base:base_java",
275     "//content/public/android:content_java",
276     "//components/dom_distiller/android:dom_distiller_core_java",
277     "//components/web_contents_delegate_android:web_contents_delegate_android_java",
278     "//printing:printing_java",
279     "//net/android:net_java",
280     "//sync/android:sync_java",
281     "//ui/android:ui_java",
282   ]
283   DEPRECATED_java_in_dir = "shell/java/src"
286 chrome_shell_assets_dir = "$root_build_dir/chrome_shell/assets"
288 # GYP: N/A
289 copy_ex("chrome_shell_assets") {
290   clear_dir = true
291   dest = chrome_shell_assets_dir
292   sources = [
293     "$root_build_dir/resources.pak",
294     "$root_build_dir/chrome_100_percent.pak",
295     "$root_build_dir/locales/am.pak",
296     "$root_build_dir/locales/ar.pak",
297     "$root_build_dir/locales/bg.pak",
298     "$root_build_dir/locales/ca.pak",
299     "$root_build_dir/locales/cs.pak",
300     "$root_build_dir/locales/da.pak",
301     "$root_build_dir/locales/de.pak",
302     "$root_build_dir/locales/el.pak",
303     "$root_build_dir/locales/en-GB.pak",
304     "$root_build_dir/locales/en-US.pak",
305     "$root_build_dir/locales/es.pak",
306     "$root_build_dir/locales/es-419.pak",
307     "$root_build_dir/locales/fa.pak",
308     "$root_build_dir/locales/fi.pak",
309     "$root_build_dir/locales/fil.pak",
310     "$root_build_dir/locales/fr.pak",
311     "$root_build_dir/locales/he.pak",
312     "$root_build_dir/locales/hi.pak",
313     "$root_build_dir/locales/hr.pak",
314     "$root_build_dir/locales/hu.pak",
315     "$root_build_dir/locales/id.pak",
316     "$root_build_dir/locales/it.pak",
317     "$root_build_dir/locales/ja.pak",
318     "$root_build_dir/locales/ko.pak",
319     "$root_build_dir/locales/lt.pak",
320     "$root_build_dir/locales/lv.pak",
321     "$root_build_dir/locales/nb.pak",
322     "$root_build_dir/locales/nl.pak",
323     "$root_build_dir/locales/pl.pak",
324     "$root_build_dir/locales/pt-BR.pak",
325     "$root_build_dir/locales/pt-PT.pak",
326     "$root_build_dir/locales/ro.pak",
327     "$root_build_dir/locales/ru.pak",
328     "$root_build_dir/locales/sk.pak",
329     "$root_build_dir/locales/sl.pak",
330     "$root_build_dir/locales/sr.pak",
331     "$root_build_dir/locales/sv.pak",
332     "$root_build_dir/locales/sw.pak",
333     "$root_build_dir/locales/th.pak",
334     "$root_build_dir/locales/tr.pak",
335     "$root_build_dir/locales/uk.pak",
336     "$root_build_dir/locales/vi.pak",
337     "$root_build_dir/locales/zh-CN.pak",
338     "$root_build_dir/locales/zh-TW.pak",
339   ]
340   deps = [
341     "//chrome:packed_resources",
342     "//chrome:packed_extra_resources",
343   ]
345   if (icu_use_data_file) {
346     sources += [
347       "$root_build_dir/icudtl.dat"
348     ]
349   }
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 #}],
363 # GYP: //chrome/chrome_browser.gypi:chrome_shell_apk
364 android_apk("chrome_shell_apk") {
365   testonly = true
366   deps = [
367     ":chrome_shell_resources",
368     ":chrome_shell_java",
369     ":chrome_shell_assets",
370     ":chrome_shell",
371   ]
372   apk_name = "ChromeShell"
373   android_manifest = "shell/java/AndroidManifest.xml"
374   native_libs = [
375     "$root_build_dir/lib.stripped/libchrome_shell.so"
376   ]
377   asset_location = chrome_shell_assets_dir
380 # GYP: //chrome/chrome_browser.gypi:chrome_sync_shell_apk
381 android_apk("chrome_sync_shell_apk") {
382   testonly = true
383   deps = [
384     ":chrome_shell_resources",
385     ":chrome_shell_java",
386     ":chrome_shell_assets",
387     ":chrome_sync_shell",
388   ]
389   apk_name = "ChromeSyncShell"
390   android_manifest = "sync_shell/java/AndroidManifest.xml"
391   native_libs = [
392     "$root_build_dir/lib.stripped/libchrome_sync_shell.so"
393   ]
394   asset_location = chrome_shell_assets_dir
397 # GYP: //chrome/chrome_android.gypi:chrome_version_java
398 chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java"
399 chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java"
400 process_version("chrome_version_java") {
401   source = "java/ChromeVersionConstants.java.version"
402   output = chrome_version_java_file
405 zip("chrome_version_srcjar") {
406   inputs = [ chrome_version_java_file ]
407   output = "$target_gen_dir/$target_name.srcjar"
408   base_dir = chrome_version_java_dir