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") {
48 "//chrome/android/java/res_chromium",
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/externalauth/ExternalAuthUtilsTest.java",
228 "junit/src/org/chromium/chrome/browser/omaha/ResponseParserTest.java",
229 "junit/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteControllerTest.java",
230 "junit/src/org/chromium/chrome/browser/media/remote/MediaUrlResolverTest.java",
231 "junit/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfoTest.java",
232 "junit/src/org/chromium/chrome/browser/media/remote/TransportControlTest.java",
237 "//base:base_java_test_support",
238 "//base:base_junit_test_support",
239 "//sync:sync_java_test_support",
240 "//sync/android:sync_java",
241 "//third_party/junit:hamcrest",
242 "//third_party/android_tools:android_support_v7_mediarouter_java",
246 # GYP: //chrome/chrome_tests.gypi:chrome_uiautomator_tests_java
247 android_library("chrome_uiautomator_tests_java") {
249 DEPRECATED_java_in_dir = "uiautomator_tests/src"
251 "//base:base_java_test_support",
252 "//third_party/android_tools:uiautomator_java",
256 # GYP: //chrome/chrome_tests.gypi:chrome_uiautomator_tests
257 uiautomator_test("chrome_uiautomator_tests") {
260 ":chrome_uiautomator_tests_java",
264 # GYP: //chrome/chrome_android.gypi:chrome_version_java
265 chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java"
266 chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java"
267 process_version("chrome_version_java") {
268 template_file = "java/ChromeVersionConstants.java.version"
269 output = chrome_version_java_file
272 "CHANNEL=str.upper('$android_channel')",
276 zip("chrome_version_srcjar") {
278 chrome_version_java_file,
280 output = "$target_gen_dir/$target_name.srcjar"
281 base_dir = chrome_version_java_dir
283 ":chrome_version_java",
287 #GYP: //chrome/android/chrome_apk.gyp:custom_tabs_service_aidl
288 android_aidl("custom_tabs_service_aidl") {
289 import_include = "java/src/android/support/customtabs"
290 interface_file = "java/src/android/support/customtabs/common.aidl"
292 "java/src/android/support/customtabs/ICustomTabsCallback.aidl",
293 "java/src/android/support/customtabs/ICustomTabsService.aidl",
297 # GYP: //chrome/android/chrome_apk.gyp:chrome_shared_test_java
298 android_library("chrome_shared_test_java") {
300 DEPRECATED_java_in_dir = "javatests/src"
304 "//base:base_java_test_support",
305 "//chrome/android:chrome_java",
306 "//chrome/android:chrome_java_resources",
307 "//chrome/test/android:chrome_java_test_support",
308 "//components/bookmarks/common/android:bookmarks_java",
309 "//components/dom_distiller/android:dom_distiller_core_java",
310 "//components/invalidation/impl:java",
311 "//components/invalidation/impl:javatests",
312 "//components/navigation_interception/android:navigation_interception_java",
313 "//components/policy/android:policy_java",
314 "//components/precache/android:precache_java",
315 "//components/precache/android:precache_javatests",
316 "//components/web_contents_delegate_android:web_contents_delegate_android_java",
317 "//content/public/android:content_java",
318 "//content/public/test/android:content_java_test_support",
319 "//net/android:net_java",
320 "//net/android:net_java_test_support",
321 "//printing:printing_java",
322 "//sync/android:sync_java",
323 "//sync/android:sync_javatests",
324 "//sync:sync_java_test_support",
325 "//third_party/android_tools:android_support_v7_appcompat_java",
326 "//third_party/android_tools:android_support_v7_recyclerview_java",
327 "//third_party/android_tools:android_support_v13_java",
328 "//third_party/android_tools:legacy_http_javalib",
329 "//third_party/cacheinvalidation:cacheinvalidation_javalib",
330 "//third_party/jsr-305:jsr_305_javalib",
331 "//ui/android:ui_java",
332 "//ui/android:ui_javatests",
336 # Overrides icon / name defined in chrome_java_resources.
337 android_resources("chrome_public_apk_resources") {
338 resource_dirs = [ "java/res_chromium" ]
340 # Dep needed to ensure override works properly.
342 ":chrome_java_resources",
346 chrome_public_apk_assets_dir = "$root_build_dir/chrome_public_apk_assets"
348 copy_ex("chrome_public_apk_assets") {
350 dest = chrome_public_apk_assets_dir
351 sources = chrome_android_paks_gypi.chrome_android_pak_input_resources
352 if (icu_use_data_file) {
353 sources += [ "$root_build_dir/icudtl.dat" ]
356 "//chrome:packed_extra_resources",
357 "//chrome:packed_resources",
358 "//third_party/icu:icudata",
361 if (v8_use_external_startup_data) {
363 "$root_build_dir/natives_blob.bin",
364 "$root_build_dir/snapshot_blob.bin",
369 sources += [ "$root_build_dir/resources.pak" ]
372 # GYP: //chrome/android/chrome_apk.gyp:chrome_apk_manifest
373 jinja_template("chrome_public_apk_manifest") {
374 input = "java/AndroidManifest.xml"
375 output = "$root_gen_dir/chrome_public_apk_manifest/AndroidManifest.xml"
376 variables = jinja_variables
378 "min_sdk_version=16",
379 "target_sdk_version=23",
383 # GYP: //chrome/android/chrome_apk.gyp:chrome_public_template_resources
384 jinja_template_resources("chrome_public_template_resources") {
386 "java/res_template/xml/searchable.xml",
387 "java/res_template/xml/syncadapter.xml",
389 res_dir = "java/res_template"
390 variables = jinja_variables
393 # GYP: //chrome/android/chrome_apk.gyp:libchrome_public
394 shared_library("chrome_public") {
396 "//build/config/sanitizers:deps",
397 "//chrome:chrome_android_core",
399 gypi_values = exec_script(
400 "//build/gypi_to_gn.py",
402 rebase_path("chrome_apk.gyp"),
403 "--replace=<(chrome_native_sources_dir)=../browser/android/",
406 [ "chrome_apk.gyp" ])
407 sources = gypi_values.chrome_public_app_native_sources
410 #'target_conditions': [
411 #['component != "shared_library"', {
412 #'product_extension': '<(version_libchrome_short).so',
417 android_apk("chrome_public_apk") {
418 version_name = "Developer Build"
420 android_manifest = get_target_outputs(":chrome_public_apk_manifest")
421 android_manifest = android_manifest[1]
422 apk_name = "ChromePublic"
423 native_libs = [ "$root_build_dir/lib.stripped/libchrome_public.so" ]
424 native_lib_version_rule = "//build/util:chrome_version_json"
426 rebase_path("$root_gen_dir/CHROME_VERSION.json", root_out_dir)
427 native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)"
428 asset_location = chrome_public_apk_assets_dir
433 ":chrome_public_apk_assets",
434 ":chrome_public_apk_manifest",
435 ":chrome_public_apk_resources",
436 ":chrome_public_template_resources",
438 google_play_services_resources,
442 chrome_public_test_apk_manifest =
443 "$root_gen_dir/chrome_public_test_apk_manifest/AndroidManifest.xml"
445 # GYP: //chrome/android/chrome_apk.gyp:chrome_public_test_apk_manifest
446 jinja_template("chrome_public_test_apk_manifest") {
447 input = "javatests/AndroidManifest.xml"
448 output = chrome_public_test_apk_manifest
449 variables = jinja_variables
452 # GYP: //chrome/android/chrome_apk.gyp:chrome_public_test_apk
453 instrumentation_test_apk("chrome_public_test_apk") {
454 # TODO(GYP,cjhopman): Does this need version code/name?
455 apk_name = "ChromePublicTest"
456 apk_under_test = ":chrome_public_apk"
457 android_manifest = chrome_public_test_apk_manifest
459 ":chrome_public_test_apk_manifest",
460 "//chrome/android:chrome_shared_test_java",
462 isolate_file = "../chrome_public_test_apk.isolate"