Roll src/third_party/skia cee4ddf:b3eb687
[chromium-blink-merge.git] / components / cronet.gypi
bloba2a3409bc4de2c5b0d77b6352d918d55d82d8f86
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_java',
24           'type': 'none',
25           'variables': {
26             'source_file': 'cronet/android/chromium_url_request.h',
27           },
28           'includes': [ '../build/android/java_cpp_enum.gypi' ],
29         },
30         {
31           'target_name': 'cronet_url_request_context_config_list',
32           'type': 'none',
33           'sources': [
34             'cronet/android/java/src/org/chromium/net/UrlRequestContextConfig.template',
35           ],
36           'variables': {
37             'package_name': 'org/chromium/cronet',
38             'template_deps': ['cronet/url_request_context_config_list.h'],
39           },
40           'includes': [ '../build/android/java_cpp_template.gypi' ],
41         },
42         {
43           'target_name': 'cronet_version',
44           'type': 'none',
45           'variables': {
46             'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
47             'version_py_path': '<(DEPTH)/build/util/version.py',
48             'version_path': '<(DEPTH)/chrome/VERSION',
49             'template_input_path': 'cronet/android/java/src/org/chromium/net/Version.template',
50             'output_path': '<(SHARED_INTERMEDIATE_DIR)/templates/<(_target_name)/org/chromium/cronet/Version.java',
51           },
52           'direct_dependent_settings': {
53             'variables': {
54               # Ensure that the output directory is used in the class path
55               # when building targets that depend on this one.
56               'generated_src_dirs': [
57                 '<(SHARED_INTERMEDIATE_DIR)/templates/<(_target_name)',
58               ],
59               # Ensure dependents are rebuilt when the generated Java file changes.
60               'additional_input_paths': [
61                 '<(output_path)',
62               ],
63             },
64           },
65           'actions': [
66             {
67               'action_name': 'cronet_version',
68               'inputs': [
69                 '<(template_input_path)',
70                 '<(version_path)',
71                 '<(lastchange_path)',
72               ],
73               'outputs': [
74                 '<(output_path)',
75               ],
76               'action': [
77                 'python',
78                 '<(version_py_path)',
79                 '-f', '<(version_path)',
80                 '-f', '<(lastchange_path)',
81                 '<(template_input_path)',
82                 '<(output_path)',
83               ],
84               'message': 'Generating version information',
85             },
86           ],
87         },
88         {
89           'target_name': 'cronet_static',
90           'type': 'static_library',
91           'dependencies': [
92             '../base/base.gyp:base',
93             '../base/base.gyp:base_i18n',
94             '../third_party/icu/icu.gyp:icui18n',
95             '../third_party/icu/icu.gyp:icuuc',
96             'cronet_jni_headers',
97             'cronet_url_request_context_config_list',
98             'cronet_url_request_java',
99             'cronet_version',
100             '../net/net.gyp:net',
101           ],
102           'sources': [
103             'cronet/url_request_context_config.cc',
104             'cronet/url_request_context_config.h',
105             'cronet/url_request_context_config_list.h',
106             'cronet/android/chromium_url_request.cc',
107             'cronet/android/chromium_url_request.h',
108             'cronet/android/chromium_url_request_error_list.h',
109             'cronet/android/chromium_url_request_priority_list.h',
110             'cronet/android/chromium_url_request_context.cc',
111             'cronet/android/chromium_url_request_context.h',
112             'cronet/android/cronet_loader.cc',
113             'cronet/android/cronet_loader.h',
114             'cronet/android/url_request_adapter.cc',
115             'cronet/android/url_request_adapter.h',
116             'cronet/android/url_request_context_adapter.cc',
117             'cronet/android/url_request_context_adapter.h',
118             'cronet/android/wrapped_channel_upload_element_reader.cc',
119             'cronet/android/wrapped_channel_upload_element_reader.h',
120           ],
121           'cflags': [
122             '-DLOGGING=1',
123             '-fdata-sections',
124             '-ffunction-sections',
125             '-fno-rtti',
126             '-fvisibility=hidden',
127             '-fvisibility-inlines-hidden',
128             '-Wno-sign-promo',
129             '-Wno-missing-field-initializers',
130           ],
131           'ldflags': [
132             '-llog',
133             '-landroid',
134             '-Wl,--gc-sections',
135             '-Wl,--exclude-libs,ALL'
136           ],
137           'conditions': [
138             [ 'use_icu_alternatives_on_android == 1', {
139                 'dependencies!': [
140                   '../base/base.gyp:base_i18n',
141                   '../third_party/icu/icu.gyp:icui18n',
142                   '../third_party/icu/icu.gyp:icuuc',
143                 ]
144               },
145             ],
146           ],
147         },
148         {
149           'target_name': 'libcronet',
150           'type': 'shared_library',
151           'sources': [
152             'cronet/android/cronet_jni.cc',
153           ],
154           'dependencies': [
155             'cronet_static',
156             '../base/base.gyp:base',
157             '../net/net.gyp:net',
158             '../url/url.gyp:url_lib',
159           ],
160         },
161         { # cronet_stub.jar defines HttpUrlRequest interface and provides its
162           # its implementation using HttpUrlConnection (not the Chromium stack).
163           'target_name': 'cronet_stub',
164           'type': 'none',
165           'dependencies': [
166             'cronet_url_request_context_config_list',
167             'cronet_version',
168           ],
169           'variables': {
170             'java_in_dir': 'cronet/android/java',
171             'javac_includes': [
172               '**/AsyncUrlRequest.java',
173               '**/AsyncUrlRequestException.java',
174               '**/AsyncUrlRequestFactory.java',
175               '**/AsyncUrlRequestListener.java',
176               '**/ResponseInfo.java',
177               '**/ChunkedWritableByteChannel.java',
178               '**/HttpUrlConnection*.java',
179               '**/HttpUrlRequest*.java',
180               '**/ResponseTooLargeException.java',
181               '**/UserAgent.java',
182               # TODO(mef): Consider moving this into HttpUrlRequestConfig.
183               '**/UrlRequestContextConfig.java',
184               '**/Version.java',
185             ],
186           },
187           'includes': [ '../build/java.gypi' ],
188         },
189         { # cronet.jar implements HttpUrlRequest interface using Chromium stack
190           # in native libcronet.so library.
191           'target_name': 'cronet',
192           'type': 'none',
193           'dependencies': [
194             '../base/base.gyp:base',
195             'cronet_stub',
196             'cronet_url_request_java',
197             'libcronet',
198           ],
199           'variables': {
200             'java_in_dir': 'cronet/android/java',
201             'javac_includes': [
202               '**/ChromiumAsyncUrlRequest.java',
203               '**/ChromiumUrlRequest.java',
204               '**/ChromiumUrlRequestContext.java',
205               '**/ChromiumUrlRequestError.java',
206               '**/ChromiumUrlRequestFactory.java',
207               '**/ChromiumUrlRequestPriority.java',
208               '**/UsedByReflection.java',
209             ],
210           },
211           'includes': [ '../build/java.gypi' ],
212         },
213         {
214           'target_name': 'cronet_package',
215           'type': 'none',
216           'dependencies': [
217             'libcronet',
218             'cronet',
219             'cronet_stub',
220           ],
221           'variables': {
222               'native_lib': 'libcronet.>(android_product_extension)',
223               'java_lib': 'cronet.jar',
224               'java_stub_lib': 'cronet_stub.jar',
225               'java_src_lib': 'cronet-src.jar',
226               'java_sample_src_lib': 'cronet-sample-src.jar',
227               'lib_java_dir': '<(PRODUCT_DIR)/lib.java',
228               'package_dir': '<(PRODUCT_DIR)/cronet',
229               'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/cronet',
230               'jar_extract_dir': '<(intermediate_dir)/cronet_jar_extract',
231               'jar_excluded_classes': [
232                 '*/library_loader/*',
233               ],
234               'jar_extract_stamp': '<(intermediate_dir)/jar_extract.stamp',
235               'cronet_jar_stamp': '<(intermediate_dir)/cronet_jar.stamp',
236           },
237           'actions': [
238             {
239               'action_name': 'strip libcronet',
240               'inputs': ['<(SHARED_LIB_DIR)/<(native_lib)'],
241               'outputs': ['<(package_dir)/libs/<(android_app_abi)/<(native_lib)'],
242               'action': [
243                 '<(android_strip)',
244                 '--strip-unneeded',
245                 '<@(_inputs)',
246                 '-o',
247                 '<@(_outputs)',
248               ],
249             },
250             {
251               'action_name': 'extracting from jars',
252               'inputs':  [
253                 '<(lib_java_dir)/<(java_lib)',
254                 '<(lib_java_dir)/base_java.jar',
255                 '<(lib_java_dir)/net_java.jar',
256                 '<(lib_java_dir)/url_java.jar',
257               ],
258               'outputs': ['<(jar_extract_stamp)', '<(jar_extract_dir)'],
259               'action': [
260                 'python',
261                 'cronet/tools/extract_from_jars.py',
262                 '--classes-dir=<(jar_extract_dir)',
263                 '--jars=<@(_inputs)',
264                 '--stamp=<(jar_extract_stamp)',
265               ],
266             },
267             {
268               'action_name': 'jar_<(_target_name)',
269               'message': 'Creating <(_target_name) jar',
270               'inputs': [
271                 '<(DEPTH)/build/android/gyp/util/build_utils.py',
272                 '<(DEPTH)/build/android/gyp/util/md5_check.py',
273                 '<(DEPTH)/build/android/gyp/jar.py',
274                 '<(jar_extract_stamp)',
275               ],
276               'outputs': [
277                 '<(package_dir)/<(java_lib)',
278                 '<(cronet_jar_stamp)',
279               ],
280               'action': [
281                 'python', '<(DEPTH)/build/android/gyp/jar.py',
282                 '--classes-dir=<(jar_extract_dir)',
283                 '--jar-path=<(package_dir)/<(java_lib)',
284                 '--excluded-classes=<@(jar_excluded_classes)',
285                 '--stamp=<(cronet_jar_stamp)',
286               ]
287             },
288             {
289               'action_name': 'jar_src_<(_target_name)',
290               'inputs': ['cronet/tools/jar_src.py'] ,
291               'outputs': ['<(package_dir)/<(java_src_lib)'],
292               'action': [
293                 'python',
294                 '<@(_inputs)',
295                 '--src-dir=cronet/android/java/src',
296                 '--jar-path=<(package_dir)/<(java_src_lib)',
297               ],
298             },
299             {
300               'action_name': 'jar_sample_src_<(_target_name)',
301               'inputs': ['cronet/tools/jar_src.py'] ,
302               'outputs': ['<(package_dir)/<(java_sample_src_lib)'],
303               'action': [
304                 'python',
305                 '<@(_inputs)',
306                 '--src-dir=cronet/android/sample',
307                 '--jar-path=<(package_dir)/<(java_sample_src_lib)',
308               ],
309             },
310             {
311               'action_name': 'generate licenses',
312               'inputs': ['cronet/tools/cronet_licenses.py'] ,
313               'outputs': ['<(package_dir)/LICENSE'],
314               'action': [
315                 'python',
316                 '<@(_inputs)',
317                 'license',
318                 '<@(_outputs)',
319               ],
320             },
321           ],
322           'copies': [
323             {
324               'destination': '<(package_dir)',
325               'files': [
326                 '../AUTHORS',
327                 '../chrome/VERSION',
328                 'cronet/android/proguard.cfg',
329                 '<(lib_java_dir)/<(java_stub_lib)'
330               ],
331             },
332             {
333               'destination': '<(package_dir)/symbols/<(android_app_abi)',
334               'files': [
335                 '<(SHARED_LIB_DIR)/<(native_lib)',
336               ],
337             },
338           ],
339         },
340         {
341           'target_name': 'cronet_sample_apk',
342           'type': 'none',
343           'dependencies': [
344             'cronet',
345             'cronet_stub',
346           ],
347           'variables': {
348             'apk_name': 'CronetSample',
349             'java_in_dir': 'cronet/android/sample',
350             'resource_dir': 'cronet/android/sample/res',
351             'native_lib_target': 'libcronet',
352             'proguard_enabled': 'true',
353             'proguard_flags_paths': [
354               'cronet/android/proguard.cfg',
355               'cronet/android/sample/javatests/proguard.cfg',
356             ],
357           },
358           'includes': [ '../build/java_apk.gypi' ],
359         },
360         {
361           # cronet_sample_apk creates a .jar as a side effect. Any java targets
362           # that need that .jar in their classpath should depend on this target,
363           # cronet_sample_apk_java. Dependents of cronet_sample_apk receive its
364           # jar path in the variable 'apk_output_jar_path'. This target should
365           # only be used by targets which instrument cronet_sample_apk.
366           'target_name': 'cronet_sample_apk_java',
367           'type': 'none',
368           'dependencies': [
369             'cronet_sample_apk',
370           ],
371           'includes': [ '../build/apk_fake_jar.gypi' ],
372         },
373         {
374           'target_name': 'cronet_sample_test_apk',
375           'type': 'none',
376           'dependencies': [
377             'cronet',
378             'cronet_sample_apk_java',
379             'cronet_stub',
380             '../base/base.gyp:base_java_test_support',
381           ],
382           'variables': {
383             'apk_name': 'CronetSampleTest',
384             'java_in_dir': 'cronet/android/sample/javatests',
385             'resource_dir': 'cronet/android/sample/res',
386             'is_test_apk': 1,
387           },
388           'includes': [ '../build/java_apk.gypi' ],
389         },
390         {
391           'target_name': 'cronet_tests_jni_headers',
392           'type': 'none',
393           'sources': [
394             'cronet/android/test/src/org/chromium/cronet_test_apk/CronetTestUtil.java',
395             'cronet/android/test/src/org/chromium/cronet_test_apk/MockUrlRequestJobUtil.java',
396             'cronet/android/test/src/org/chromium/cronet_test_apk/UploadTestServer.java',
397           ],
398           'variables': {
399             'jni_gen_package': 'cronet_tests',
400           },
401           'includes': [ '../build/jni_generator.gypi' ],
402         },
403         {
404           'target_name': 'libcronet_tests',
405           'type': 'shared_library',
406           'sources': [
407             'cronet/android/test/cronet_test_jni.cc',
408             'cronet/android/test/mock_url_request_job_util.cc',
409             'cronet/android/test/mock_url_request_job_util.h',
410             'cronet/android/test/upload_test_server.cc',
411             'cronet/android/test/upload_test_server.h',
412             '../net/base/directory_lister.cc',
413             '../net/base/directory_lister.h',
414             '../net/url_request/url_request_file_job.cc',
415             '../net/url_request/url_request_file_job.h',
416           ],
417           'dependencies': [
418             'cronet_static',
419             'cronet_tests_jni_headers',
420             '../base/base.gyp:base',
421             '../net/net.gyp:net',
422             '../net/net.gyp:net_test_support',
423             '../net/net.gyp:quic_tools',
424             '../url/url.gyp:url_lib',
425             '../base/base.gyp:base_i18n',
426             '../third_party/icu/icu.gyp:icui18n',
427             '../third_party/icu/icu.gyp:icuuc',
428           ],
429         },
430         {
431           'target_name': 'cronet_test_apk',
432           'type': 'none',
433           'dependencies': [
434             'cronet',
435           ],
436           'variables': {
437             'apk_name': 'CronetTest',
438             'java_in_dir': 'cronet/android/test',
439             'resource_dir': 'cronet/android/test/res',
440             'asset_location': 'cronet/android/test/assets',
441             'native_lib_target': 'libcronet_tests',
442           },
443           'includes': [ '../build/java_apk.gypi' ],
444         },
445         {
446           # cronet_test_apk creates a .jar as a side effect. Any java targets
447           # that need that .jar in their classpath should depend on this target,
448           # cronet_test_apk_java. Dependents of cronet_test_apk receive its
449           # jar path in the variable 'apk_output_jar_path'. This target should
450           # only be used by targets which instrument cronet_test_apk.
451           'target_name': 'cronet_test_apk_java',
452           'type': 'none',
453           'dependencies': [
454             'cronet_test_apk',
455           ],
456           'includes': [ '../build/apk_fake_jar.gypi' ],
457         },
458         {
459           'target_name': 'cronet_test_instrumentation_apk',
460           'type': 'none',
461           'dependencies': [
462             'cronet_test_apk_java',
463             '../base/base.gyp:base_java_test_support',
464           ],
465           'variables': {
466             'apk_name': 'CronetTestInstrumentation',
467             'java_in_dir': 'cronet/android/test/javatests',
468             'resource_dir': 'cronet/android/test/res',
469             'is_test_apk': 1,
470           },
471           'includes': [ '../build/java_apk.gypi' ],
472         },
473       ],
474     }],  # OS=="android"
475   ],