Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / components / cronet.gypi
bloba68819dbe0cd9a739f31d24dd1dea95a0d1749aa
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/ChromiumUrlRequest.java',
15             'cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.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/ChromiumUrlRequestError.template',
27           ],
28           'variables': {
29             'package_name': 'org/chromium/cronet',
30             'template_deps': ['cronet/android/chromium_url_request_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/ChromiumUrlRequestPriority.template',
39           ],
40           'variables': {
41             'package_name': 'org/chromium/cronet',
42             'template_deps': ['cronet/android/chromium_url_request_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/chromium_url_request.cc',
114             'cronet/android/chromium_url_request.h',
115             'cronet/android/chromium_url_request_error_list.h',
116             'cronet/android/chromium_url_request_priority_list.h',
117             'cronet/android/chromium_url_request_context.cc',
118             'cronet/android/chromium_url_request_context.h',
119             'cronet/android/cronet_jni.cc',
120             'cronet/android/url_request_adapter.cc',
121             'cronet/android/url_request_adapter.h',
122             'cronet/android/url_request_context_adapter.cc',
123             'cronet/android/url_request_context_adapter.h',
124             'cronet/android/wrapped_channel_upload_element_reader.cc',
125             'cronet/android/wrapped_channel_upload_element_reader.h',
126           ],
127           'cflags': [
128             '-DLOGGING=1',
129             '-fdata-sections',
130             '-ffunction-sections',
131             '-fno-rtti',
132             '-fvisibility=hidden',
133             '-fvisibility-inlines-hidden',
134             '-Wno-sign-promo',
135             '-Wno-missing-field-initializers',
136           ],
137           'ldflags': [
138             '-llog',
139             '-landroid',
140             '-Wl,--gc-sections',
141             '-Wl,--exclude-libs,ALL'
142           ],
143           'conditions': [
144             [ 'use_icu_alternatives_on_android == 1', {
145                 'dependencies!': [
146                   '../base/base.gyp:base_i18n',
147                   '../third_party/icu/icu.gyp:icui18n',
148                   '../third_party/icu/icu.gyp:icuuc',
149                 ]
150               },
151             ],
152           ],
153         },
154         { # cronet_stub.jar defines HttpUrlRequest interface and provides its
155           # its implementation using HttpUrlConnection (not the Chromium stack).
156           'target_name': 'cronet_stub',
157           'type': 'none',
158           'dependencies': [
159             'cronet_url_request_context_config_list',
160             'cronet_version',
161           ],
162           'variables': {
163             'java_in_dir': 'cronet/android/java',
164             'javac_includes': [
165               '**/ChunkedWritableByteChannel.java',
166               '**/HttpUrlConnection*.java',
167               '**/HttpUrlRequest*.java',
168               '**/ResponseTooLargeException.java',
169               '**/UserAgent.java',
170               # TODO(mef): Consider moving this into HttpUrlRequestConfig.
171               '**/UrlRequestContextConfig.java',
172               '**/Version.java',
173             ],
174           },
175           'includes': [ '../build/java.gypi' ],
176         },
177         { # cronet.jar implements HttpUrlRequest interface using Chromium stack
178           # in native libcronet.so library.
179           'target_name': 'cronet',
180           'type': 'none',
181           'dependencies': [
182             '../base/base.gyp:base',
183             'cronet_stub',
184             'cronet_url_request_error_list',
185             'cronet_url_request_priority_list',
186             'libcronet',
187           ],
188           'variables': {
189             'java_in_dir': 'cronet/android/java',
190             'javac_includes': [
191               '**/ChromiumUrlRequest.java',
192               '**/ChromiumUrlRequestContext.java',
193               '**/ChromiumUrlRequestError.java',
194               '**/ChromiumUrlRequestFactory.java',
195               '**/ChromiumUrlRequestPriority.java',
196               '**/LibraryLoader.java',
197               '**/UsedByReflection.java',
198             ],
199           },
200           'includes': [ '../build/java.gypi' ],
201         },
202         {
203           'target_name': 'cronet_package',
204           'type': 'none',
205           'dependencies': [
206             'libcronet',
207             'cronet',
208             'cronet_stub',
209           ],
210           'variables': {
211               'native_lib': 'libcronet.>(android_product_extension)',
212               'java_lib': 'cronet.jar',
213               'java_stub_lib': 'cronet_stub.jar',
214               'java_src_lib': 'cronet-src.jar',
215               'java_sample_src_lib': 'cronet-sample-src.jar',
216               'lib_java_dir': '<(PRODUCT_DIR)/lib.java',
217               'package_dir': '<(PRODUCT_DIR)/cronet',
218               'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/cronet',
219               'jar_extract_dir': '<(intermediate_dir)/cronet_jar_extract',
220               'jar_excluded_classes': [
221                 '*/library_loader/*',
222               ],
223               'jar_extract_stamp': '<(intermediate_dir)/jar_extract.stamp',
224               'cronet_jar_stamp': '<(intermediate_dir)/cronet_jar.stamp',
225           },
226           'actions': [
227             {
228               'action_name': 'strip libcronet',
229               'inputs': ['<(SHARED_LIB_DIR)/<(native_lib)'],
230               'outputs': ['<(package_dir)/libs/<(android_app_abi)/<(native_lib)'],
231               'action': [
232                 '<(android_strip)',
233                 '--strip-unneeded',
234                 '<@(_inputs)',
235                 '-o',
236                 '<@(_outputs)',
237               ],
238             },
239             {
240               'action_name': 'extracting from jars',
241               'inputs':  [
242                 '<(lib_java_dir)/<(java_lib)',
243                 '<(lib_java_dir)/base_java.jar',
244                 '<(lib_java_dir)/net_java.jar',
245                 '<(lib_java_dir)/url_java.jar',
246               ],
247               'outputs': ['<(jar_extract_stamp)', '<(jar_extract_dir)'],
248               'action': [
249                 'python',
250                 'cronet/tools/extract_from_jars.py',
251                 '--classes-dir=<(jar_extract_dir)',
252                 '--jars=<@(_inputs)',
253                 '--stamp=<(jar_extract_stamp)',
254               ],
255             },
256             {
257               'action_name': 'jar_<(_target_name)',
258               'message': 'Creating <(_target_name) jar',
259               'inputs': [
260                 '<(DEPTH)/build/android/gyp/util/build_utils.py',
261                 '<(DEPTH)/build/android/gyp/util/md5_check.py',
262                 '<(DEPTH)/build/android/gyp/jar.py',
263                 '<(jar_extract_stamp)',
264               ],
265               'outputs': [
266                 '<(package_dir)/<(java_lib)',
267                 '<(cronet_jar_stamp)',
268               ],
269               'action': [
270                 'python', '<(DEPTH)/build/android/gyp/jar.py',
271                 '--classes-dir=<(jar_extract_dir)',
272                 '--jar-path=<(package_dir)/<(java_lib)',
273                 '--excluded-classes=<@(jar_excluded_classes)',
274                 '--stamp=<(cronet_jar_stamp)',
275               ]
276             },
277             {
278               'action_name': 'jar_src_<(_target_name)',
279               'inputs': ['cronet/tools/jar_src.py'] ,
280               'outputs': ['<(package_dir)/<(java_src_lib)'],
281               'action': [
282                 'python',
283                 '<@(_inputs)',
284                 '--src-dir=cronet/android/java/src',
285                 '--jar-path=<(package_dir)/<(java_src_lib)',
286               ],
287             },
288             {
289               'action_name': 'jar_sample_src_<(_target_name)',
290               'inputs': ['cronet/tools/jar_src.py'] ,
291               'outputs': ['<(package_dir)/<(java_sample_src_lib)'],
292               'action': [
293                 'python',
294                 '<@(_inputs)',
295                 '--src-dir=cronet/android/sample',
296                 '--jar-path=<(package_dir)/<(java_sample_src_lib)',
297               ],
298             },
299             {
300               'action_name': 'generate licenses',
301               'inputs': ['cronet/tools/cronet_licenses.py'] ,
302               'outputs': ['<(package_dir)/LICENSE'],
303               'action': [
304                 'python',
305                 '<@(_inputs)',
306                 'license',
307                 '<@(_outputs)',
308               ],
309             },
310           ],
311           'copies': [
312             {
313               'destination': '<(package_dir)',
314               'files': [
315                 '../AUTHORS',
316                 '../chrome/VERSION',
317                 'cronet/android/proguard.cfg',
318                 '<(lib_java_dir)/<(java_stub_lib)'
319               ],
320             },
321             {
322               'destination': '<(package_dir)/symbols/<(android_app_abi)',
323               'files': [
324                 '<(SHARED_LIB_DIR)/<(native_lib)',
325               ],
326             },
327           ],
328         },
329         {
330           'target_name': 'cronet_sample_apk',
331           'type': 'none',
332           'dependencies': [
333             'cronet',
334           ],
335           'variables': {
336             'apk_name': 'CronetSample',
337             'java_in_dir': 'cronet/android/sample',
338             'resource_dir': 'cronet/android/sample/res',
339             'native_lib_target': 'libcronet',
340           },
341           'includes': [ '../build/java_apk.gypi' ],
342         },
343         {
344           # cronet_sample_apk creates a .jar as a side effect. Any java targets
345           # that need that .jar in their classpath should depend on this target,
346           # cronet_sample_apk_java. Dependents of cronet_sample_apk receive its
347           # jar path in the variable 'apk_output_jar_path'. This target should
348           # only be used by targets which instrument cronet_sample_apk.
349           'target_name': 'cronet_sample_apk_java',
350           'type': 'none',
351           'dependencies': [
352             'cronet_sample_apk',
353           ],
354           'includes': [ '../build/apk_fake_jar.gypi' ],
355         },
356         {
357           'target_name': 'cronet_sample_test_apk',
358           'type': 'none',
359           'dependencies': [
360             'cronet_sample_apk_java',
361             '../base/base.gyp:base_java',
362             '../base/base.gyp:base_javatests',
363             '../base/base.gyp:base_java_test_support',
364             # TODO(mef): Figure out why some tests are failing.
365             #'../net/net.gyp:net_javatests',
366             #'../net/net.gyp:net_java_test_support',
367           ],
368           'variables': {
369             'apk_name': 'CronetSampleTest',
370             'java_in_dir': 'cronet/android/sample/javatests',
371             'resource_dir': 'cronet/android/sample/res',
372             'is_test_apk': 1,
373           },
374           'includes': [ '../build/java_apk.gypi' ],
375         },
376       ],
377     }],  # OS=="android"
378   ],