Stack sampling profiler: add fire-and-forget interface
[chromium-blink-merge.git] / components / cronet.gypi
blob3ff2c61c02efd9bd4f5990e4e50dd9ba84d9afa3
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           'includes': [ 'cronet/cronet_static.gypi' ],
162         },
163         {
164           # cronet_static target depends on ICU and includes file and ftp support.
165           'target_name': 'cronet_static',
166           'type': 'static_library',
167           'dependencies': [
168             '../base/base.gyp:base_i18n',
169             '../net/net.gyp:net',
170           ],
171           'includes': [ 'cronet/cronet_static.gypi' ],
172         },
173         {
174           'target_name': 'libcronet',
175           'type': 'shared_library',
176           'sources': [
177             'cronet/android/cronet_jni.cc',
178           ],
179           'dependencies': [
180             'cronet_static_small',
181             '../base/base.gyp:base',
182             '../net/net.gyp:net_small',
183             '../url/url.gyp:url_lib_use_icu_alternatives_on_android',
184           ],
185         },
186         { # cronet_api.jar defines Cronet API and provides implementation of
187           # legacy api using HttpUrlConnection (not the Chromium stack).
188           'target_name': 'cronet_api',
189           'type': 'none',
190           'dependencies': [
191             'cronet_url_request_context_config_list',
192             'cronet_version',
193             'load_states_list',
194           ],
195           'variables': {
196             'java_in_dir': 'cronet/android/java',
197             'javac_includes': [
198               '**/ChunkedWritableByteChannel.java',
199               '**/ExtendedResponseInfo.java',
200               '**/HistogramManager.java',
201               '**/HttpUrlConnection*.java',
202               '**/HttpUrlRequest*.java',
203               '**/LoadState.java',
204               '**/RequestStatus.java',
205               '**/ResponseInfo.java',
206               '**/ResponseTooLargeException.java',
207               '**/StatusListener.java',
208               '**/UploadDataProvider.java',
209               '**/UploadDataSink.java',
210               '**/UrlRequest.java',
211               '**/UrlRequestContext.java',
212               '**/UrlRequestContextConfig.java',
213               '**/UrlRequestContextConfigList.java',
214               '**/UrlRequestException.java',
215               '**/UrlRequestListener.java',
216               '**/UserAgent.java',
217               '**/Version.java',
218             ],
219           },
220           'includes': [ '../build/java.gypi' ],
221         },
222         { # cronet.jar implements HttpUrlRequest interface using Chromium stack
223           # in native libcronet.so library.
224           'target_name': 'cronet_java',
225           'type': 'none',
226           'dependencies': [
227             '../base/base.gyp:base',
228             'cronet_api',
229             'cronet_url_request_java',
230             'libcronet',
231             'net_request_priority_java',
232           ],
233           'variables': {
234             'java_in_dir': 'cronet/android/java',
235             'javac_includes': [
236               '**/ChromiumAsyncUrlRequest.java',
237               '**/ChromiumUrlRequest.java',
238               '**/ChromiumUrlRequestContext.java',
239               '**/ChromiumUrlRequestError.java',
240               '**/ChromiumUrlRequestFactory.java',
241               '**/ChromiumUrlRequestPriority.java',
242               '**/CronetHistogramManager.java',
243               '**/CronetResponseInfo.java',
244               '**/CronetLibraryLoader.java',
245               '**/CronetUploadDataStream.java',
246               '**/CronetUrlRequest.java',
247               '**/CronetUrlRequestContext.java',
248               '**/CronetUrlRequestFactory.java',
249               '**/RequestPriority.java',
250               '**/urlconnection/CronetBufferedOutputStream.java',
251               '**/urlconnection/CronetChunkedOutputStream.java',
252               '**/urlconnection/CronetFixedModeOutputStream.java',
253               '**/urlconnection/CronetInputStream.java',
254               '**/urlconnection/CronetHttpURLConnection.java',
255               '**/urlconnection/CronetHttpURLStreamHandler.java',
256               '**/urlconnection/CronetOutputStream.java',
257               '**/urlconnection/CronetURLStreamHandlerFactory.java',
258               '**/urlconnection/MessageLoop.java',
259             ],
260           },
261           'includes': [ '../build/java.gypi' ],
262         },
263         {
264           'target_name': 'cronet_sample_apk',
265           'type': 'none',
266           'dependencies': [
267             'cronet_java',
268             'cronet_api',
269           ],
270           'variables': {
271             'apk_name': 'CronetSample',
272             'java_in_dir': 'cronet/android/sample',
273             'resource_dir': 'cronet/android/sample/res',
274             'native_lib_target': 'libcronet',
275             'proguard_enabled': 'true',
276             'proguard_flags_paths': [
277               'cronet/android/proguard.cfg',
278               'cronet/android/sample/javatests/proguard.cfg',
279             ],
280           },
281           'includes': [ '../build/java_apk.gypi' ],
282         },
283         {
284           # cronet_sample_apk creates a .jar as a side effect. Any java targets
285           # that need that .jar in their classpath should depend on this target,
286           # cronet_sample_apk_java. Dependents of cronet_sample_apk receive its
287           # jar path in the variable 'apk_output_jar_path'. This target should
288           # only be used by targets which instrument cronet_sample_apk.
289           'target_name': 'cronet_sample_apk_java',
290           'type': 'none',
291           'dependencies': [
292             'cronet_sample_apk',
293           ],
294           'includes': [ '../build/apk_fake_jar.gypi' ],
295         },
296         {
297           'target_name': 'cronet_sample_test_apk',
298           'type': 'none',
299           'dependencies': [
300             'cronet_java',
301             'cronet_sample_apk_java',
302             'cronet_api',
303             '../base/base.gyp:base_java_test_support',
304           ],
305           'variables': {
306             'apk_name': 'CronetSampleTest',
307             'java_in_dir': 'cronet/android/sample/javatests',
308             'is_test_apk': 1,
309           },
310           'includes': [ '../build/java_apk.gypi' ],
311         },
312         {
313           'target_name': 'cronet_tests_jni_headers',
314           'type': 'none',
315           'sources': [
316             'cronet/android/test/src/org/chromium/net/CronetTestUtil.java',
317             'cronet/android/test/src/org/chromium/net/MockUrlRequestJobFactory.java',
318             'cronet/android/test/src/org/chromium/net/NativeTestServer.java',
319             'cronet/android/test/src/org/chromium/net/NetworkChangeNotifierUtil.java',
320             'cronet/android/test/src/org/chromium/net/QuicTestServer.java',
321             'cronet/android/test/src/org/chromium/net/SdchObserver.java',
322             'cronet/android/test/src/org/chromium/net/TestUploadDataStreamHandler.java',
323           ],
324           'variables': {
325             'jni_gen_package': 'cronet_tests',
326           },
327           'includes': [ '../build/jni_generator.gypi' ],
328         },
329         {
330           'target_name': 'libcronet_tests',
331           'type': 'shared_library',
332           'sources': [
333             'cronet/android/test/cronet_test_jni.cc',
334             'cronet/android/test/mock_url_request_job_factory.cc',
335             'cronet/android/test/mock_url_request_job_factory.h',
336             'cronet/android/test/native_test_server.cc',
337             'cronet/android/test/native_test_server.h',
338             'cronet/android/test/quic_test_server.cc',
339             'cronet/android/test/quic_test_server.h',
340             'cronet/android/test/sdch_test_util.cc',
341             'cronet/android/test/sdch_test_util.h',
342             'cronet/android/test/test_upload_data_stream_handler.cc',
343             'cronet/android/test/test_upload_data_stream_handler.h',
344             'cronet/android/test/network_change_notifier_util.cc',
345             'cronet/android/test/network_change_notifier_util.h',
346           ],
347           'dependencies': [
348             'cronet_tests_jni_headers',
349             '../base/base.gyp:base',
350             '../net/net.gyp:net',
351             '../net/net.gyp:net_quic_proto',
352             '../net/net.gyp:net_test_support',
353             '../net/net.gyp:simple_quic_tools',
354             '../url/url.gyp:url_lib',
355             '../base/base.gyp:base_i18n',
356             '../third_party/icu/icu.gyp:icui18n',
357             '../third_party/icu/icu.gyp:icuuc',
358           ],
359           'defines': [
360             'CRONET_TEST=1',
361           ],
362           'includes': [ 'cronet/cronet_static.gypi' ],
363         },
364         {
365           'target_name': 'cronet_test_apk',
366           'type': 'none',
367           'dependencies': [
368             'cronet_java',
369             '../net/net.gyp:net_java_test_support',
370           ],
371           'variables': {
372             'apk_name': 'CronetTest',
373             'java_in_dir': 'cronet/android/test',
374             'resource_dir': 'cronet/android/test/res',
375             'asset_location': 'cronet/android/test/assets',
376             'native_lib_target': 'libcronet_tests',
377           },
378           'includes': [ '../build/java_apk.gypi' ],
379         },
380         {
381           # cronet_test_apk creates a .jar as a side effect. Any java targets
382           # that need that .jar in their classpath should depend on this target,
383           # cronet_test_apk_java. Dependents of cronet_test_apk receive its
384           # jar path in the variable 'apk_output_jar_path'. This target should
385           # only be used by targets which instrument cronet_test_apk.
386           'target_name': 'cronet_test_apk_java',
387           'type': 'none',
388           'dependencies': [
389             'cronet_test_apk',
390           ],
391           'includes': [ '../build/apk_fake_jar.gypi' ],
392         },
393         {
394           'target_name': 'cronet_test_instrumentation_apk',
395           'type': 'none',
396           'dependencies': [
397             'cronet_test_apk_java',
398             '../base/base.gyp:base_java_test_support',
399           ],
400           'variables': {
401             'apk_name': 'CronetTestInstrumentation',
402             'java_in_dir': 'cronet/android/test/javatests',
403             'resource_dir': 'cronet/android/test/res',
404             'is_test_apk': 1,
405           },
406           'includes': [ '../build/java_apk.gypi' ],
407         },
408         {
409           'target_name': 'cronet_perf_test_apk',
410           'type': 'none',
411           'dependencies': [
412             'cronet_java',
413             'cronet_api',
414           ],
415           'variables': {
416             'apk_name': 'CronetPerfTest',
417             'java_in_dir': 'cronet/android/test/javaperftests',
418             'is_test_apk': 1,
419             'native_lib_target': 'libcronet',
420             'proguard_enabled': 'true',
421             'proguard_flags_paths': [
422               'cronet/android/proguard.cfg',
423             ],
424           },
425           'includes': [ '../build/java_apk.gypi' ],
426         },
427         {
428           'target_name': 'cronet_package',
429           'type': 'none',
430           'dependencies': [
431             'libcronet',
432             'cronet_java',
433             'cronet_api',
434             '../net/net.gyp:net_unittests_apk',
435           ],
436           'variables': {
437             'native_lib': 'libcronet.>(android_product_extension)',
438             'java_lib': 'cronet.jar',
439             'java_api_lib': 'cronet_api.jar',
440             'java_src_lib': 'cronet-src.jar',
441             'java_sample_src_lib': 'cronet-sample-src.jar',
442             'lib_java_dir': '<(PRODUCT_DIR)/lib.java',
443             'package_dir': '<(PRODUCT_DIR)/cronet',
444             'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/cronet',
445             'jar_extract_dir': '<(intermediate_dir)/cronet_jar_extract',
446             'jar_extract_stamp': '<(intermediate_dir)/jar_extract.stamp',
447             'cronet_jar_stamp': '<(intermediate_dir)/cronet_jar.stamp',
448           },
449           'actions': [
450             {
451               'action_name': 'strip libcronet',
452               'inputs': ['<(SHARED_LIB_DIR)/<(native_lib)'],
453               'outputs': ['<(package_dir)/libs/<(android_app_abi)/<(native_lib)'],
454               'action': [
455                 '<(android_strip)',
456                 '--strip-unneeded',
457                 '<@(_inputs)',
458                 '-o',
459                 '<@(_outputs)',
460               ],
461             },
462             {
463               'action_name': 'extracting from jars',
464               'inputs':  [
465                 '<(lib_java_dir)/cronet_java.jar',
466                 '<(lib_java_dir)/base_java.jar',
467                 '<(lib_java_dir)/net_java.jar',
468                 '<(lib_java_dir)/url_java.jar',
469               ],
470               'outputs': ['<(jar_extract_stamp)', '<(jar_extract_dir)'],
471               'action': [
472                 'python',
473                 'cronet/tools/extract_from_jars.py',
474                 '--classes-dir=<(jar_extract_dir)',
475                 '--jars=<@(_inputs)',
476                 '--stamp=<(jar_extract_stamp)',
477               ],
478             },
479             {
480               'action_name': 'jar_<(_target_name)',
481               'message': 'Creating <(_target_name) jar',
482               'inputs': [
483                 '<(DEPTH)/build/android/gyp/util/build_utils.py',
484                 '<(DEPTH)/build/android/gyp/util/md5_check.py',
485                 '<(DEPTH)/build/android/gyp/jar.py',
486                 '<(jar_extract_stamp)',
487               ],
488               'outputs': [
489                 '<(package_dir)/<(java_lib)',
490                 '<(cronet_jar_stamp)',
491               ],
492               'action': [
493                 'python', '<(DEPTH)/build/android/gyp/jar.py',
494                 '--classes-dir=<(jar_extract_dir)',
495                 '--jar-path=<(package_dir)/<(java_lib)',
496                 '--stamp=<(cronet_jar_stamp)',
497               ]
498             },
499             {
500               'action_name': 'jar_src_<(_target_name)',
501               'inputs': ['cronet/tools/jar_src.py'] ,
502               'outputs': ['<(package_dir)/<(java_src_lib)'],
503               'action': [
504                 'python',
505                 '<@(_inputs)',
506                 '--src-dir=cronet/android/java/src',
507                 '--jar-path=<(package_dir)/<(java_src_lib)',
508               ],
509             },
510             {
511               'action_name': 'jar_sample_src_<(_target_name)',
512               'inputs': ['cronet/tools/jar_src.py'] ,
513               'outputs': ['<(package_dir)/<(java_sample_src_lib)'],
514               'action': [
515                 'python',
516                 '<@(_inputs)',
517                 '--src-dir=cronet/android/sample',
518                 '--jar-path=<(package_dir)/<(java_sample_src_lib)',
519               ],
520             },
521             {
522               'action_name': 'generate licenses',
523               'inputs': ['cronet/tools/cronet_licenses.py'] ,
524               'outputs': ['<(package_dir)/LICENSE'],
525               'action': [
526                 'python',
527                 '<@(_inputs)',
528                 'license',
529                 '<@(_outputs)',
530               ],
531             },
532             {
533               'action_name': 'generate javadoc',
534               'inputs': ['cronet/tools/generate_javadoc.py'] ,
535               'outputs': ['<(package_dir)/javadoc'],
536               'action': [
537                 'python',
538                 '<@(_inputs)',
539                 '--source-dir=src',
540                 '--output-dir=<(package_dir)/javadoc',
541                 '--working-dir=cronet/android/java',
542               ],
543               'message': 'Generating Javadoc',
544             },
545           ],
546           'copies': [
547             {
548               'destination': '<(package_dir)',
549               'files': [
550                 '../AUTHORS',
551                 '../chrome/VERSION',
552                 'cronet/android/proguard.cfg',
553                 '<(lib_java_dir)/<(java_api_lib)'
554               ],
555             },
556             {
557               'destination': '<(package_dir)/symbols/<(android_app_abi)',
558               'files': [
559                 '<(SHARED_LIB_DIR)/<(native_lib)',
560               ],
561             },
562           ],
563         },
564       ],
565       'variables': {
566         'enable_data_reduction_proxy_support%': 0,
567       },
568     }],  # OS=="android"
569   ],