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