Rename chrome/android/javatests to javatests_shell.
[chromium-blink-merge.git] / chrome / android / BUILD.gn
blob1f96d90e1fd9d5d1598238c078e9b22be25dbe41
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/service_tab_launcher:service_tab_launcher_java",
91     "//components/precache/android:precache_java",
92     "//components/variations/android:variations_java",
93     "//components/web_contents_delegate_android:web_contents_delegate_android_java",
94     "//content/public/android:content_java",
95     "//printing:printing_java",
96     "//sync/android:sync_java",
97     "//third_party/android_data_chart:android_data_chart_java",
98     "//third_party/android_media:android_media_java",
99     "//third_party/android_protobuf:protobuf_nano_javalib",
100     "//third_party/android_tools:android_gcm_java",
101     "//third_party/android_swipe_refresh:android_swipe_refresh_java",
102     "//third_party/android_tools:android_support_v13_java",
103     "//third_party/android_tools:android_support_v7_appcompat_java",
104     "//third_party/android_tools:android_support_v7_mediarouter_java",
105     "//third_party/cacheinvalidation:cacheinvalidation_javalib",
106     "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
107     "//third_party/jsr-305:jsr_305_javalib",
108     "//media/base/android:media_java",
109     "//media/midi:midi_java",
110     "//ui/android:ui_java",
111     "//ui/android:ui_java_resources",
112     google_play_services_library,
113   ]
115   srcjar_deps = [
116     ":chrome_android_java_enums_srcjar",
117     ":chrome_version_srcjar",
118     ":resource_id_javagen",
119     "//chrome:page_info_connection_type_javagen",
120     "//chrome:content_setting_javagen",
121     "//chrome:content_settings_type_javagen",
122     "//components/enhanced_bookmarks:enhanced_bookmarks_launch_location_srcjar",
123   ]
125   DEPRECATED_java_in_dir = "java/src"
128 # GYP: //chrome/chrome_browser.gypi:activity_type_ids_java
129 # GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java
130 # GYP: //chrome/chrome_browser.gypi:profile_sync_service_model_type_selection_java
131 # GYP: //chrome/chrome_browser.gypi:tab_load_status_java
132 # GYP: //chrome/chrome_browser.gypi:toolbar_model_security_levels_java
133 java_cpp_enum("chrome_android_java_enums_srcjar") {
134   sources = [
135     "//chrome/browser/android/activity_type_ids.h",
136     "//chrome/browser/android/tab_android.h",
137     "//chrome/browser/profiles/profile_metrics.h",
138     "//chrome/browser/sync/profile_sync_service_android.cc",
139     "//chrome/browser/ui/toolbar/toolbar_model.h",
140   ]
141   outputs = [
142     "org/chromium/chrome/browser/ActivityTypeIds.java",
143     "org/chromium/chrome/browser/TabLoadStatus.java",
144     "org/chromium/chrome/browser/profiles/ProfileAccountManagementMetrics.java",
145     "org/chromium/chrome/browser/sync/ModelTypeSelection.java",
146     "org/chromium/chrome/browser/ui/toolbar/ToolbarModelSecurityLevel.java",
147   ]
150 # GYP: //chrome/chrome_browser.gypi:document_tab_model_info_proto_java
151 proto_java_library("document_tab_model_info_proto_java") {
152   proto_path = "java/src/org/chromium/chrome/browser/tabmodel/document"
153   sources = [
154     "$proto_path/document_tab_model_info.proto",
155   ]
158 # GYP: //chrome/chrome_browser.gypi:resource_id_java
159 java_cpp_template("resource_id_javagen") {
160   sources = [
161     "java/ResourceId.template",
162   ]
163   package_name = "org/chromium/chrome/browser"
164   inputs = [
165     "../browser/android/resource_id.h",
166   ]
169 # GYP: //chrome/chrome_shell.gypi:libchromeshell_base
170 group("chrome_shell_base") {
171   deps = [
172     "//chrome/browser/ui",
173     "//chrome:chrome_android_core",
174     "//base",
175     "//base/allocator",
176     "//content/public/app:both",
177     "//skia",
178   ]
179   # TODO(GYP):
180   #[ 'order_profiling!=0', {
181   #'dependencies': [ '../tools/cygprofile/cygprofile.gyp:cygprofile', ],
182   #}],
185 # GYP: //chrome/chrome_shell.gypi:libchromeshell
186 shared_library("chrome_shell") {
187   testonly = true
188   sources = [
189     "shell/chrome_main_delegate_chrome_shell_android.cc",
190     "shell/chrome_main_delegate_chrome_shell_android.h",
191     "shell/chrome_shell_entry_point.cc",
192   ]
193   deps = [
194     ":chrome_shell_base",
195   ]
198 # GYP: //chrome/chrome_shell.gypi:libchromesyncshell
199 shared_library("chrome_sync_shell") {
200   testonly = true
201   sources = [
202     #"shell/chrome_shell_entry_point.cc",
203     #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc",
204     #"sync_shell/chrome_main_delegate_chrome_sync_shell_android.h",
205   ]
206   deps = [
207     "//sync:test_support_sync_fake_server_android",
208   ]
209   datadeps = [
210     ":chrome_shell_base",
211   ]
214 # GYP: N/A
215 android_resources("chrome_shell_resources") {
216   deps = [
217     ":chrome_java_resources",
218   ]
219   testonly = true
220   resource_dirs = [ "shell/res" ]
221   custom_package = "org.chromium.chrome.shell"
224 # GYP: N/A
225 android_library("chrome_shell_java") {
226   testonly = true
227   deps = [
228     ":chrome_shell_resources",
229     ":chrome_java",
230     "//base:base_java",
231     "//content/public/android:content_java",
232     "//components/dom_distiller/android:dom_distiller_content_java",
233     "//components/dom_distiller/android:dom_distiller_core_java",
234     "//components/service_tab_launcher:service_tab_launcher_java",
235     "//components/web_contents_delegate_android:web_contents_delegate_android_java",
236     "//printing:printing_java",
237     "//net/android:net_java",
238     "//sync/android:sync_java",
239     "//third_party/android_tools:android_support_v13_java",
240     "//third_party/android_tools:android_support_v7_appcompat_java",
241     "//ui/android:ui_java",
242   ]
243   DEPRECATED_java_in_dir = "shell/java/src"
246 chrome_shell_assets_dir = "$root_build_dir/chrome_shell/assets"
248 # GYP: N/A
249 copy_ex("chrome_shell_assets") {
250   clear_dir = true
251   dest = chrome_shell_assets_dir
252   sources = [
253     "$root_build_dir/chrome_100_percent.pak",
254     "$root_build_dir/locales/am.pak",
255     "$root_build_dir/locales/ar.pak",
256     "$root_build_dir/locales/bg.pak",
257     "$root_build_dir/locales/ca.pak",
258     "$root_build_dir/locales/cs.pak",
259     "$root_build_dir/locales/da.pak",
260     "$root_build_dir/locales/de.pak",
261     "$root_build_dir/locales/el.pak",
262     "$root_build_dir/locales/en-GB.pak",
263     "$root_build_dir/locales/en-US.pak",
264     "$root_build_dir/locales/es-419.pak",
265     "$root_build_dir/locales/es.pak",
266     "$root_build_dir/locales/fa.pak",
267     "$root_build_dir/locales/fi.pak",
268     "$root_build_dir/locales/fil.pak",
269     "$root_build_dir/locales/fr.pak",
270     "$root_build_dir/locales/he.pak",
271     "$root_build_dir/locales/hi.pak",
272     "$root_build_dir/locales/hr.pak",
273     "$root_build_dir/locales/hu.pak",
274     "$root_build_dir/locales/id.pak",
275     "$root_build_dir/locales/it.pak",
276     "$root_build_dir/locales/ja.pak",
277     "$root_build_dir/locales/ko.pak",
278     "$root_build_dir/locales/lt.pak",
279     "$root_build_dir/locales/lv.pak",
280     "$root_build_dir/locales/nb.pak",
281     "$root_build_dir/locales/nl.pak",
282     "$root_build_dir/locales/pl.pak",
283     "$root_build_dir/locales/pt-BR.pak",
284     "$root_build_dir/locales/pt-PT.pak",
285     "$root_build_dir/locales/ro.pak",
286     "$root_build_dir/locales/ru.pak",
287     "$root_build_dir/locales/sk.pak",
288     "$root_build_dir/locales/sl.pak",
289     "$root_build_dir/locales/sr.pak",
290     "$root_build_dir/locales/sv.pak",
291     "$root_build_dir/locales/sw.pak",
292     "$root_build_dir/locales/th.pak",
293     "$root_build_dir/locales/tr.pak",
294     "$root_build_dir/locales/uk.pak",
295     "$root_build_dir/locales/vi.pak",
296     "$root_build_dir/locales/zh-CN.pak",
297     "$root_build_dir/locales/zh-TW.pak",
298     "$root_build_dir/resources.pak",
299   ]
300   deps = [
301     "//chrome:packed_resources",
302     "//chrome:packed_extra_resources",
303   ]
305   if (icu_use_data_file) {
306     sources += [ "$root_build_dir/icudtl.dat" ]
307   }
308   if (v8_use_external_startup_data) {
309     sources += [
310       "$root_build_dir/natives_blob.bin",
311       "$root_build_dir/snapshot_blob.bin",
312     ]
313   }
316 chrome_shell_manifest =
317     "$target_gen_dir/chrome_shell_manifest/AndroidManifest.xml"
319 # GYP: //chrome/chrome_shell.gypi:chrome_shell_manifest
320 jinja_template("chrome_shell_manifest") {
321   testonly = true
322   input = "shell/java/AndroidManifest.xml.jinja2"
323   output = chrome_shell_manifest
326 # TODO(cjhopman): This should actually be done as a build step instead of at gn
327 # time.
328 _version_py_path = "//build/util/version.py"
329 _chrome_version_path = "//chrome/VERSION"
330 _version_full = exec_script(_version_py_path,
331                             [
332                               "-f",
333                               rebase_path(_chrome_version_path, root_build_dir),
334                               "-t \"@MAJOR@.@MINOR@.@BUILD@.@PATCH@\"",
335                             ],
336                             "value",
337                             [ _chrome_version_path ])
339 # GYP: //chrome/chrome_shell.gypi:chrome_shell_apk
340 android_apk("chrome_shell_apk") {
341   testonly = true
342   deps = [
343     "//base:base_java",
344     ":chrome_shell_resources",
345     ":chrome_shell_java",
346     ":chrome_shell_assets",
347     ":chrome_shell",
348   ]
349   apk_name = "ChromeShell"
350   android_manifest = chrome_shell_manifest
351   native_libs = [ "libchrome_shell.so" ]
352   native_lib_version_name = _version_full
353   asset_location = chrome_shell_assets_dir
355   #TODO(GYP):
356   #'variables': {
357   #'conditions': [
358   #['component != "shared_library" and target_arch != "arm64" and target_arch != "x64" and profiling_full_stack_frames != 1', {
359   ## Only enable the chromium linker on regular builds, since the
360   ## component build crashes on Android 4.4. See b/11379966
361   #'use_chromium_linker': '1',
362   #}],
363   #],
364   #},
367 chrome_sync_shell_manifest =
368     "$target_gen_dir/chrome_sync_shell_manifest/AndroidManifest.xml"
370 # GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_manifest
371 jinja_template("chrome_sync_shell_manifest") {
372   testonly = true
373   input = "sync_shell/java/AndroidManifest.xml.jinja2"
374   output = chrome_sync_shell_manifest
377 # GYP: //chrome/chrome_shell.gypi:chrome_sync_shell_apk
378 android_apk("chrome_sync_shell_apk") {
379   testonly = true
380   deps = [
381     "//base:base_java",
382     ":chrome_shell_resources",
383     ":chrome_shell_java",
384     ":chrome_shell_assets",
385     ":chrome_sync_shell",
386   ]
387   apk_name = "ChromeSyncShell"
388   android_manifest = chrome_sync_shell_manifest
389   native_libs = [ "libchrome_sync_shell.so" ]
390   asset_location = chrome_shell_assets_dir
393 # GYP: part of //chrome/chrome_tests.gypi:chrome_shell_test_apk
394 android_library("chrome_javatests") {
395   testonly = true
396   DEPRECATED_java_in_dir = "javatests_shell/src"
397   deps = [
398     ":chrome_java",
399     ":chrome_java_resources",
400     ":chrome_shell_java",
401     ":chrome_shell_resources",
402     ":chrome_shell_test_java",
403     "//base:base_java",
404     "//base:base_java_test_support",
405     "//chrome/test/android:chrome_java_test_support",
406     "//components/bookmarks/common/android:bookmarks_java",
407     "//components/dom_distiller/android:dom_distiller_core_java",
408     "//components/invalidation:java",
409     "//components/invalidation:javatests",
410     "//components/navigation_interception/android:navigation_interception_java",
411     "//components/precache/android:precache_java",
412     "//components/precache/android:precache_javatests",
413     "//content/public/android:content_java",
414     "//content/public/test/android:content_java_test_support",
415     "//printing:printing_java",
416     "//sync/android:sync_java",
417     "//sync/android:sync_javatests",
418     "//sync:sync_java_test_support",
419     "//third_party/android_protobuf:protobuf_nano_javalib",
420     "//third_party/android_tools:android_support_v13_java",
421     "//third_party/android_tools:android_support_v7_appcompat_java",
422     "//third_party/cacheinvalidation:cacheinvalidation_javalib",
423     "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
424     "//third_party/jsr-305:jsr_305_javalib",
425     "//ui/android:ui_java",
426   ]
429 android_library("chrome_shell_test_java") {
430   testonly = true
431   deps = [
432     ":chrome_java",
433     ":chrome_shell_java",
434     "//base:base_java",
435     "//base:base_java_test_support",
436     "//chrome/test/android:chrome_java_test_support",
437     "//content/public/android:content_java",
438     "//content/public/test/android:content_java_test_support",
439     "//third_party/android_tools:android_support_v13_java",
440     "//third_party/android_tools:android_support_v7_appcompat_java",
441     "//ui/android:ui_java",
442   ]
443   DEPRECATED_java_in_dir = "shell/javatests/src"
446 # GYP: //chrome/chrome_tests.gypi:chrome_shell_test_apk
447 android_apk("chrome_shell_test_apk") {
448   testonly = true
449   apk_under_test = ":chrome_shell_apk"
450   deps = [
451     ":chrome_javatests",
452     ":chrome_shell_test_java",
453     "//sync/android:sync_javatests",
454     "//testing/android/broker:broker_java",
455     "//ui/android:ui_javatests",
456   ]
457   datadeps = [
458     "//testing/android/driver:driver_apk",
459   ]
460   apk_name = "ChromeShellTest"
461   android_manifest = "shell/javatests/AndroidManifest.xml"
464 # GYP: //chrome/chrome_tests.gypi:chrome_junit_tests
465 junit_binary("chrome_junit_tests") {
466   java_files = [
467     "junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java",
468     "junit/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteControllerTest.java",
469     "junit/src/org/chromium/chrome/browser/media/remote/MediaUrlResolverTest.java",
470     "junit/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfoTest.java",
471     "junit/src/org/chromium/chrome/browser/media/remote/TransportControlTest.java",
472   ]
473   deps = [
474     ":chrome_java",
475     "//base:base_java",
476     "//base:base_java_test_support",
477     "//third_party/junit:hamcrest",
478     "//third_party/android_tools:android_support_v7_mediarouter_java",
479   ]
482 # GYP: //chrome/chrome_tests.gypi:chrome_sync_shell_test_apk
483 if (false) {
484   # TODO(GYP): We need sync/sync_tests.gypi:test_support_sync_proto_java to be ported.
485   # crbug.com/475612
486   android_apk("chrome_sync_shell_test_apk") {
487     apk_under_test = ":chrome_sync_shell_apk"
488     testonly = true
489     deps = [
490       ":chrome_java",
491       ":chrome_shell_java",
492       ":chrome_shell_test_java",
493       "//base:base_java",
494       "//base:base_java_test_support",
495       "//chrome/test/android:chrome_java_test_support",
496       "//components/invalidation:java",
497       "//content/public/android:content_java",
498       "//content/public/test/android:content_java_test_support",
499       "//sync/android:sync_java",
500       "//sync:sync_java_test_support",
501       "//third_party/android_tools:android_support_v13_java",
502       "//third_party/android_tools:android_support_v7_appcompat_java",
503       "//ui/android:ui_java",
504     ]
505     apk_name = "ChromeSyncShellTest"
506     DEPRECATED_java_in_dir = "sync_shell/javatests/src"
507     android_manifest = "sync_shell/javatests/AndroidManifest.xml"
508   }
511 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests_java
512 android_library("uiautomator_tests_java") {
513   testonly = true
514   DEPRECATED_java_in_dir = "uiautomator_tests/src"
515   deps = [
516     "//base:base_java_test_support",
517     "//third_party/android_tools:uiautomator_java",
518   ]
521 # GYP: //chrome/chrome_tests.gypi:chrome_shell_uiautomator_tests
522 uiautomator_test("uiautomator_tests") {
523   testonly = true
524   deps = [
525     ":uiautomator_tests_java",
526   ]
529 # GYP: //chrome/chrome_android.gypi:chrome_version_java
530 chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java"
531 chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java"
532 process_version("chrome_version_java") {
533   template_file = "java/ChromeVersionConstants.java.version"
534   output = chrome_version_java_file
535   extra_args = [
536     "-e",
537     "CHANNEL=str.upper('$android_channel')",
538   ]
541 zip("chrome_version_srcjar") {
542   inputs = [
543     chrome_version_java_file,
544   ]
545   output = "$target_gen_dir/$target_name.srcjar"
546   base_dir = chrome_version_java_dir