Add readelf and nm dummy values to cros.
[chromium-blink-merge.git] / components / cronet.gypi
blob438f3bacf82a22a63ac9d3bbb1696508c6ac0d16
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/CronetHistogramManager.java',
15             'cronet/android/java/src/org/chromium/net/CronetLibraryLoader.java',
16             'cronet/android/java/src/org/chromium/net/CronetUploadDataStream.java',
17             'cronet/android/java/src/org/chromium/net/CronetUrlRequest.java',
18             'cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java',
19             'cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java',
20             'cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.java',
21           ],
22           'variables': {
23             'jni_gen_package': 'cronet',
24           },
25           'includes': [ '../build/jni_generator.gypi' ],
26         },
27         {
28           'target_name': 'cronet_url_request_java',
29           'type': 'none',
30           'variables': {
31             'source_file': 'cronet/android/chromium_url_request.h',
32           },
33           'includes': [ '../build/android/java_cpp_enum.gypi' ],
34         },
35         {
36           'target_name': 'net_request_priority_java',
37           'type': 'none',
38           'variables': {
39             'source_file': '../net/base/request_priority.h',
40           },
41           'includes': [ '../build/android/java_cpp_enum.gypi' ],
42         },
43         {
44           'target_name': 'cronet_url_request_context_config_list',
45           'type': 'none',
46           'sources': [
47             'cronet/android/java/src/org/chromium/net/UrlRequestContextConfigList.template',
48           ],
49           'variables': {
50             'package_name': 'org/chromium/cronet',
51             'template_deps': ['cronet/url_request_context_config_list.h'],
52           },
53           'includes': [ '../build/android/java_cpp_template.gypi' ],
54         },
55         {
56           'target_name': 'load_states_list',
57           'type': 'none',
58           'sources': [
59             'cronet/android/java/src/org/chromium/net/LoadState.template',
60           ],
61           'variables': {
62             'package_name': 'org/chromium/cronet',
63             'template_deps': ['../net/base/load_states_list.h'],
64           },
65           'includes': [ '../build/android/java_cpp_template.gypi' ],
66         },
67         {
68           'target_name': 'cronet_version',
69           'type': 'none',
70           'variables': {
71             'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
72             'version_py_path': '<(DEPTH)/build/util/version.py',
73             'version_path': '<(DEPTH)/chrome/VERSION',
74             'template_input_path': 'cronet/android/java/src/org/chromium/net/Version.template',
75             'output_path': '<(SHARED_INTERMEDIATE_DIR)/templates/<(_target_name)/org/chromium/cronet/Version.java',
76           },
77           'direct_dependent_settings': {
78             'variables': {
79               # Ensure that the output directory is used in the class path
80               # when building targets that depend on this one.
81               'generated_src_dirs': [
82                 '<(SHARED_INTERMEDIATE_DIR)/templates/<(_target_name)',
83               ],
84               # Ensure dependents are rebuilt when the generated Java file changes.
85               'additional_input_paths': [
86                 '<(output_path)',
87               ],
88             },
89           },
90           'actions': [
91             {
92               'action_name': 'cronet_version',
93               'inputs': [
94                 '<(template_input_path)',
95                 '<(version_path)',
96                 '<(lastchange_path)',
97               ],
98               'outputs': [
99                 '<(output_path)',
100               ],
101               'action': [
102                 'python',
103                 '<(version_py_path)',
104                 '-f', '<(version_path)',
105                 '-f', '<(lastchange_path)',
106                 '<(template_input_path)',
107                 '<(output_path)',
108               ],
109               'message': 'Generating version information',
110             },
111           ],
112         },
113         {
114           'target_name': 'cronet_version_header',
115           'type': 'none',
116           # Need to set hard_depency flag because cronet_version generates a
117           # header.
118           'hard_dependency': 1,
119           'direct_dependent_settings': {
120             'include_dirs': [
121               '<(SHARED_INTERMEDIATE_DIR)/',
122             ],
123           },
124           'actions': [
125             {
126               'action_name': 'version_header',
127               'message': 'Generating version header file: <@(_outputs)',
128               'inputs': [
129                 '<(version_path)',
130                 'cronet/version.h.in',
131               ],
132               'outputs': [
133                 '<(SHARED_INTERMEDIATE_DIR)/components/cronet/version.h',
134               ],
135               'action': [
136                 'python',
137                 '<(version_py_path)',
138                 '-e', 'VERSION_FULL="<(version_full)"',
139                 'cronet/version.h.in',
140                 '<@(_outputs)',
141               ],
142               'includes': [
143                 '../build/util/version.gypi',
144               ],
145             },
146           ],
147         },
148         {
149           # cronet_static_small target has reduced binary size through using
150           # ICU alternatives which requires file and ftp support be disabled.
151           'target_name': 'cronet_static_small',
152           'type': 'static_library',
153           'defines': [
154             'USE_ICU_ALTERNATIVES_ON_ANDROID=1',
155             'DISABLE_FILE_SUPPORT=1',
156             'DISABLE_FTP_SUPPORT=1',
157           ],
158           'dependencies': [
159             '../net/net.gyp:net_small',
160           ],
161           'conditions': [
162             ['enable_data_reduction_proxy_support==1',
163               {
164                 'dependencies': [
165                   '../components/components.gyp:data_reduction_proxy_core_browser_small',
166                 ],
167               },
168             ],
169           ],
170           'includes': [ 'cronet/cronet_static.gypi' ],
171         },
172         {
173           # cronet_static target depends on ICU and includes file and ftp support.
174           'target_name': 'cronet_static',
175           'type': 'static_library',
176           'dependencies': [
177             '../base/base.gyp:base_i18n',
178             '../net/net.gyp:net',
179           ],
180           'conditions': [
181             ['enable_data_reduction_proxy_support==1',
182               {
183                 'dependencies': [
184                   '../components/components.gyp:data_reduction_proxy_core_browser',
185                 ],
186               },
187             ],
188           ],
189           'includes': [ 'cronet/cronet_static.gypi' ],
190         },
191         {
192           'target_name': 'libcronet',
193           'type': 'shared_library',
194           'sources': [
195             'cronet/android/cronet_jni.cc',
196           ],
197           'dependencies': [
198             'cronet_static_small',
199             '../base/base.gyp:base',
200             '../net/net.gyp:net_small',
201             '../url/url.gyp:url_lib_use_icu_alternatives_on_android',
202           ],
203         },
204         { # cronet_api.jar defines Cronet API and provides implementation of
205           # legacy api using HttpUrlConnection (not the Chromium stack).
206           'target_name': 'cronet_api',
207           'type': 'none',
208           'dependencies': [
209             'cronet_url_request_context_config_list',
210             'cronet_version',
211             'load_states_list',
212           ],
213           'variables': {
214             'java_in_dir': 'cronet/android/java',
215             'javac_includes': [
216               '**/ChunkedWritableByteChannel.java',
217               '**/ExtendedResponseInfo.java',
218               '**/HistogramManager.java',
219               '**/HttpUrlConnection*.java',
220               '**/HttpUrlRequest*.java',
221               '**/LoadState.java',
222               '**/RequestStatus.java',
223               '**/ResponseInfo.java',
224               '**/ResponseTooLargeException.java',
225               '**/StatusListener.java',
226               '**/UploadDataProvider.java',
227               '**/UploadDataSink.java',
228               '**/UrlRequest.java',
229               '**/UrlRequestContext.java',
230               '**/UrlRequestContextConfig.java',
231               '**/UrlRequestContextConfigList.java',
232               '**/UrlRequestException.java',
233               '**/UrlRequestListener.java',
234               '**/UserAgent.java',
235               '**/Version.java',
236             ],
237           },
238           'includes': [ '../build/java.gypi' ],
239         },
240         { # cronet.jar implements HttpUrlRequest interface using Chromium stack
241           # in native libcronet.so library.
242           'target_name': 'cronet_java',
243           'type': 'none',
244           'dependencies': [
245             '../base/base.gyp:base',
246             'cronet_api',
247             'cronet_url_request_java',
248             'libcronet',
249             'net_request_priority_java',
250           ],
251           'variables': {
252             'java_in_dir': 'cronet/android/java',
253             'javac_includes': [
254               '**/ChromiumAsyncUrlRequest.java',
255               '**/ChromiumUrlRequest.java',
256               '**/ChromiumUrlRequestContext.java',
257               '**/ChromiumUrlRequestError.java',
258               '**/ChromiumUrlRequestFactory.java',
259               '**/ChromiumUrlRequestPriority.java',
260               '**/CronetHistogramManager.java',
261               '**/CronetResponseInfo.java',
262               '**/CronetLibraryLoader.java',
263               '**/CronetUploadDataStream.java',
264               '**/CronetUrlRequest.java',
265               '**/CronetUrlRequestContext.java',
266               '**/CronetUrlRequestFactory.java',
267               '**/RequestPriority.java',
268               '**/urlconnection/CronetBufferedOutputStream.java',
269               '**/urlconnection/CronetChunkedOutputStream.java',
270               '**/urlconnection/CronetFixedModeOutputStream.java',
271               '**/urlconnection/CronetInputStream.java',
272               '**/urlconnection/CronetHttpURLConnection.java',
273               '**/urlconnection/CronetHttpURLStreamHandler.java',
274               '**/urlconnection/CronetOutputStream.java',
275               '**/urlconnection/CronetURLStreamHandlerFactory.java',
276               '**/urlconnection/MessageLoop.java',
277             ],
278           },
279           'includes': [ '../build/java.gypi' ],
280         },
281         {
282           'target_name': 'cronet_sample_apk',
283           'type': 'none',
284           'dependencies': [
285             'cronet_java',
286             'cronet_api',
287           ],
288           'variables': {
289             'apk_name': 'CronetSample',
290             'java_in_dir': 'cronet/android/sample',
291             'resource_dir': 'cronet/android/sample/res',
292             'native_lib_target': 'libcronet',
293             'proguard_enabled': 'true',
294             'proguard_flags_paths': [
295               'cronet/android/proguard.cfg',
296               'cronet/android/sample/javatests/proguard.cfg',
297             ],
298           },
299           'includes': [ '../build/java_apk.gypi' ],
300         },
301         {
302           # cronet_sample_apk creates a .jar as a side effect. Any java targets
303           # that need that .jar in their classpath should depend on this target,
304           # cronet_sample_apk_java. Dependents of cronet_sample_apk receive its
305           # jar path in the variable 'apk_output_jar_path'. This target should
306           # only be used by targets which instrument cronet_sample_apk.
307           'target_name': 'cronet_sample_apk_java',
308           'type': 'none',
309           'dependencies': [
310             'cronet_sample_apk',
311           ],
312           'includes': [ '../build/apk_fake_jar.gypi' ],
313         },
314         {
315           'target_name': 'cronet_sample_test_apk',
316           'type': 'none',
317           'dependencies': [
318             'cronet_java',
319             'cronet_sample_apk_java',
320             'cronet_api',
321             '../base/base.gyp:base_java_test_support',
322           ],
323           'variables': {
324             'apk_name': 'CronetSampleTest',
325             'java_in_dir': 'cronet/android/sample/javatests',
326             'is_test_apk': 1,
327           },
328           'includes': [ '../build/java_apk.gypi' ],
329         },
330         {
331           'target_name': 'cronet_tests_jni_headers',
332           'type': 'none',
333           'sources': [
334             'cronet/android/test/src/org/chromium/net/CronetTestUtil.java',
335             'cronet/android/test/src/org/chromium/net/MockUrlRequestJobFactory.java',
336             'cronet/android/test/src/org/chromium/net/NativeTestServer.java',
337             'cronet/android/test/src/org/chromium/net/NetworkChangeNotifierUtil.java',
338             'cronet/android/test/src/org/chromium/net/QuicTestServer.java',
339             'cronet/android/test/src/org/chromium/net/SdchObserver.java',
340             'cronet/android/test/src/org/chromium/net/TestUploadDataStreamHandler.java',
341           ],
342           'variables': {
343             'jni_gen_package': 'cronet_tests',
344           },
345           'includes': [ '../build/jni_generator.gypi' ],
346         },
347         {
348           'target_name': 'libcronet_tests',
349           'type': 'shared_library',
350           'sources': [
351             'cronet/android/test/cronet_test_jni.cc',
352             'cronet/android/test/mock_url_request_job_factory.cc',
353             'cronet/android/test/mock_url_request_job_factory.h',
354             'cronet/android/test/native_test_server.cc',
355             'cronet/android/test/native_test_server.h',
356             'cronet/android/test/quic_test_server.cc',
357             'cronet/android/test/quic_test_server.h',
358             'cronet/android/test/sdch_test_util.cc',
359             'cronet/android/test/sdch_test_util.h',
360             'cronet/android/test/test_upload_data_stream_handler.cc',
361             'cronet/android/test/test_upload_data_stream_handler.h',
362             'cronet/android/test/network_change_notifier_util.cc',
363             'cronet/android/test/network_change_notifier_util.h',
364           ],
365           'dependencies': [
366             'cronet_tests_jni_headers',
367             '../base/base.gyp:base',
368             '../net/net.gyp:net',
369             '../net/net.gyp:net_quic_proto',
370             '../net/net.gyp:net_test_support',
371             '../net/net.gyp:simple_quic_tools',
372             '../url/url.gyp:url_lib',
373             '../base/base.gyp:base_i18n',
374             '../third_party/icu/icu.gyp:icui18n',
375             '../third_party/icu/icu.gyp:icuuc',
376           ],
377           'defines': [
378             'CRONET_TEST=1',
379           ],
380           'conditions': [
381             ['enable_data_reduction_proxy_support==1',
382               {
383                 'dependencies': [
384                   '../components/components.gyp:data_reduction_proxy_core_browser',
385                 ],
386               },
387             ],
388           ],
389           'includes': [ 'cronet/cronet_static.gypi' ],
390         },
391         {
392           'target_name': 'cronet_test_apk',
393           'type': 'none',
394           'dependencies': [
395             'cronet_java',
396             '../net/net.gyp:net_java_test_support',
397           ],
398           'variables': {
399             'apk_name': 'CronetTest',
400             'java_in_dir': 'cronet/android/test',
401             'resource_dir': 'cronet/android/test/res',
402             'asset_location': 'cronet/android/test/assets',
403             'native_lib_target': 'libcronet_tests',
404           },
405           'includes': [ '../build/java_apk.gypi' ],
406         },
407         {
408           # cronet_test_apk creates a .jar as a side effect. Any java targets
409           # that need that .jar in their classpath should depend on this target,
410           # cronet_test_apk_java. Dependents of cronet_test_apk receive its
411           # jar path in the variable 'apk_output_jar_path'. This target should
412           # only be used by targets which instrument cronet_test_apk.
413           'target_name': 'cronet_test_apk_java',
414           'type': 'none',
415           'dependencies': [
416             'cronet_test_apk',
417           ],
418           'includes': [ '../build/apk_fake_jar.gypi' ],
419         },
420         {
421           'target_name': 'cronet_test_instrumentation_apk',
422           'type': 'none',
423           'dependencies': [
424             'cronet_test_apk_java',
425             '../base/base.gyp:base_java_test_support',
426           ],
427           'variables': {
428             'apk_name': 'CronetTestInstrumentation',
429             'java_in_dir': 'cronet/android/test/javatests',
430             'resource_dir': 'cronet/android/test/res',
431             'is_test_apk': 1,
432           },
433           'includes': [ '../build/java_apk.gypi' ],
434         },
435         {
436           'target_name': 'cronet_perf_test_apk',
437           'type': 'none',
438           'dependencies': [
439             'cronet_java',
440             'cronet_api',
441           ],
442           'variables': {
443             'apk_name': 'CronetPerfTest',
444             'java_in_dir': 'cronet/android/test/javaperftests',
445             'is_test_apk': 1,
446             'native_lib_target': 'libcronet',
447             'proguard_enabled': 'true',
448             'proguard_flags_paths': [
449               'cronet/android/proguard.cfg',
450             ],
451           },
452           'includes': [ '../build/java_apk.gypi' ],
453         },
454         {
455           'target_name': 'cronet_package',
456           'type': 'none',
457           'dependencies': [
458             'libcronet',
459             'cronet_java',
460             'cronet_api',
461             '../net/net.gyp:net_unittests_apk',
462           ],
463           'variables': {
464             'native_lib': 'libcronet.>(android_product_extension)',
465             'java_lib': 'cronet.jar',
466             'java_api_lib': 'cronet_api.jar',
467             'java_src_lib': 'cronet-src.jar',
468             'java_sample_src_lib': 'cronet-sample-src.jar',
469             'lib_java_dir': '<(PRODUCT_DIR)/lib.java',
470             'package_dir': '<(PRODUCT_DIR)/cronet',
471             'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/cronet',
472             'jar_extract_dir': '<(intermediate_dir)/cronet_jar_extract',
473             'jar_extract_stamp': '<(intermediate_dir)/jar_extract.stamp',
474             'cronet_jar_stamp': '<(intermediate_dir)/cronet_jar.stamp',
475           },
476           'actions': [
477             {
478               'action_name': 'strip libcronet',
479               'inputs': ['<(SHARED_LIB_DIR)/<(native_lib)'],
480               'outputs': ['<(package_dir)/libs/<(android_app_abi)/<(native_lib)'],
481               'action': [
482                 '<(android_strip)',
483                 '--strip-unneeded',
484                 '<@(_inputs)',
485                 '-o',
486                 '<@(_outputs)',
487               ],
488             },
489             {
490               'action_name': 'extracting from jars',
491               'inputs':  [
492                 '<(lib_java_dir)/cronet_java.jar',
493                 '<(lib_java_dir)/base_java.jar',
494                 '<(lib_java_dir)/net_java.jar',
495                 '<(lib_java_dir)/url_java.jar',
496               ],
497               'outputs': ['<(jar_extract_stamp)', '<(jar_extract_dir)'],
498               'action': [
499                 'python',
500                 'cronet/tools/extract_from_jars.py',
501                 '--classes-dir=<(jar_extract_dir)',
502                 '--jars=<@(_inputs)',
503                 '--stamp=<(jar_extract_stamp)',
504               ],
505             },
506             {
507               'action_name': 'jar_<(_target_name)',
508               'message': 'Creating <(_target_name) jar',
509               'inputs': [
510                 '<(DEPTH)/build/android/gyp/util/build_utils.py',
511                 '<(DEPTH)/build/android/gyp/util/md5_check.py',
512                 '<(DEPTH)/build/android/gyp/jar.py',
513                 '<(jar_extract_stamp)',
514               ],
515               'outputs': [
516                 '<(package_dir)/<(java_lib)',
517                 '<(cronet_jar_stamp)',
518               ],
519               'action': [
520                 'python', '<(DEPTH)/build/android/gyp/jar.py',
521                 '--classes-dir=<(jar_extract_dir)',
522                 '--jar-path=<(package_dir)/<(java_lib)',
523                 '--stamp=<(cronet_jar_stamp)',
524               ]
525             },
526             {
527               'action_name': 'jar_src_<(_target_name)',
528               'inputs': ['cronet/tools/jar_src.py'] ,
529               'outputs': ['<(package_dir)/<(java_src_lib)'],
530               'action': [
531                 'python',
532                 '<@(_inputs)',
533                 '--src-dir=cronet/android/java/src',
534                 '--jar-path=<(package_dir)/<(java_src_lib)',
535               ],
536             },
537             {
538               'action_name': 'jar_sample_src_<(_target_name)',
539               'inputs': ['cronet/tools/jar_src.py'] ,
540               'outputs': ['<(package_dir)/<(java_sample_src_lib)'],
541               'action': [
542                 'python',
543                 '<@(_inputs)',
544                 '--src-dir=cronet/android/sample',
545                 '--jar-path=<(package_dir)/<(java_sample_src_lib)',
546               ],
547             },
548             {
549               'action_name': 'generate licenses',
550               'inputs': ['cronet/tools/cronet_licenses.py'] ,
551               'outputs': ['<(package_dir)/LICENSE'],
552               'action': [
553                 'python',
554                 '<@(_inputs)',
555                 'license',
556                 '<@(_outputs)',
557               ],
558             },
559             {
560               'action_name': 'generate javadoc',
561               'inputs': ['cronet/tools/generate_javadoc.py'] ,
562               'outputs': ['<(package_dir)/javadoc'],
563               'action': [
564                 'python',
565                 '<@(_inputs)',
566                 '--source-dir=src',
567                 '--output-dir=<(package_dir)/javadoc',
568                 '--working-dir=cronet/android/java',
569               ],
570               'message': 'Generating Javadoc',
571             },
572           ],
573           'copies': [
574             {
575               'destination': '<(package_dir)',
576               'files': [
577                 '../AUTHORS',
578                 '../chrome/VERSION',
579                 'cronet/android/proguard.cfg',
580                 '<(lib_java_dir)/<(java_api_lib)'
581               ],
582             },
583             {
584               'destination': '<(package_dir)/symbols/<(android_app_abi)',
585               'files': [
586                 '<(SHARED_LIB_DIR)/<(native_lib)',
587               ],
588             },
589           ],
590         },
591       ],
592       'variables': {
593         'enable_data_reduction_proxy_support%': 0,
594       },
595     }],  # OS=="android"
596   ],