Upstream oodles of Chrome for Android code into Chromium.
[chromium-blink-merge.git] / chrome / android / chrome_apk.gyp
bloba0a0d75ef7a2e3d4ab1280fba932ed4bae19d903
1 # Copyright 2015 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   'includes': [
6     '../../chrome/chrome_android_paks.gypi', # Included for the list of pak resources.
7     '../../build/util/version.gypi'
8    ],
9   'variables': {
10     'chromium_code': 1,
11     'package_name': 'chrome_public_apk',
12     'manifest_package%': 'org.chromium.chrome',
13     'chrome_public_apk_manifest': '<(SHARED_INTERMEDIATE_DIR)/chrome_public_apk_manifest/AndroidManifest.xml',
14     'chrome_public_test_apk_manifest': '<(SHARED_INTERMEDIATE_DIR)/chrome_public_test_apk_manifest/AndroidManifest.xml',
15     'never_lint': 1,
16     'chrome_java_dir': 'java_staging',
17     'chrome_java_tests_dir': 'javatests',
18     'chrome_java_test_support_dir': '../test/android/javatests_staging',
19     'chrome_native_sources_dir': '../browser/android/',
20     # This list is shared with GN.
21     'chrome_staging_jni_files': [
22       '<(chrome_java_dir)/src/org/chromium/chrome/browser/bookmark/EditBookmarkHelper.java',
23       '<(chrome_java_dir)/src/org/chromium/chrome/browser/compositor/CompositorView.java',
24       '<(chrome_java_dir)/src/org/chromium/chrome/browser/compositor/scene_layer/ContextualSearchSceneLayer.java',
25       '<(chrome_java_dir)/src/org/chromium/chrome/browser/compositor/scene_layer/ReaderModeSceneLayer.java',
26       '<(chrome_java_dir)/src/org/chromium/chrome/browser/compositor/scene_layer/TabListSceneLayer.java',
27       '<(chrome_java_dir)/src/org/chromium/chrome/browser/compositor/scene_layer/TabStripSceneLayer.java',
28       '<(chrome_java_dir)/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java',
29       '<(chrome_java_dir)/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTabHelper.java',
30       '<(chrome_java_dir)/src/org/chromium/chrome/browser/document/DocumentWebContentsDelegate.java',
31       '<(chrome_java_dir)/src/org/chromium/chrome/browser/historyreport/HistoryReportJniBridge.java',
32       '<(chrome_java_dir)/src/org/chromium/chrome/browser/policy/PolicyManager.java',
33       '<(chrome_java_dir)/src/org/chromium/chrome/browser/rlz/RevenueStats.java',
34       '<(chrome_java_dir)/src/org/chromium/chrome/browser/tab/BackgroundContentViewHelper.java',
35       '<(chrome_java_dir)/src/org/chromium/chrome/browser/tab/ThumbnailTabHelper.java',
36     ],
37     # This list is shared with GN.
38     'chrome_staging_native_sources': [
39       '<(chrome_native_sources_dir)/bookmark/edit_bookmark_helper.cc',
40       '<(chrome_native_sources_dir)/bookmark/edit_bookmark_helper.h',
41       '<(chrome_native_sources_dir)/chrome_main_delegate_staging_android.cc',
42       '<(chrome_native_sources_dir)/chrome_main_delegate_staging_android.h',
43       '<(chrome_native_sources_dir)/compositor/compositor_view.cc',
44       '<(chrome_native_sources_dir)/compositor/compositor_view.h',
45       '<(chrome_native_sources_dir)/compositor/layer/reader_mode_layer.cc',
46       '<(chrome_native_sources_dir)/compositor/layer/reader_mode_layer.h',
47       '<(chrome_native_sources_dir)/compositor/layer/tab_handle_layer.cc',
48       '<(chrome_native_sources_dir)/compositor/layer/tab_handle_layer.h',
49       '<(chrome_native_sources_dir)/compositor/scene_layer/contextual_search_scene_layer.cc',
50       '<(chrome_native_sources_dir)/compositor/scene_layer/contextual_search_scene_layer.h',
51       '<(chrome_native_sources_dir)/compositor/scene_layer/reader_mode_scene_layer.cc',
52       '<(chrome_native_sources_dir)/compositor/scene_layer/reader_mode_scene_layer.h',
53       '<(chrome_native_sources_dir)/compositor/scene_layer/tab_list_scene_layer.cc',
54       '<(chrome_native_sources_dir)/compositor/scene_layer/tab_list_scene_layer.h',
55       '<(chrome_native_sources_dir)/compositor/scene_layer/tab_strip_scene_layer.cc',
56       '<(chrome_native_sources_dir)/compositor/scene_layer/tab_strip_scene_layer.h',
57       '<(chrome_native_sources_dir)/contextualsearch/contextual_search_context.cc',
58       '<(chrome_native_sources_dir)/contextualsearch/contextual_search_context.h',
59       '<(chrome_native_sources_dir)/contextualsearch/contextual_search_delegate.cc',
60       '<(chrome_native_sources_dir)/contextualsearch/contextual_search_delegate.h',
61       '<(chrome_native_sources_dir)/contextualsearch/contextual_search_manager.cc',
62       '<(chrome_native_sources_dir)/contextualsearch/contextual_search_manager.h',
63       '<(chrome_native_sources_dir)/contextualsearch/contextual_search_tab_helper.cc',
64       '<(chrome_native_sources_dir)/contextualsearch/contextual_search_tab_helper.h',
65       '<(chrome_native_sources_dir)/document/document_web_contents_delegate.cc',
66       '<(chrome_native_sources_dir)/history_report/data_observer.cc',
67       '<(chrome_native_sources_dir)/history_report/data_observer.h',
68       '<(chrome_native_sources_dir)/history_report/data_provider.cc',
69       '<(chrome_native_sources_dir)/history_report/data_provider.h',
70       '<(chrome_native_sources_dir)/history_report/delta_file_backend_leveldb.cc',
71       '<(chrome_native_sources_dir)/history_report/delta_file_backend_leveldb.h',
72       '<(chrome_native_sources_dir)/history_report/delta_file_commons.cc',
73       '<(chrome_native_sources_dir)/history_report/delta_file_commons.h',
74       '<(chrome_native_sources_dir)/history_report/delta_file_service.cc',
75       '<(chrome_native_sources_dir)/history_report/delta_file_service.h',
76       '<(chrome_native_sources_dir)/history_report/get_all_urls_from_history_task.cc',
77       '<(chrome_native_sources_dir)/history_report/get_all_urls_from_hisotry_task.h',
78       '<(chrome_native_sources_dir)/history_report/historic_visits_migration_task.cc',
79       '<(chrome_native_sources_dir)/history_report/historic_visits_migration_task.h',
80       '<(chrome_native_sources_dir)/history_report/history_report_jni_bridge.cc',
81       '<(chrome_native_sources_dir)/history_report/history_report_jni_bridge.h',
82       '<(chrome_native_sources_dir)/history_report/usage_report_util.cc',
83       '<(chrome_native_sources_dir)/history_report/usage_report_util.h',
84       '<(chrome_native_sources_dir)/history_report/usage_reports_buffer_backend.cc',
85       '<(chrome_native_sources_dir)/history_report/usage_reports_buffer_backend.h',
86       '<(chrome_native_sources_dir)/history_report/usage_reports_buffer_service.cc',
87       '<(chrome_native_sources_dir)/history_report/usage_reports_buffer_service.h',
88       '<(chrome_native_sources_dir)/policy/policy_manager.cc',
89       '<(chrome_native_sources_dir)/policy/policy_manager.h',
90       '<(chrome_native_sources_dir)/proto/client_discourse_context.proto',
91       '<(chrome_native_sources_dir)/proto/delta_file.proto',
92       '<(chrome_native_sources_dir)/rlz/revenue_stats.cc',
93       '<(chrome_native_sources_dir)/rlz/revenue_stats.h',
94       '<(chrome_native_sources_dir)/staging_jni_registrar.cc',
95       '<(chrome_native_sources_dir)/staging_jni_registrar.h',
96       '<(chrome_native_sources_dir)/tab/background_content_view_helper.cc',
97       '<(chrome_native_sources_dir)/tab/background_content_view_helper.h',
98       '<(chrome_native_sources_dir)/tab/thumbnail_tab_helper_android.cc',
99       '<(chrome_native_sources_dir)/tab/thumbnail_tab_helper_android.h',
100     ],
101     # This list is shared with GN.
102     # Defines a list of source files should be present in the open-source
103     # chrome-apk but not in the published static_library which is included in the
104     # real chrome for android.
105     'chrome_public_app_native_sources': [
106       '<(chrome_native_sources_dir)/chrome_entry_point.cc',
107       '<(chrome_native_sources_dir)/chrome_main_delegate_staging_android_initializer.cc',
108       '<(chrome_native_sources_dir)/chrome_staging_jni_onload.cc',
109       '<(chrome_native_sources_dir)/chrome_staging_jni_onload.h',
110     ],
111   },
112   'targets': [
113     {
114       # GN: //chrome/browser/android:chrome_staging
115       'target_name': 'libchrome_staging',
116       'type': 'static_library',
117       'dependencies': [
118         'staging_jni_headers',
119         '<(DEPTH)/chrome/chrome.gyp:browser',
120         '<(DEPTH)/components/components.gyp:component_metrics_proto',
121         '<(DEPTH)/skia/skia.gyp:skia',
122         '<(DEPTH)/third_party/leveldatabase/leveldatabase.gyp:leveldatabase',
123       ],
124       'sources': [
125         '<@(chrome_staging_native_sources)',
126       ],
127       'include_dirs': [
128         '<(DEPTH)',
129         '<(SHARED_INTERMEDIATE_DIR)/staging/android',
130         '<(android_ndk_include)',  # For native_window.h, GL includes, etc.
131         '<(DEPTH)/skia/config',
132       ],
133       'link_settings': {
134         'libraries': [
135           '-landroid',      # ANativeWindow
136           '-ljnigraphics',  # NDK access to bitmap
137         ],
138       },
139       'conditions': [
140         ['safe_browsing!=0', {
141           'sources': [
142             '<(chrome_native_sources_dir)/spdy_proxy_resource_throttle.cc',
143             '<(chrome_native_sources_dir)/spdy_proxy_resource_throttle.h',
144           ],
145         }],
146       ],
147       'variables': {
148         'proto_in_dir': '<(chrome_native_sources_dir)/proto',
149         'proto_out_dir': 'chrome/browser/android/proto',
150       },
151       'includes': [ '../../build/protoc.gypi', ],
152     },
153     {
154       # GN: //chrome/android:staging_jni_headers
155       'target_name': 'staging_jni_headers',
156       'type': 'none',
157       'sources': [
158         '<@(chrome_staging_jni_files)',
159       ],
160       'variables': {
161         'jni_gen_package': 'staging/android',
162       },
163       'includes': [ '../../build/jni_generator.gypi' ],
164     },
165     {
166       # GN: //chrome/android:chrome_staging_java
167       'target_name': 'chrome_staging_java',
168       'type': 'none',
169       'variables': {
170         'java_in_dir': '<(chrome_java_dir)',
171         'R_package': 'com.google.android.apps.chrome',
172         'R_package_relpath': 'com/google/android/apps/chrome',
173         'has_java_resources': 1,
174         'res_channel_dir': '<(chrome_java_dir)/res_default',
175         'res_extra_dirs': ['<(res_channel_dir)'],
176         'res_extra_files': ['<!@(find <(res_channel_dir) -type f)'],
177       },
178       'dependencies': [
179         # Listed first to ensure that it overrides public strings.
180         'chrome_staging_strings_grd',
181         'chrome_template_resources',
182         'hosted_service_aidl',
183         '<(DEPTH)/base/base.gyp:base_java',
184         '<(DEPTH)/chrome/chrome.gyp:chrome_java',
185         '<(DEPTH)/chrome/chrome.gyp:document_tab_model_info_proto_java',
186         '<(DEPTH)/components/components.gyp:app_restrictions_resources',
187         '<(DEPTH)/components/components.gyp:navigation_interception_java',
188         '<(DEPTH)/components/components.gyp:service_tab_launcher',
189         '<(DEPTH)/components/components.gyp:web_contents_delegate_android_java',
190         '<(DEPTH)/content/content.gyp:content_java',
191         '<(DEPTH)/media/media.gyp:media_java',
192         '<(DEPTH)/net/net.gyp:net_java',
193         '<(DEPTH)/third_party/android_protobuf/android_protobuf.gyp:protobuf_nano_javalib',
194         '<(DEPTH)/third_party/android_tools/android_tools.gyp:android_support_v13_javalib',
195         '<(DEPTH)/third_party/android_tools/android_tools.gyp:android_support_v7_appcompat_javalib',
196         '<(DEPTH)/third_party/android_tools/android_tools.gyp:android_support_v7_mediarouter_javalib',
197         '<(DEPTH)/third_party/android_tools/android_tools.gyp:android_support_v7_recyclerview_javalib',
198         '<(DEPTH)/third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_javalib',
199         '<(DEPTH)/third_party/jsr-305/jsr-305.gyp:jsr_305_javalib',
200         '<(DEPTH)/ui/android/ui_android.gyp:ui_java',
201       ],
202       'conditions': [
203         ['configuration_policy != 1', {
204           'dependencies!': [
205             '<(DEPTH)/components/components.gyp:app_restrictions_resources',
206           ],
207         }],
208       ],
209       'includes': [ '../../build/java.gypi' ],
210     },
211     {
212       'target_name': 'chrome_staging_strings_grd',
213       'type': 'none',
214       'variables': {
215         'grd_file': '<(chrome_java_dir)/strings/android_strings.grd',
216       },
217       'includes': [ '../../build/java_strings_grd.gypi' ],
218     },
219     {
220       # GN: //chrome/android:chrome_staging_test_support_java
221       'target_name': 'chrome_staging_test_support_java',
222       'type': 'none',
223       'variables': {
224           'java_in_dir': '<(chrome_java_test_support_dir)',
225       },
226       'dependencies': [
227         'chrome_staging_java',
228         '<(DEPTH)/base/base.gyp:base_java',
229         '<(DEPTH)/base/base.gyp:base_java_test_support',
230         '<(DEPTH)/chrome/chrome.gyp:chrome_java',
231         '<(DEPTH)/chrome/chrome.gyp:chrome_java_test_support',
232         '<(DEPTH)/content/content_shell_and_tests.gyp:content_java_test_support',
233         '<(DEPTH)/net/net.gyp:net_java',
234         '<(DEPTH)/net/net.gyp:net_java_test_support',
235         '<(DEPTH)/sync/sync.gyp:sync_java_test_support',
236       ],
237       'includes': [ '../../build/java.gypi' ],
238     },
239     {
240       'target_name': 'chrome_template_resources',
241       'type': 'none',
242       'variables': {
243         'jinja_inputs_base_dir': '<(chrome_java_dir)/res_template',
244         'jinja_inputs': [
245           '<(jinja_inputs_base_dir)/xml/searchable.xml',
246           '<(jinja_inputs_base_dir)/xml/syncadapter.xml',
247         ],
248         'jinja_outputs_zip': '<(PRODUCT_DIR)/res.java/<(_target_name).zip',
249         'jinja_variables': [
250           'manifest_package=<(manifest_package)',
251         ],
252       },
253       'all_dependent_settings': {
254         'variables': {
255           'additional_input_paths': ['<(jinja_outputs_zip)'],
256           'dependencies_res_zip_paths': ['<(jinja_outputs_zip)'],
257         },
258       },
259       'includes': [ '../../build/android/jinja_template.gypi' ],
260     },
261     {
262       'target_name': 'hosted_service_aidl',
263       'type': 'none',
264       'variables': {
265         'aidl_interface_file': '<(chrome_java_dir)/src/org/chromium/chrome/browser/hosted/common.aidl',
266         'aidl_import_include': '<(chrome_java_dir)/src/org/chromium/chrome/browser/hosted',
267       },
268       'sources': [
269         '<(chrome_java_dir)/src/org/chromium/chrome/browser/hosted/IBrowserConnectionCallback.aidl',
270         '<(chrome_java_dir)/src/org/chromium/chrome/browser/hosted/IBrowserConnectionService.aidl',
271       ],
272       'includes': [ '../../build/java_aidl.gypi' ],
273     },
274     {
275       # GN: TODO
276       'target_name': 'libchrome_public',
277       'type': 'shared_library',
278       'dependencies': [
279         'libchrome_staging',
280         '<(DEPTH)/chrome/chrome.gyp:chrome_android_core',
281       ],
282       'include_dirs': [
283         '<(DEPTH)',
284       ],
285       'sources': [
286         '<@(chrome_public_app_native_sources)',
287       ],
288       'ldflags': [
289         # Some android targets still depend on --gc-sections to link.
290         # TODO: remove --gc-sections for Debug builds (crbug.com/159847).
291         '-Wl,--gc-sections',
292       ],
293       'conditions': [
294         # TODO(yfriedman): move this DEP to chrome_android_core to be shared
295         # between internal/external.
296         ['cld_version==2', {
297           'dependencies': [
298             '<(DEPTH)/third_party/cld_2/cld_2.gyp:cld2_dynamic',
299           ],
300         }],
301         # conditions for order_text_section
302         # Cygprofile methods need to be linked into the instrumented build.
303         ['order_profiling!=0', {
304           'conditions': [
305             ['OS=="android"', {
306               'dependencies': [ '<(DEPTH)/tools/cygprofile/cygprofile.gyp:cygprofile' ],
307             }],
308           ],
309         }],  # order_profiling!=0
310         ['use_allocator!="none"', {
311           'dependencies': [
312             '<(DEPTH)/base/allocator/allocator.gyp:allocator',
313           ],
314         }],
315       ],
316     },
317     {
318       'target_name': 'chrome_public_manifest',
319       'type': 'none',
320       'variables': {
321         'jinja_inputs': ['<(chrome_java_dir)/AndroidManifest.xml'],
322         'jinja_output': '<(chrome_public_apk_manifest)',
323         'jinja_variables': [
324           'channel=<(android_channel)',
325           'configuration_policy=<(configuration_policy)',
326           'manifest_package=<(manifest_package)',
327           'min_sdk_version=16',
328         ],
329       },
330       'includes': [ '../../build/android/jinja_template.gypi' ],
331     },
332     {
333       'target_name': 'chrome_public_apk',
334       'type': 'none',
335       'variables': {
336         'android_manifest_path': '<(chrome_public_apk_manifest)',
337         'apk_name': 'ChromePublic',
338         'native_lib_target': 'libchrome_public',
339         'java_in_dir': '<(chrome_java_dir)',
340         'conditions': [
341           # Only attempt loading the library from the APK for 64 bit devices
342           # until the number of 32 bit devices which don't support this
343           # approach falls to a minimal level -  http://crbug.com/390618.
344           ['component != "shared_library" and profiling==0 and (target_arch == "arm64" or target_arch == "x86_64")', {
345             'load_library_from_zip_file': '<(chrome_apk_load_library_from_zip)',
346             'load_library_from_zip': '<(chrome_apk_load_library_from_zip)',
347           }],
348         ],
349       },
350       'dependencies': [
351         'chrome_android_paks_copy',
352         'chrome_staging_java',
353       ],
354       'includes': [ 'chrome_apk.gypi' ],
355     },
356     {
357       # GN: N/A
358       # chrome_public_apk creates a .jar as a side effect. Any java targets
359       # that need that .jar in their classpath should depend on this target,
360       'target_name': 'chrome_public_apk_java',
361       'type': 'none',
362       'dependencies': [
363         'chrome_public_apk',
364       ],
365       'includes': [ '../../build/apk_fake_jar.gypi' ],
366     },
367     {
368       # GN: //chrome/browser/android:chrome_staging_unittests
369       'target_name': 'chrome_staging_unittests',
370       'type': 'static_library',
371       'sources': [
372         '<(chrome_native_sources_dir)/contextualsearch/contextual_search_delegate_unittest.cc',
373         '<(chrome_native_sources_dir)/history_report/delta_file_commons_unittest.cc',
374         '<(chrome_native_sources_dir)/history_report/delta_file_backend_leveldb_unittest.cc',
375         '<(chrome_native_sources_dir)/history_report/usage_reports_buffer_backend_unittest.cc',
376         '<(chrome_native_sources_dir)/policy/policy_manager_unittest.cc',
377       ],
378       'dependencies': [
379         'libchrome_staging',
380         '<(DEPTH)/base/base.gyp:base_java',
381         '<(DEPTH)/chrome/chrome.gyp:chrome_java',
382         '<(DEPTH)/chrome/chrome.gyp:test_support_unit',
383         '<(DEPTH)/net/net.gyp:net_test_support',
384         '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
385         '<(DEPTH)/testing/gtest.gyp:gtest',
386       ],
387        'include_dirs': [
388         '<(DEPTH)',
389       ],
390     },
391     {
392       # GN: None.
393       # This target is for sharing tests between both upstream and internal
394       # trees until sufficient test coverage is upstream.
395       'target_name': 'chrome_shared_test_java',
396       'type': 'none',
397       'variables': {
398         'java_in_dir': '<(chrome_java_tests_dir)',
399       },
400       'dependencies': [
401         'chrome_staging_java',
402         'chrome_staging_test_support_java',
403         '<(DEPTH)/base/base.gyp:base_java',
404         '<(DEPTH)/base/base.gyp:base_java_test_support',
405         '<(DEPTH)/chrome/chrome.gyp:chrome_java',
406         '<(DEPTH)/chrome/chrome.gyp:chrome_java_test_support',
407         '<(DEPTH)/components/components.gyp:web_contents_delegate_android_java',
408         '<(DEPTH)/content/content_shell_and_tests.gyp:content_java_test_support',
409         '<(DEPTH)/net/net.gyp:net_java',
410         '<(DEPTH)/net/net.gyp:net_java_test_support',
411         '<(DEPTH)/sync/sync.gyp:sync_java_test_support',
412         '<(DEPTH)/third_party/android_tools/android_tools.gyp:android_support_v7_appcompat_javalib',
413       ],
414       'includes': [ '../../build/java.gypi' ],
415     },
416     {
417       # GN: None. This will most likely be merged with chrome_shell before GN is
418       # done.
419       'target_name': 'chrome_public_test_apk_manifest',
420       'type': 'none',
421       'variables': {
422         'jinja_inputs': ['<(chrome_java_tests_dir)/AndroidManifest.xml'],
423         'jinja_output': '<(chrome_public_test_apk_manifest)',
424         'jinja_variables': [
425           'manifest_package=<(manifest_package)',
426         ],
427       },
428       'includes': [ '../../build/android/jinja_template.gypi' ],
429     },
430     {
431       # GN: None. This will most likely be merged with chrome_shell before GN is
432       # done.
433       'target_name': 'chrome_public_test_apk',
434       'type': 'none',
435       'dependencies': [
436         'chrome_shared_test_java',
437         'chrome_public_apk_java',
438       ],
439       'variables': {
440         'android_manifest_path': '<(chrome_public_test_apk_manifest)',
441         'package_name': 'chrome_public_test',
442         'java_in_dir': '<(chrome_java_tests_dir)',
443         'java_in_dir_suffix': '/src_dummy',
444         'apk_name': 'ChromePublicTest',
445         'is_test_apk': 1,
446       },
447       'includes': [ '../../build/java_apk.gypi' ],
448     },
449   ],
452 # Local Variables:
453 # tab-width:2
454 # indent-tabs-mode:nil
455 # End:
456 # vim: set expandtab tabstop=2 shiftwidth=2: