Add InstallSplitApk function to device utils.
[chromium-blink-merge.git] / components / cronet.gypi
blob52f69bbc47f843e64ab54eb0141b0c920717dd98
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': 'cronet_version',
57           'type': 'none',
58           'variables': {
59             'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
60             'version_py_path': '<(DEPTH)/build/util/version.py',
61             'version_path': '<(DEPTH)/chrome/VERSION',
62             'template_input_path': 'cronet/android/java/src/org/chromium/net/Version.template',
63             'output_path': '<(SHARED_INTERMEDIATE_DIR)/templates/<(_target_name)/org/chromium/cronet/Version.java',
64           },
65           'direct_dependent_settings': {
66             'variables': {
67               # Ensure that the output directory is used in the class path
68               # when building targets that depend on this one.
69               'generated_src_dirs': [
70                 '<(SHARED_INTERMEDIATE_DIR)/templates/<(_target_name)',
71               ],
72               # Ensure dependents are rebuilt when the generated Java file changes.
73               'additional_input_paths': [
74                 '<(output_path)',
75               ],
76             },
77           },
78           'actions': [
79             {
80               'action_name': 'cronet_version',
81               'inputs': [
82                 '<(template_input_path)',
83                 '<(version_path)',
84                 '<(lastchange_path)',
85               ],
86               'outputs': [
87                 '<(output_path)',
88               ],
89               'action': [
90                 'python',
91                 '<(version_py_path)',
92                 '-f', '<(version_path)',
93                 '-f', '<(lastchange_path)',
94                 '<(template_input_path)',
95                 '<(output_path)',
96               ],
97               'message': 'Generating version information',
98             },
99           ],
100         },
101         {
102           'target_name': 'cronet_version_header',
103           'type': 'none',
104           # Need to set hard_depency flag because cronet_version generates a
105           # header.
106           'hard_dependency': 1,
107           'direct_dependent_settings': {
108             'include_dirs': [
109               '<(SHARED_INTERMEDIATE_DIR)/',
110             ],
111           },
112           'actions': [
113             {
114               'action_name': 'version_header',
115               'message': 'Generating version header file: <@(_outputs)',
116               'inputs': [
117                 '<(version_path)',
118                 'cronet/version.h.in',
119               ],
120               'outputs': [
121                 '<(SHARED_INTERMEDIATE_DIR)/components/cronet/version.h',
122               ],
123               'action': [
124                 'python',
125                 '<(version_py_path)',
126                 '-e', 'VERSION_FULL="<(version_full)"',
127                 'cronet/version.h.in',
128                 '<@(_outputs)',
129               ],
130               'includes': [
131                 '../build/util/version.gypi',
132               ],
133             },
134           ],
135         },
136         {
137           # cronet_static_small target has reduced binary size through using
138           # ICU alternatives which requires file and ftp support be disabled.
139           'target_name': 'cronet_static_small',
140           'defines': [
141             'USE_ICU_ALTERNATIVES_ON_ANDROID=1',
142             'DISABLE_FILE_SUPPORT=1',
143             'DISABLE_FTP_SUPPORT=1',
144           ],
145           'dependencies': [
146             '../net/net.gyp:net_small',
147           ],
148           'includes': [ 'cronet/cronet_static.gypi' ],
149           'conditions': [
150             ['enable_data_reduction_proxy_support==1',
151               {
152                 'dependencies': [
153                   '../components/components.gyp:data_reduction_proxy_core_browser_small',
154                 ],
155               },
156             ],
157           ],
158         },
159         {
160           # cronet_static target depends on ICU and includes file and ftp support.
161           'target_name': 'cronet_static',
162           'dependencies': [
163             '../base/base.gyp:base_i18n',
164             '../net/net.gyp:net',
165           ],
166           'includes': [ 'cronet/cronet_static.gypi' ],
167           'conditions': [
168             ['enable_data_reduction_proxy_support==1',
169               {
170                 'dependencies': [
171                   '../components/components.gyp:data_reduction_proxy_core_browser',
172                 ],
173               },
174             ],
175           ],
176         },
177         {
178           'target_name': 'libcronet',
179           'type': 'shared_library',
180           'sources': [
181             'cronet/android/cronet_jni.cc',
182           ],
183           'dependencies': [
184             'cronet_static_small',
185             '../base/base.gyp:base',
186             '../net/net.gyp:net_small',
187             '../url/url.gyp:url_lib_use_icu_alternatives_on_android',
188           ],
189         },
190         { # cronet_api.jar defines Cronet API and provides implementation of
191           # legacy api using HttpUrlConnection (not the Chromium stack).
192           'target_name': 'cronet_api',
193           'type': 'none',
194           'dependencies': [
195             'cronet_url_request_context_config_list',
196             'cronet_version',
197           ],
198           'variables': {
199             'java_in_dir': 'cronet/android/java',
200             'javac_includes': [
201               '**/ChunkedWritableByteChannel.java',
202               '**/ExtendedResponseInfo.java',
203               '**/HistogramManager.java',
204               '**/HttpUrlConnection*.java',
205               '**/HttpUrlRequest*.java',
206               '**/ResponseInfo.java',
207               '**/ResponseTooLargeException.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/CronetFixedModeOutputStream.java',
252               '**/urlconnection/CronetInputStream.java',
253               '**/urlconnection/CronetHttpURLConnection.java',
254               '**/urlconnection/CronetHttpURLStreamHandler.java',
255               '**/urlconnection/CronetOutputStream.java',
256               '**/urlconnection/CronetURLStreamHandlerFactory.java',
257               '**/urlconnection/MessageLoop.java',
258             ],
259           },
260           'includes': [ '../build/java.gypi' ],
261         },
262         {
263           'target_name': 'cronet_sample_apk',
264           'type': 'none',
265           'dependencies': [
266             'cronet_java',
267             'cronet_api',
268           ],
269           'variables': {
270             'apk_name': 'CronetSample',
271             'java_in_dir': 'cronet/android/sample',
272             'resource_dir': 'cronet/android/sample/res',
273             'native_lib_target': 'libcronet',
274             'proguard_enabled': 'true',
275             'proguard_flags_paths': [
276               'cronet/android/proguard.cfg',
277               'cronet/android/sample/javatests/proguard.cfg',
278             ],
279           },
280           'includes': [ '../build/java_apk.gypi' ],
281         },
282         {
283           # cronet_sample_apk creates a .jar as a side effect. Any java targets
284           # that need that .jar in their classpath should depend on this target,
285           # cronet_sample_apk_java. Dependents of cronet_sample_apk receive its
286           # jar path in the variable 'apk_output_jar_path'. This target should
287           # only be used by targets which instrument cronet_sample_apk.
288           'target_name': 'cronet_sample_apk_java',
289           'type': 'none',
290           'dependencies': [
291             'cronet_sample_apk',
292           ],
293           'includes': [ '../build/apk_fake_jar.gypi' ],
294         },
295         {
296           'target_name': 'cronet_sample_test_apk',
297           'type': 'none',
298           'dependencies': [
299             'cronet_java',
300             'cronet_sample_apk_java',
301             'cronet_api',
302             '../base/base.gyp:base_java_test_support',
303           ],
304           'variables': {
305             'apk_name': 'CronetSampleTest',
306             'java_in_dir': 'cronet/android/sample/javatests',
307             'resource_dir': 'cronet/android/sample/res',
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_static',
349             'cronet_tests_jni_headers',
350             '../base/base.gyp:base',
351             '../net/net.gyp:net',
352             '../net/net.gyp:net_quic_proto',
353             '../net/net.gyp:net_test_support',
354             '../net/net.gyp:simple_quic_tools',
355             '../url/url.gyp:url_lib',
356             '../base/base.gyp:base_i18n',
357             '../third_party/icu/icu.gyp:icui18n',
358             '../third_party/icu/icu.gyp:icuuc',
359           ],
360           'conditions' : [
361             ['enable_data_reduction_proxy_support==1',
362               {
363                 'defines' : [
364                   'DATA_REDUCTION_PROXY_SUPPORT'
365                 ],
366               },
367             ],
368           ],
369         },
370         {
371           'target_name': 'cronet_test_apk',
372           'type': 'none',
373           'dependencies': [
374             'cronet_java',
375             '../net/net.gyp:net_java_test_support',
376           ],
377           'variables': {
378             'apk_name': 'CronetTest',
379             'java_in_dir': 'cronet/android/test',
380             'resource_dir': 'cronet/android/test/res',
381             'asset_location': 'cronet/android/test/assets',
382             'native_lib_target': 'libcronet_tests',
383           },
384           'includes': [ '../build/java_apk.gypi' ],
385         },
386         {
387           # cronet_test_apk creates a .jar as a side effect. Any java targets
388           # that need that .jar in their classpath should depend on this target,
389           # cronet_test_apk_java. Dependents of cronet_test_apk receive its
390           # jar path in the variable 'apk_output_jar_path'. This target should
391           # only be used by targets which instrument cronet_test_apk.
392           'target_name': 'cronet_test_apk_java',
393           'type': 'none',
394           'dependencies': [
395             'cronet_test_apk',
396           ],
397           'includes': [ '../build/apk_fake_jar.gypi' ],
398         },
399         {
400           'target_name': 'cronet_test_instrumentation_apk',
401           'type': 'none',
402           'dependencies': [
403             'cronet_test_apk_java',
404             '../base/base.gyp:base_java_test_support',
405           ],
406           'variables': {
407             'apk_name': 'CronetTestInstrumentation',
408             'java_in_dir': 'cronet/android/test/javatests',
409             'resource_dir': 'cronet/android/test/res',
410             'is_test_apk': 1,
411           },
412           'includes': [ '../build/java_apk.gypi' ],
413         },
414         {
415           'target_name': 'cronet_perf_test_apk',
416           'type': 'none',
417           'dependencies': [
418             'cronet_java',
419             'cronet_api',
420           ],
421           'variables': {
422             'apk_name': 'CronetPerfTest',
423             'java_in_dir': 'cronet/android/test/javaperftests',
424             'is_test_apk': 1,
425             'native_lib_target': 'libcronet',
426             'proguard_enabled': 'true',
427             'proguard_flags_paths': [
428               'cronet/android/proguard.cfg',
429             ],
430           },
431           'includes': [ '../build/java_apk.gypi' ],
432         },
433         {
434           'target_name': 'cronet_package',
435           'type': 'none',
436           'dependencies': [
437             'libcronet',
438             'cronet_java',
439             'cronet_api',
440             '../net/net.gyp:net_unittests_apk',
441           ],
442           'variables': {
443             'native_lib': 'libcronet.>(android_product_extension)',
444             'java_lib': 'cronet.jar',
445             'java_api_lib': 'cronet_api.jar',
446             'java_src_lib': 'cronet-src.jar',
447             'java_sample_src_lib': 'cronet-sample-src.jar',
448             'lib_java_dir': '<(PRODUCT_DIR)/lib.java',
449             'package_dir': '<(PRODUCT_DIR)/cronet',
450             'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/cronet',
451             'jar_extract_dir': '<(intermediate_dir)/cronet_jar_extract',
452             'jar_extract_stamp': '<(intermediate_dir)/jar_extract.stamp',
453             'cronet_jar_stamp': '<(intermediate_dir)/cronet_jar.stamp',
454           },
455           'actions': [
456             {
457               'action_name': 'strip libcronet',
458               'inputs': ['<(SHARED_LIB_DIR)/<(native_lib)'],
459               'outputs': ['<(package_dir)/libs/<(android_app_abi)/<(native_lib)'],
460               'action': [
461                 '<(android_strip)',
462                 '--strip-unneeded',
463                 '<@(_inputs)',
464                 '-o',
465                 '<@(_outputs)',
466               ],
467             },
468             {
469               'action_name': 'extracting from jars',
470               'inputs':  [
471                 '<(lib_java_dir)/cronet_java.jar',
472                 '<(lib_java_dir)/base_java.jar',
473                 '<(lib_java_dir)/net_java.jar',
474                 '<(lib_java_dir)/url_java.jar',
475               ],
476               'outputs': ['<(jar_extract_stamp)', '<(jar_extract_dir)'],
477               'action': [
478                 'python',
479                 'cronet/tools/extract_from_jars.py',
480                 '--classes-dir=<(jar_extract_dir)',
481                 '--jars=<@(_inputs)',
482                 '--stamp=<(jar_extract_stamp)',
483               ],
484             },
485             {
486               'action_name': 'jar_<(_target_name)',
487               'message': 'Creating <(_target_name) jar',
488               'inputs': [
489                 '<(DEPTH)/build/android/gyp/util/build_utils.py',
490                 '<(DEPTH)/build/android/gyp/util/md5_check.py',
491                 '<(DEPTH)/build/android/gyp/jar.py',
492                 '<(jar_extract_stamp)',
493               ],
494               'outputs': [
495                 '<(package_dir)/<(java_lib)',
496                 '<(cronet_jar_stamp)',
497               ],
498               'action': [
499                 'python', '<(DEPTH)/build/android/gyp/jar.py',
500                 '--classes-dir=<(jar_extract_dir)',
501                 '--jar-path=<(package_dir)/<(java_lib)',
502                 '--stamp=<(cronet_jar_stamp)',
503               ]
504             },
505             {
506               'action_name': 'jar_src_<(_target_name)',
507               'inputs': ['cronet/tools/jar_src.py'] ,
508               'outputs': ['<(package_dir)/<(java_src_lib)'],
509               'action': [
510                 'python',
511                 '<@(_inputs)',
512                 '--src-dir=cronet/android/java/src',
513                 '--jar-path=<(package_dir)/<(java_src_lib)',
514               ],
515             },
516             {
517               'action_name': 'jar_sample_src_<(_target_name)',
518               'inputs': ['cronet/tools/jar_src.py'] ,
519               'outputs': ['<(package_dir)/<(java_sample_src_lib)'],
520               'action': [
521                 'python',
522                 '<@(_inputs)',
523                 '--src-dir=cronet/android/sample',
524                 '--jar-path=<(package_dir)/<(java_sample_src_lib)',
525               ],
526             },
527             {
528               'action_name': 'generate licenses',
529               'inputs': ['cronet/tools/cronet_licenses.py'] ,
530               'outputs': ['<(package_dir)/LICENSE'],
531               'action': [
532                 'python',
533                 '<@(_inputs)',
534                 'license',
535                 '<@(_outputs)',
536               ],
537             },
538             {
539               'action_name': 'generate javadoc',
540               'inputs': ['cronet/tools/generate_javadoc.py'] ,
541               'outputs': ['<(package_dir)/javadoc'],
542               'action': [
543                 'python',
544                 '<@(_inputs)',
545                 '--source-dir=src',
546                 '--output-dir=<(package_dir)/javadoc',
547                 '--working-dir=cronet/android/java',
548               ],
549               'message': 'Generating Javadoc',
550             },
551           ],
552           'copies': [
553             {
554               'destination': '<(package_dir)',
555               'files': [
556                 '../AUTHORS',
557                 '../chrome/VERSION',
558                 'cronet/android/proguard.cfg',
559                 '<(lib_java_dir)/<(java_api_lib)'
560               ],
561             },
562             {
563               'destination': '<(package_dir)/symbols/<(android_app_abi)',
564               'files': [
565                 '<(SHARED_LIB_DIR)/<(native_lib)',
566               ],
567             },
568           ],
569         },
570       ],
571       'variables': {
572         'enable_data_reduction_proxy_support%': 0,
573       },
574     }],  # OS=="android"
575   ],