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("//third_party/protobuf/proto_library.gni")
14 manifest_package = "org.chromium.chrome"
15 if (enable_configuration_policy) {
16 configuration_policy = 1
18 configuration_policy = 0
22 "channel=$android_channel",
23 "manifest_package=$manifest_package",
24 "configuration_policy=$configuration_policy",
27 chrome_android_paks_gypi =
28 exec_script("//build/gypi_to_gn.py",
30 rebase_path("//chrome/chrome_android_paks.gypi"),
31 "--replace=<(PRODUCT_DIR)=$root_out_dir",
34 [ "//chrome/chrome_android_paks.gypi" ])
36 locale_pak_resources("chrome_locale_paks") {
37 sources = chrome_android_paks_gypi.chrome_android_pak_locale_resources
40 "//chrome:packed_resources",
44 # GYP: //chrome/chrome.gyp:chrome_java (resources part)
45 android_resources("chrome_java_resources") {
46 if (!defined(android_branding_res_dirs)) {
47 android_branding_res_dirs = [ "//chrome/android/java/res_chromium" ]
49 resource_dirs = [ "java/res" ] + android_branding_res_dirs
51 ":chrome_locale_paks",
52 ":chrome_strings_grd",
53 "//components/policy:app_restrictions_resources",
54 "//content/public/android:content_java_resources",
55 "//chrome/app:java_strings_grd",
56 "//third_party/android_data_chart:android_data_chart_java_resources",
57 "//third_party/android_media:android_media_resources",
59 if (!enable_configuration_policy) {
60 deps -= [ "//components/policy:app_restrictions_resources" ]
62 custom_package = "org.chromium.chrome"
65 # GYP: //chrome/chrome.gyp:chrome_strings_grd
66 java_strings_grd("chrome_strings_grd") {
67 grd_file = "java/strings/android_chrome_strings.grd"
69 "values-am/android_chrome_strings.xml",
70 "values-ar/android_chrome_strings.xml",
71 "values-bg/android_chrome_strings.xml",
72 "values-ca/android_chrome_strings.xml",
73 "values-cs/android_chrome_strings.xml",
74 "values-da/android_chrome_strings.xml",
75 "values-de/android_chrome_strings.xml",
76 "values-el/android_chrome_strings.xml",
77 "values/android_chrome_strings.xml",
78 "values-en-rGB/android_chrome_strings.xml",
79 "values-es/android_chrome_strings.xml",
80 "values-es-rUS/android_chrome_strings.xml",
81 "values-fa/android_chrome_strings.xml",
82 "values-fi/android_chrome_strings.xml",
83 "values-tl/android_chrome_strings.xml",
84 "values-fr/android_chrome_strings.xml",
85 "values-hi/android_chrome_strings.xml",
86 "values-hr/android_chrome_strings.xml",
87 "values-hu/android_chrome_strings.xml",
88 "values-in/android_chrome_strings.xml",
89 "values-it/android_chrome_strings.xml",
90 "values-iw/android_chrome_strings.xml",
91 "values-ja/android_chrome_strings.xml",
92 "values-ko/android_chrome_strings.xml",
93 "values-lt/android_chrome_strings.xml",
94 "values-lv/android_chrome_strings.xml",
95 "values-nl/android_chrome_strings.xml",
96 "values-nb/android_chrome_strings.xml",
97 "values-pl/android_chrome_strings.xml",
98 "values-pt-rBR/android_chrome_strings.xml",
99 "values-pt-rPT/android_chrome_strings.xml",
100 "values-ro/android_chrome_strings.xml",
101 "values-ru/android_chrome_strings.xml",
102 "values-sk/android_chrome_strings.xml",
103 "values-sl/android_chrome_strings.xml",
104 "values-sr/android_chrome_strings.xml",
105 "values-sv/android_chrome_strings.xml",
106 "values-sw/android_chrome_strings.xml",
107 "values-th/android_chrome_strings.xml",
108 "values-tr/android_chrome_strings.xml",
109 "values-uk/android_chrome_strings.xml",
110 "values-vi/android_chrome_strings.xml",
111 "values-zh-rCN/android_chrome_strings.xml",
112 "values-zh-rTW/android_chrome_strings.xml",
116 # GYP: //chrome/chrome.gyp:chrome_java
117 android_library("chrome_java") {
119 ":chrome_java_resources",
120 ":document_tab_model_info_proto_java",
122 "//net/android:net_java",
123 "//components/bookmarks/common/android:bookmarks_java",
124 "//components/dom_distiller/android:dom_distiller_content_java",
125 "//components/dom_distiller/android:dom_distiller_core_java",
126 "//components/gcm_driver/android:gcm_driver_java",
127 "//components/invalidation/impl:java",
128 "//components/navigation_interception/android:navigation_interception_java",
129 "//components/policy/android:policy_java",
130 "//components/precache/android:precache_java",
131 "//components/safe_json/android:safe_json_java",
132 "//components/service_tab_launcher:service_tab_launcher_java",
133 "//components/signin/core/browser/android:java",
134 "//components/variations/android:variations_java",
135 "//components/web_contents_delegate_android:web_contents_delegate_android_java",
136 "//content/public/android:content_java",
137 "//media/base/android:media_java",
138 "//printing:printing_java",
139 "//sync/android:sync_java",
140 "//third_party/android_data_chart:android_data_chart_java",
141 "//third_party/android_media:android_media_java",
142 "//third_party/android_protobuf:protobuf_nano_javalib",
143 "//third_party/android_swipe_refresh:android_swipe_refresh_java",
144 "//third_party/android_tools:android_gcm_java",
145 "//third_party/android_tools:android_support_design_java",
146 "//third_party/android_tools:android_support_v13_java",
147 "//third_party/android_tools:android_support_v7_appcompat_java",
148 "//third_party/android_tools:android_support_v7_mediarouter_java",
149 "//third_party/android_tools:android_support_v7_mediarouter_resources",
150 "//third_party/android_tools:android_support_v7_recyclerview_java",
151 "//third_party/cacheinvalidation:cacheinvalidation_javalib",
152 "//third_party/cacheinvalidation:cacheinvalidation_proto_java",
153 "//third_party/jsr-305:jsr_305_javalib",
154 "//third_party/WebKit/public:blink_headers_java",
155 "//media/base/android:media_java",
156 "//media/midi:midi_java",
157 "//ui/android:ui_java",
158 "//ui/android:ui_java_resources",
159 google_play_services_library,
163 ":chrome_android_java_enums_srcjar",
164 ":chrome_version_srcjar",
165 ":custom_tabs_service_aidl",
166 ":resource_id_javagen",
167 "//chrome:page_info_connection_type_javagen",
168 "//chrome:content_setting_javagen",
169 "//chrome:content_settings_type_javagen",
170 "//components/enhanced_bookmarks:enhanced_bookmarks_java_enums_srcjar",
171 "//components/offline_pages:offline_pages_enums_java",
174 DEPRECATED_java_in_dir = "java/src"
177 # GYP: //chrome/chrome_browser.gypi:activity_type_ids_java
178 # GYP: //chrome/chrome_browser.gypi:connectivity_check_result_java
179 # GYP: //chrome/chrome_browser.gypi:shortcut_source_java
180 # GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java
181 # GYP: //chrome/chrome_browser.gypi:connection_security_levels_java
182 # GYP: //chrome/chrome_browser.gypi:tab_load_status_java
183 # GYP: //chrome/chrome_browser.gypi:infobar_action_type_java
184 java_cpp_enum("chrome_android_java_enums_srcjar") {
186 "//chrome/browser/android/activity_type_ids.h",
187 "//chrome/browser/android/feedback/connectivity_checker.cc",
188 "//chrome/browser/android/shortcut_info.h",
189 "//chrome/browser/android/tab_android.h",
190 "//chrome/browser/profiles/profile_metrics.h",
191 "//chrome/browser/ssl/security_state_model.h",
192 "//chrome/browser/ui/android/infobars/infobar_android.h",
195 "org/chromium/chrome/browser/ActivityTypeIds.java",
196 "org/chromium/chrome/browser/feedback/ConnectivityCheckResult.java",
197 "org/chromium/chrome/browser/ShortcutSource.java",
198 "org/chromium/chrome/browser/TabLoadStatus.java",
199 "org/chromium/chrome/browser/profiles/ProfileAccountManagementMetrics.java",
200 "org/chromium/chrome/browser/ssl/ConnectionSecurityLevel.java",
201 "org/chromium/chrome/browser/infobar/ActionType.java",
205 # GYP: //chrome/chrome_browser.gypi:document_tab_model_info_proto_java
206 proto_java_library("document_tab_model_info_proto_java") {
207 proto_path = "java/src/org/chromium/chrome/browser/tabmodel/document"
209 "$proto_path/document_tab_model_info.proto",
213 # GYP: //chrome/chrome_browser.gypi:resource_id_java
214 java_cpp_template("resource_id_javagen") {
216 "java/ResourceId.template",
218 package_name = "org/chromium/chrome/browser"
220 "../browser/android/resource_id.h",
224 # GYP: //chrome/chrome_tests.gypi:chrome_junit_tests
225 junit_binary("chrome_junit_tests") {
227 "junit/src/org/chromium/chrome/browser/childaccounts/ChildAccountServiceTest.java",
228 "junit/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtilsTest.java",
229 "junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java",
230 "junit/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteControllerTest.java",
231 "junit/src/org/chromium/chrome/browser/media/remote/MediaUrlResolverTest.java",
232 "junit/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfoTest.java",
233 "junit/src/org/chromium/chrome/browser/media/remote/TransportControlTest.java",
238 "//base:base_java_test_support",
239 "//base:base_junit_test_support",
240 "//sync:sync_java_test_support",
241 "//sync/android:sync_java",
242 "//third_party/junit:hamcrest",
243 "//third_party/android_tools:android_support_v7_mediarouter_java",
247 # GYP: //chrome/chrome_tests.gypi:chrome_uiautomator_tests_java
248 android_library("chrome_uiautomator_tests_java") {
250 DEPRECATED_java_in_dir = "uiautomator_tests/src"
252 "//base:base_java_test_support",
253 "//third_party/android_tools:uiautomator_java",
257 # GYP: //chrome/chrome_tests.gypi:chrome_uiautomator_tests
258 uiautomator_test("chrome_uiautomator_tests") {
261 ":chrome_uiautomator_tests_java",
265 # GYP: //chrome/chrome_android.gypi:chrome_version_java
266 chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java"
267 chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java"
268 process_version("chrome_version_java") {
269 template_file = "java/ChromeVersionConstants.java.version"
270 output = chrome_version_java_file
273 "CHANNEL=str.upper('$android_channel')",
277 zip("chrome_version_srcjar") {
279 chrome_version_java_file,
281 output = "$target_gen_dir/$target_name.srcjar"
282 base_dir = chrome_version_java_dir
284 ":chrome_version_java",
288 #GYP: //chrome/android/chrome_apk.gyp:custom_tabs_service_aidl
289 android_aidl("custom_tabs_service_aidl") {
290 import_include = "java/src/android/support/customtabs"
291 interface_file = "java/src/android/support/customtabs/common.aidl"
293 "java/src/android/support/customtabs/ICustomTabsCallback.aidl",
294 "java/src/android/support/customtabs/ICustomTabsService.aidl",
298 # GYP: //chrome/android/chrome_apk.gyp:chrome_shared_test_java
299 android_library("chrome_shared_test_java") {
301 DEPRECATED_java_in_dir = "javatests/src"
305 "//base:base_java_test_support",
306 "//chrome/android:chrome_java",
307 "//chrome/android:chrome_java_resources",
308 "//chrome/test/android:chrome_java_test_support",
309 "//components/bookmarks/common/android:bookmarks_java",
310 "//components/dom_distiller/android:dom_distiller_core_java",
311 "//components/invalidation/impl:java",
312 "//components/invalidation/impl:javatests",
313 "//components/navigation_interception/android:navigation_interception_java",
314 "//components/policy/android:policy_java",
315 "//components/precache/android:precache_java",
316 "//components/precache/android:precache_javatests",
317 "//components/web_contents_delegate_android:web_contents_delegate_android_java",
318 "//content/public/android:content_java",
319 "//content/public/test/android:content_java_test_support",
320 "//net/android:net_java",
321 "//net/android:net_java_test_support",
322 "//printing:printing_java",
323 "//sync/android:sync_java",
324 "//sync/android:sync_javatests",
325 "//sync:sync_java_test_support",
326 "//third_party/android_tools:android_support_v7_appcompat_java",
327 "//third_party/android_tools:android_support_v7_recyclerview_java",
328 "//third_party/android_tools:android_support_v13_java",
329 "//third_party/android_tools:legacy_http_javalib",
330 "//third_party/cacheinvalidation:cacheinvalidation_javalib",
331 "//third_party/jsr-305:jsr_305_javalib",
332 "//ui/android:ui_java",
333 "//ui/android:ui_javatests",
337 android_resources("chrome_public_apk_resources") {
338 resource_dirs = [ "java/res_chromium" ]
339 custom_package = "org.chromium.chrome"
342 chrome_public_apk_assets_dir = "$root_build_dir/chrome_public_apk_assets"
344 copy_ex("chrome_public_apk_assets") {
346 dest = chrome_public_apk_assets_dir
347 sources = chrome_android_paks_gypi.chrome_android_pak_input_resources
348 if (icu_use_data_file) {
349 sources += [ "$root_build_dir/icudtl.dat" ]
352 "//chrome:packed_extra_resources",
353 "//chrome:packed_resources",
354 "//third_party/icu:icudata",
357 if (v8_use_external_startup_data) {
359 "$root_build_dir/natives_blob.bin",
360 "$root_build_dir/snapshot_blob.bin",
365 sources += [ "$root_build_dir/resources.pak" ]
368 # GYP: //chrome/android/chrome_apk.gyp:chrome_apk_manifest
369 jinja_template("chrome_public_apk_manifest") {
370 input = "java/AndroidManifest.xml"
371 output = "$root_gen_dir/chrome_public_apk_manifest/AndroidManifest.xml"
372 variables = jinja_variables
374 "min_sdk_version=16",
375 "target_sdk_version=23",
379 # GYP: //chrome/android/chrome_apk.gyp:chrome_public_template_resources
380 jinja_template_resources("chrome_public_template_resources") {
382 "java/res_template/xml/searchable.xml",
383 "java/res_template/xml/syncadapter.xml",
385 res_dir = "java/res_template"
386 variables = jinja_variables
389 # GYP: //chrome/android/chrome_apk.gyp:libchrome_public
390 shared_library("chrome_public") {
392 "//build/config/sanitizers:deps",
393 "//chrome:chrome_android_core",
395 gypi_values = exec_script(
396 "//build/gypi_to_gn.py",
398 rebase_path("chrome_apk.gyp"),
399 "--replace=<(chrome_native_sources_dir)=../browser/android/",
402 [ "chrome_apk.gyp" ])
403 sources = gypi_values.chrome_public_app_native_sources
406 #'target_conditions': [
407 #['component != "shared_library"', {
408 #'product_extension': '<(version_libchrome_short).so',
413 android_apk("chrome_public_apk") {
414 version_name = "Developer Build"
416 android_manifest = get_target_outputs(":chrome_public_apk_manifest")
417 android_manifest = android_manifest[1]
418 apk_name = "ChromePublic"
419 native_libs = [ "$root_build_dir/lib.stripped/libchrome_public.so" ]
420 native_lib_version_rule = "//build/util:chrome_version_json"
422 rebase_path("$root_gen_dir/CHROME_VERSION.json", root_out_dir)
423 native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)"
424 asset_location = chrome_public_apk_assets_dir
428 ":chrome_java_resources",
430 ":chrome_public_apk_assets",
431 ":chrome_public_apk_manifest",
432 ":chrome_public_apk_resources",
433 ":chrome_public_template_resources",
435 google_play_services_resources,
439 chrome_public_test_apk_manifest =
440 "$root_gen_dir/chrome_public_test_apk_manifest/AndroidManifest.xml"
442 # GYP: //chrome/android/chrome_apk.gyp:chrome_public_test_apk_manifest
443 jinja_template("chrome_public_test_apk_manifest") {
444 input = "javatests/AndroidManifest.xml"
445 output = chrome_public_test_apk_manifest
446 variables = jinja_variables
449 # GYP: //chrome/android/chrome_apk.gyp:chrome_public_test_apk
450 instrumentation_test_apk("chrome_public_test_apk") {
451 # TODO(GYP,cjhopman): Does this need version code/name?
452 apk_name = "ChromePublicTest"
453 apk_under_test = ":chrome_public_apk"
454 android_manifest = chrome_public_test_apk_manifest
456 ":chrome_public_test_apk_manifest",
457 "//chrome/android:chrome_shared_test_java",
459 isolate_file = "../chrome_public_test_apk.isolate"