Add GetURLForBrowserTab method to the external file system backend.
[chromium-blink-merge.git] / components / cronet.gypi
blobf7766ef2d5dfbf908dc5e6e78e2117a491bfa2ba
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               '**/AsyncUrlRequest.java',
166               '**/AsyncUrlRequestException.java',
167               '**/AsyncUrlRequestFactory.java',
168               '**/AsyncUrlRequestListener.java',
169               '**/ResponseInfo.java',
170               '**/ChunkedWritableByteChannel.java',
171               '**/HttpUrlConnection*.java',
172               '**/HttpUrlRequest*.java',
173               '**/ResponseTooLargeException.java',
174               '**/UserAgent.java',
175               # TODO(mef): Consider moving this into HttpUrlRequestConfig.
176               '**/UrlRequestContextConfig.java',
177               '**/Version.java',
178             ],
179           },
180           'includes': [ '../build/java.gypi' ],
181         },
182         { # cronet.jar implements HttpUrlRequest interface using Chromium stack
183           # in native libcronet.so library.
184           'target_name': 'cronet',
185           'type': 'none',
186           'dependencies': [
187             '../base/base.gyp:base',
188             'cronet_stub',
189             'cronet_url_request_error_list',
190             'cronet_url_request_priority_list',
191             'libcronet',
192           ],
193           'variables': {
194             'java_in_dir': 'cronet/android/java',
195             'javac_includes': [
196               '**/ChromiumAsyncUrlRequest.java',
197               '**/ChromiumUrlRequest.java',
198               '**/ChromiumUrlRequestContext.java',
199               '**/ChromiumUrlRequestError.java',
200               '**/ChromiumUrlRequestFactory.java',
201               '**/ChromiumUrlRequestPriority.java',
202               '**/LibraryLoader.java',
203               '**/UsedByReflection.java',
204             ],
205           },
206           'includes': [ '../build/java.gypi' ],
207         },
208         {
209           'target_name': 'cronet_package',
210           'type': 'none',
211           'dependencies': [
212             'libcronet',
213             'cronet',
214             'cronet_stub',
215           ],
216           'variables': {
217               'native_lib': 'libcronet.>(android_product_extension)',
218               'java_lib': 'cronet.jar',
219               'java_stub_lib': 'cronet_stub.jar',
220               'java_src_lib': 'cronet-src.jar',
221               'java_sample_src_lib': 'cronet-sample-src.jar',
222               'lib_java_dir': '<(PRODUCT_DIR)/lib.java',
223               'package_dir': '<(PRODUCT_DIR)/cronet',
224               'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/cronet',
225               'jar_extract_dir': '<(intermediate_dir)/cronet_jar_extract',
226               'jar_excluded_classes': [
227                 '*/library_loader/*',
228               ],
229               'jar_extract_stamp': '<(intermediate_dir)/jar_extract.stamp',
230               'cronet_jar_stamp': '<(intermediate_dir)/cronet_jar.stamp',
231           },
232           'actions': [
233             {
234               'action_name': 'strip libcronet',
235               'inputs': ['<(SHARED_LIB_DIR)/<(native_lib)'],
236               'outputs': ['<(package_dir)/libs/<(android_app_abi)/<(native_lib)'],
237               'action': [
238                 '<(android_strip)',
239                 '--strip-unneeded',
240                 '<@(_inputs)',
241                 '-o',
242                 '<@(_outputs)',
243               ],
244             },
245             {
246               'action_name': 'extracting from jars',
247               'inputs':  [
248                 '<(lib_java_dir)/<(java_lib)',
249                 '<(lib_java_dir)/base_java.jar',
250                 '<(lib_java_dir)/net_java.jar',
251                 '<(lib_java_dir)/url_java.jar',
252               ],
253               'outputs': ['<(jar_extract_stamp)', '<(jar_extract_dir)'],
254               'action': [
255                 'python',
256                 'cronet/tools/extract_from_jars.py',
257                 '--classes-dir=<(jar_extract_dir)',
258                 '--jars=<@(_inputs)',
259                 '--stamp=<(jar_extract_stamp)',
260               ],
261             },
262             {
263               'action_name': 'jar_<(_target_name)',
264               'message': 'Creating <(_target_name) jar',
265               'inputs': [
266                 '<(DEPTH)/build/android/gyp/util/build_utils.py',
267                 '<(DEPTH)/build/android/gyp/util/md5_check.py',
268                 '<(DEPTH)/build/android/gyp/jar.py',
269                 '<(jar_extract_stamp)',
270               ],
271               'outputs': [
272                 '<(package_dir)/<(java_lib)',
273                 '<(cronet_jar_stamp)',
274               ],
275               'action': [
276                 'python', '<(DEPTH)/build/android/gyp/jar.py',
277                 '--classes-dir=<(jar_extract_dir)',
278                 '--jar-path=<(package_dir)/<(java_lib)',
279                 '--excluded-classes=<@(jar_excluded_classes)',
280                 '--stamp=<(cronet_jar_stamp)',
281               ]
282             },
283             {
284               'action_name': 'jar_src_<(_target_name)',
285               'inputs': ['cronet/tools/jar_src.py'] ,
286               'outputs': ['<(package_dir)/<(java_src_lib)'],
287               'action': [
288                 'python',
289                 '<@(_inputs)',
290                 '--src-dir=cronet/android/java/src',
291                 '--jar-path=<(package_dir)/<(java_src_lib)',
292               ],
293             },
294             {
295               'action_name': 'jar_sample_src_<(_target_name)',
296               'inputs': ['cronet/tools/jar_src.py'] ,
297               'outputs': ['<(package_dir)/<(java_sample_src_lib)'],
298               'action': [
299                 'python',
300                 '<@(_inputs)',
301                 '--src-dir=cronet/android/sample',
302                 '--jar-path=<(package_dir)/<(java_sample_src_lib)',
303               ],
304             },
305             {
306               'action_name': 'generate licenses',
307               'inputs': ['cronet/tools/cronet_licenses.py'] ,
308               'outputs': ['<(package_dir)/LICENSE'],
309               'action': [
310                 'python',
311                 '<@(_inputs)',
312                 'license',
313                 '<@(_outputs)',
314               ],
315             },
316           ],
317           'copies': [
318             {
319               'destination': '<(package_dir)',
320               'files': [
321                 '../AUTHORS',
322                 '../chrome/VERSION',
323                 'cronet/android/proguard.cfg',
324                 '<(lib_java_dir)/<(java_stub_lib)'
325               ],
326             },
327             {
328               'destination': '<(package_dir)/symbols/<(android_app_abi)',
329               'files': [
330                 '<(SHARED_LIB_DIR)/<(native_lib)',
331               ],
332             },
333           ],
334         },
335         {
336           'target_name': 'cronet_sample_apk',
337           'type': 'none',
338           'dependencies': [
339             'cronet',
340           ],
341           'variables': {
342             'apk_name': 'CronetSample',
343             'java_in_dir': 'cronet/android/sample',
344             'resource_dir': 'cronet/android/sample/res',
345             'native_lib_target': 'libcronet',
346           },
347           'includes': [ '../build/java_apk.gypi' ],
348         },
349         {
350           # cronet_sample_apk creates a .jar as a side effect. Any java targets
351           # that need that .jar in their classpath should depend on this target,
352           # cronet_sample_apk_java. Dependents of cronet_sample_apk receive its
353           # jar path in the variable 'apk_output_jar_path'. This target should
354           # only be used by targets which instrument cronet_sample_apk.
355           'target_name': 'cronet_sample_apk_java',
356           'type': 'none',
357           'dependencies': [
358             'cronet_sample_apk',
359           ],
360           'includes': [ '../build/apk_fake_jar.gypi' ],
361         },
362         {
363           'target_name': 'cronet_sample_test_apk',
364           'type': 'none',
365           'dependencies': [
366             'cronet_sample_apk_java',
367             '../base/base.gyp:base_java',
368             '../base/base.gyp:base_javatests',
369             '../base/base.gyp:base_java_test_support',
370             # TODO(mef): Figure out why some tests are failing.
371             #'../net/net.gyp:net_javatests',
372             #'../net/net.gyp:net_java_test_support',
373           ],
374           'variables': {
375             'apk_name': 'CronetSampleTest',
376             'java_in_dir': 'cronet/android/sample/javatests',
377             'resource_dir': 'cronet/android/sample/res',
378             'is_test_apk': 1,
379           },
380           'includes': [ '../build/java_apk.gypi' ],
381         },
382       ],
383     }],  # OS=="android"
384   ],