athena: Re-add ui_chromeos resources in athena_resources.pak.
[chromium-blink-merge.git] / components / cronet.gypi
blob2915571048214d81b8f9edb058752c31683c068c
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.
6   'conditions': [
7     ['OS=="android" and use_icu_alternatives_on_android==1', {
8       # TODO(mef): Figure out what needs to be done for gn script.
9       'targets': [
10         {
11           'target_name': 'cronet_jni_headers',
12           'type': 'none',
13           'sources': [
14             'cronet/android/java/src/org/chromium/net/UrlRequest.java',
15             'cronet/android/java/src/org/chromium/net/UrlRequestContext.java',
16           ],
17           'variables': {
18             'jni_gen_package': 'cronet',
19           },
20           'includes': [ '../build/jni_generator.gypi' ],
21         },
22         {
23           'target_name': 'cronet_url_request_error_list',
24           'type': 'none',
25           'sources': [
26             'cronet/android/java/src/org/chromium/net/UrlRequestError.template',
27           ],
28           'variables': {
29             'package_name': 'org/chromium/cronet',
30             'template_deps': ['cronet/android/org_chromium_net_UrlRequest_error_list.h'],
31           },
32           'includes': [ '../build/android/java_cpp_template.gypi' ],
33         },
34         {
35           'target_name': 'cronet_url_request_priority_list',
36           'type': 'none',
37           'sources': [
38             'cronet/android/java/src/org/chromium/net/UrlRequestPriority.template',
39           ],
40           'variables': {
41             'package_name': 'org/chromium/cronet',
42             'template_deps': ['cronet/android/org_chromium_net_UrlRequest_priority_list.h'],
43           },
44           'includes': [ '../build/android/java_cpp_template.gypi' ],
45         },
46         {
47           'target_name': 'cronet_url_request_context_config_list',
48           'type': 'none',
49           'sources': [
50             'cronet/android/java/src/org/chromium/net/UrlRequestContextConfig.template',
51           ],
52           'variables': {
53             'package_name': 'org/chromium/cronet',
54             'template_deps': ['cronet/url_request_context_config_list.h'],
55           },
56           'includes': [ '../build/android/java_cpp_template.gypi' ],
57         },
58         {
59           'target_name': 'cronet_version',
60           'type': 'none',
61           # Because cronet_version generates a header, we must set the
62           # hard_dependency flag.
63           'hard_dependency': 1,
64           'actions': [
65             {
66               'action_name': 'cronet_version',
67               'variables': {
68                 'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
69                 'version_py_path': '<(DEPTH)/build/util/version.py',
70                 'version_path': '<(DEPTH)/chrome/VERSION',
71                 'template_input_path': 'cronet/android/java/src/org/chromium/net/Version.template',
72               },
73               'inputs': [
74                 '<(template_input_path)',
75                 '<(version_path)',
76                 '<(lastchange_path)',
77               ],
78               'outputs': [
79                 '<(SHARED_INTERMEDIATE_DIR)/templates/org/chromium/cronet/Version.java',
80               ],
81               'action': [
82                 'python',
83                 '<(version_py_path)',
84                 '-f', '<(version_path)',
85                 '-f', '<(lastchange_path)',
86                 '<(template_input_path)',
87                 '<@(_outputs)',
88               ],
89               'message': 'Generating version information',
90             },
91           ],
92         },
93         {
94           'target_name': 'libcronet',
95           'type': 'shared_library',
96           'dependencies': [
97             '../base/base.gyp:base',
98             '../base/base.gyp:base_i18n',
99             '../third_party/icu/icu.gyp:icui18n',
100             '../third_party/icu/icu.gyp:icuuc',
101             '../url/url.gyp:url_lib',
102             'cronet_jni_headers',
103             'cronet_url_request_context_config_list',
104             'cronet_url_request_error_list',
105             'cronet_url_request_priority_list',
106             'cronet_version',
107             '../net/net.gyp:net',
108           ],
109           'sources': [
110             'cronet/url_request_context_config.cc',
111             'cronet/url_request_context_config.h',
112             'cronet/url_request_context_config_list.h',
113             'cronet/android/cronet_jni.cc',
114             'cronet/android/org_chromium_net_UrlRequest.cc',
115             'cronet/android/org_chromium_net_UrlRequest.h',
116             'cronet/android/org_chromium_net_UrlRequest_error_list.h',
117             'cronet/android/org_chromium_net_UrlRequest_priority_list.h',
118             'cronet/android/org_chromium_net_UrlRequestContext.cc',
119             'cronet/android/org_chromium_net_UrlRequestContext.h',
120             'cronet/android/org_chromium_net_UrlRequestContext_config_list.h',
121             'cronet/android/url_request_context_peer.cc',
122             'cronet/android/url_request_context_peer.h',
123             'cronet/android/url_request_peer.cc',
124             'cronet/android/url_request_peer.h',
125             'cronet/android/wrapped_channel_upload_element_reader.cc',
126             'cronet/android/wrapped_channel_upload_element_reader.h',
127           ],
128           'cflags': [
129             '-DLOGGING=1',
130             '-fdata-sections',
131             '-ffunction-sections',
132             '-fno-rtti',
133             '-fvisibility=hidden',
134             '-fvisibility-inlines-hidden',
135             '-Wno-sign-promo',
136             '-Wno-missing-field-initializers',
137           ],
138           'ldflags': [
139             '-llog',
140             '-landroid',
141             '-Wl,--gc-sections',
142             '-Wl,--exclude-libs,ALL'
143           ],
144           'conditions': [
145             [ 'use_icu_alternatives_on_android == 1', {
146                 'dependencies!': [
147                   '../base/base.gyp:base_i18n',
148                   '../third_party/icu/icu.gyp:icui18n',
149                   '../third_party/icu/icu.gyp:icuuc',
150                 ]
151               },
152             ],
153           ],
154         },
155         {
156           'target_name': 'cronet',
157           'type': 'none',
158           'dependencies': [
159             '../base/base.gyp:base',
160             'libcronet',
161             'cronet_url_request_error_list',
162             'cronet_url_request_priority_list',
163           ],
164           'variables': {
165             'java_in_dir': 'cronet/android/java',
166           },
167           'includes': [ '../build/java.gypi' ],
168         },
169         {
170           'target_name': 'cronet_package',
171           'type': 'none',
172           'dependencies': [
173             'libcronet',
174             'cronet',
175           ],
176           'variables': {
177               'native_lib': 'libcronet.>(android_product_extension)',
178               'java_lib': 'cronet.jar',
179               'java_src_lib': 'cronet-src.jar',
180               'java_sample_src_lib': 'cronet-sample-src.jar',
181               'package_dir': '<(PRODUCT_DIR)/cronet',
182               'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/cronet',
183               'jar_extract_dir': '<(intermediate_dir)/cronet_jar_extract',
184               'jar_excluded_classes': [
185                 '*/library_loader/*',
186               ],
187               'jar_extract_stamp': '<(intermediate_dir)/jar_extract.stamp',
188               'cronet_jar_stamp': '<(intermediate_dir)/cronet_jar.stamp',
189           },
190           'actions': [
191             {
192               'action_name': 'strip libcronet',
193               'inputs': ['<(SHARED_LIB_DIR)/<(native_lib)'],
194               'outputs': ['<(package_dir)/libs/<(android_app_abi)/<(native_lib)'],
195               'action': [
196                 '<(android_strip)',
197                 '--strip-unneeded',
198                 '<@(_inputs)',
199                 '-o',
200                 '<@(_outputs)',
201               ],
202             },
203             {
204               'action_name': 'extracting from jars',
205               'inputs':  [
206                 '<(PRODUCT_DIR)/lib.java/<(java_lib)',
207                 '<(PRODUCT_DIR)/lib.java/base_java.jar',
208                 '<(PRODUCT_DIR)/lib.java/net_java.jar',
209                 '<(PRODUCT_DIR)/lib.java/url_java.jar',
210               ],
211               'outputs': ['<(jar_extract_stamp)', '<(jar_extract_dir)'],
212               'action': [
213                 'python',
214                 'cronet/tools/extract_from_jars.py',
215                 '--classes-dir=<(jar_extract_dir)',
216                 '--jars=<@(_inputs)',
217                 '--stamp=<(jar_extract_stamp)',
218               ],
219             },
220             {
221               'action_name': 'jar_<(_target_name)',
222               'message': 'Creating <(_target_name) jar',
223               'inputs': [
224                 '<(DEPTH)/build/android/gyp/util/build_utils.py',
225                 '<(DEPTH)/build/android/gyp/util/md5_check.py',
226                 '<(DEPTH)/build/android/gyp/jar.py',
227                 '<(jar_extract_stamp)',
228               ],
229               'outputs': [
230                 '<(package_dir)/<(java_lib)',
231                 '<(cronet_jar_stamp)',
232               ],
233               'action': [
234                 'python', '<(DEPTH)/build/android/gyp/jar.py',
235                 '--classes-dir=<(jar_extract_dir)',
236                 '--jar-path=<(package_dir)/<(java_lib)',
237                 '--excluded-classes=<@(jar_excluded_classes)',
238                 '--stamp=<(cronet_jar_stamp)',
239               ]
240             },
241             {
242               'action_name': 'jar_src_<(_target_name)',
243               'inputs': ['cronet/tools/jar_src.py'] ,
244               'outputs': ['<(package_dir)/<(java_src_lib)'],
245               'action': [
246                 'python',
247                 '<@(_inputs)',
248                 '--src-dir=cronet/android/java/src',
249                 '--jar-path=<(package_dir)/<(java_src_lib)',
250               ],
251             },
252             {
253               'action_name': 'jar_sample_src_<(_target_name)',
254               'inputs': ['cronet/tools/jar_src.py'] ,
255               'outputs': ['<(package_dir)/<(java_sample_src_lib)'],
256               'action': [
257                 'python',
258                 '<@(_inputs)',
259                 '--src-dir=cronet/android/sample',
260                 '--jar-path=<(package_dir)/<(java_sample_src_lib)',
261               ],
262             },
263             {
264               'action_name': 'generate licenses',
265               'inputs': ['cronet/tools/cronet_licenses.py'] ,
266               'outputs': ['<(package_dir)/LICENSE'],
267               'action': [
268                 'python',
269                 '<@(_inputs)',
270                 'license',
271                 '<@(_outputs)',
272               ],
273             },
274           ],
275           'copies': [
276             {
277               'destination': '<(package_dir)',
278               'files': [
279                 '../AUTHORS',
280                 '../chrome/VERSION',
281                 'cronet/android/proguard.cfg',
282               ],
283             },
284           ],
285         },
286         {
287           'target_name': 'cronet_sample_apk',
288           'type': 'none',
289           'dependencies': [
290             'cronet',
291           ],
292           'variables': {
293             'apk_name': 'CronetSample',
294             'java_in_dir': 'cronet/android/sample',
295             'resource_dir': 'cronet/android/sample/res',
296             'native_lib_target': 'libcronet',
297           },
298           'includes': [ '../build/java_apk.gypi' ],
299         },
300         {
301           # cronet_sample_apk creates a .jar as a side effect. Any java targets
302           # that need that .jar in their classpath should depend on this target,
303           # cronet_sample_apk_java. Dependents of cronet_sample_apk receive its
304           # jar path in the variable 'apk_output_jar_path'. This target should
305           # only be used by targets which instrument cronet_sample_apk.
306           'target_name': 'cronet_sample_apk_java',
307           'type': 'none',
308           'dependencies': [
309             'cronet_sample_apk',
310           ],
311           'includes': [ '../build/apk_fake_jar.gypi' ],
312         },
313         {
314           'target_name': 'cronet_sample_test_apk',
315           'type': 'none',
316           'dependencies': [
317             'cronet_sample_apk_java',
318             '../base/base.gyp:base_java',
319             '../base/base.gyp:base_javatests',
320             '../base/base.gyp:base_java_test_support',
321             # TODO(mef): Figure out why some tests are failing.
322             #'../net/net.gyp:net_javatests',
323             #'../net/net.gyp:net_java_test_support',
324           ],
325           'variables': {
326             'apk_name': 'CronetSampleTest',
327             'java_in_dir': 'cronet/android/sample/javatests',
328             'resource_dir': 'cronet/android/sample/res',
329             'is_test_apk': 1,
330           },
331           'includes': [ '../build/java_apk.gypi' ],
332         },
333       ],
334     }],  # OS=="android"
335   ],