[Enhanced Bookmark] Change "Bookmark Bar" to "Bookmark bar" on Android
[chromium-blink-merge.git] / components / cronet.gypi
blob3d94b445f6e7cb339a87be3949f44c8c604a5258
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           # cronet_static_small target has reduced binary size through using
103           # ICU alternatives which requires file and ftp support be disabled.
104           'target_name': 'cronet_static_small',
105           'defines': [
106             'USE_ICU_ALTERNATIVES_ON_ANDROID=1',
107             'DISABLE_FILE_SUPPORT=1',
108             'DISABLE_FTP_SUPPORT=1',
109           ],
110           'dependencies': [
111             '../net/net.gyp:net_small',
112           ],
113           'includes': [ 'cronet/cronet_static.gypi' ],
114         },
115         {
116           # cronet_static target depends on ICU and includes file and ftp support.
117           'target_name': 'cronet_static',
118           'dependencies': [
119             '../base/base.gyp:base_i18n',
120             '../net/net.gyp:net',
121           ],
122           'includes': [ 'cronet/cronet_static.gypi' ],
123         },
124         {
125           'target_name': 'libcronet',
126           'type': 'shared_library',
127           'sources': [
128             'cronet/android/cronet_jni.cc',
129           ],
130           'dependencies': [
131             'cronet_static_small',
132             '../base/base.gyp:base',
133             '../net/net.gyp:net_small',
134             '../url/url.gyp:url_lib_use_icu_alternatives_on_android',
135           ],
136         },
137         { # cronet_stub.jar defines HttpUrlRequest interface and provides its
138           # its implementation using HttpUrlConnection (not the Chromium stack).
139           'target_name': 'cronet_stub',
140           'type': 'none',
141           'dependencies': [
142             'cronet_url_request_context_config_list',
143             'cronet_version',
144           ],
145           'variables': {
146             'java_in_dir': 'cronet/android/java',
147             'javac_includes': [
148               '**/ChunkedWritableByteChannel.java',
149               '**/ExtendedResponseInfo.java',
150               '**/HistogramManager.java',
151               '**/HttpUrlConnection*.java',
152               '**/HttpUrlRequest*.java',
153               '**/ResponseInfo.java',
154               '**/ResponseTooLargeException.java',
155               '**/UploadDataProvider.java',
156               '**/UploadDataSink.java',
157               '**/UrlRequest.java',
158               '**/UrlRequestContext.java',
159               '**/UrlRequestContextConfig.java',
160               '**/UrlRequestContextConfigList.java',
161               '**/UrlRequestException.java',
162               '**/UrlRequestListener.java',
163               '**/UserAgent.java',
164               '**/Version.java',
165             ],
166           },
167           'includes': [ '../build/java.gypi' ],
168         },
169         { # cronet.jar implements HttpUrlRequest interface using Chromium stack
170           # in native libcronet.so library.
171           'target_name': 'cronet',
172           'type': 'none',
173           'dependencies': [
174             '../base/base.gyp:base',
175             'cronet_stub',
176             'cronet_url_request_java',
177             'libcronet',
178             'net_request_priority_java',
179           ],
180           'variables': {
181             'java_in_dir': 'cronet/android/java',
182             'javac_includes': [
183               '**/ChromiumAsyncUrlRequest.java',
184               '**/ChromiumUrlRequest.java',
185               '**/ChromiumUrlRequestContext.java',
186               '**/ChromiumUrlRequestError.java',
187               '**/ChromiumUrlRequestFactory.java',
188               '**/ChromiumUrlRequestPriority.java',
189               '**/CronetHistogramManager.java',
190               '**/CronetResponseInfo.java',
191               '**/CronetLibraryLoader.java',
192               '**/CronetUploadDataStream.java',
193               '**/CronetUrlRequest.java',
194               '**/CronetUrlRequestContext.java',
195               '**/CronetUrlRequestFactory.java',
196               '**/RequestPriority.java',
197               '**/urlconnection/CronetInputStream.java',
198               '**/urlconnection/CronetHttpURLConnection.java',
199               '**/urlconnection/CronetHttpURLStreamHandler.java',
200               '**/urlconnection/CronetURLStreamHandlerFactory.java',
201               '**/urlconnection/MessageLoop.java',
202             ],
203           },
204           'includes': [ '../build/java.gypi' ],
205         },
206         {
207           'target_name': 'cronet_sample_apk',
208           'type': 'none',
209           'dependencies': [
210             'cronet',
211             'cronet_stub',
212           ],
213           'variables': {
214             'apk_name': 'CronetSample',
215             'java_in_dir': 'cronet/android/sample',
216             'resource_dir': 'cronet/android/sample/res',
217             'native_lib_target': 'libcronet',
218             'proguard_enabled': 'true',
219             'proguard_flags_paths': [
220               'cronet/android/proguard.cfg',
221               'cronet/android/sample/javatests/proguard.cfg',
222             ],
223           },
224           'includes': [ '../build/java_apk.gypi' ],
225         },
226         {
227           # cronet_sample_apk creates a .jar as a side effect. Any java targets
228           # that need that .jar in their classpath should depend on this target,
229           # cronet_sample_apk_java. Dependents of cronet_sample_apk receive its
230           # jar path in the variable 'apk_output_jar_path'. This target should
231           # only be used by targets which instrument cronet_sample_apk.
232           'target_name': 'cronet_sample_apk_java',
233           'type': 'none',
234           'dependencies': [
235             'cronet_sample_apk',
236           ],
237           'includes': [ '../build/apk_fake_jar.gypi' ],
238         },
239         {
240           'target_name': 'cronet_sample_test_apk',
241           'type': 'none',
242           'dependencies': [
243             'cronet',
244             'cronet_sample_apk_java',
245             'cronet_stub',
246             '../base/base.gyp:base_java_test_support',
247           ],
248           'variables': {
249             'apk_name': 'CronetSampleTest',
250             'java_in_dir': 'cronet/android/sample/javatests',
251             'resource_dir': 'cronet/android/sample/res',
252             'is_test_apk': 1,
253           },
254           'includes': [ '../build/java_apk.gypi' ],
255         },
256         {
257           'target_name': 'cronet_tests_jni_headers',
258           'type': 'none',
259           'sources': [
260             'cronet/android/test/src/org/chromium/net/CronetTestUtil.java',
261             'cronet/android/test/src/org/chromium/net/MockUrlRequestJobFactory.java',
262             'cronet/android/test/src/org/chromium/net/NativeTestServer.java',
263             'cronet/android/test/src/org/chromium/net/NetworkChangeNotifierUtil.java',
264             'cronet/android/test/src/org/chromium/net/TestUploadDataStreamHandler.java',
265           ],
266           'variables': {
267             'jni_gen_package': 'cronet_tests',
268           },
269           'includes': [ '../build/jni_generator.gypi' ],
270         },
271         {
272           'target_name': 'libcronet_tests',
273           'type': 'shared_library',
274           'sources': [
275             'cronet/android/test/cronet_test_jni.cc',
276             'cronet/android/test/mock_url_request_job_factory.cc',
277             'cronet/android/test/mock_url_request_job_factory.h',
278             'cronet/android/test/native_test_server.cc',
279             'cronet/android/test/native_test_server.h',
280             'cronet/android/test/test_upload_data_stream_handler.cc',
281             'cronet/android/test/test_upload_data_stream_handler.h',
282             'cronet/android/test/network_change_notifier_util.cc',
283             'cronet/android/test/network_change_notifier_util.h',
284           ],
285           'dependencies': [
286             'cronet_static',
287             'cronet_tests_jni_headers',
288             '../base/base.gyp:base',
289             '../net/net.gyp:net',
290             '../net/net.gyp:net_test_support',
291             '../net/net.gyp:simple_quic_tools',
292             '../url/url.gyp:url_lib',
293             '../base/base.gyp:base_i18n',
294             '../third_party/icu/icu.gyp:icui18n',
295             '../third_party/icu/icu.gyp:icuuc',
296           ],
297           'conditions': [
298             ['use_icu_alternatives_on_android==1',
299               {
300                 'sources': [
301                   '../net/base/directory_lister.cc',
302                   '../net/base/directory_lister.h',
303                   '../net/url_request/url_request_file_job.cc',
304                   '../net/url_request/url_request_file_job.h',
305                 ]
306               }
307             ],
308           ],
309         },
310         {
311           'target_name': 'cronet_test_apk',
312           'type': 'none',
313           'dependencies': [
314             'cronet',
315           ],
316           'variables': {
317             'apk_name': 'CronetTest',
318             'java_in_dir': 'cronet/android/test',
319             'resource_dir': 'cronet/android/test/res',
320             'asset_location': 'cronet/android/test/assets',
321             'native_lib_target': 'libcronet_tests',
322           },
323           'includes': [ '../build/java_apk.gypi' ],
324         },
325         {
326           # cronet_test_apk creates a .jar as a side effect. Any java targets
327           # that need that .jar in their classpath should depend on this target,
328           # cronet_test_apk_java. Dependents of cronet_test_apk receive its
329           # jar path in the variable 'apk_output_jar_path'. This target should
330           # only be used by targets which instrument cronet_test_apk.
331           'target_name': 'cronet_test_apk_java',
332           'type': 'none',
333           'dependencies': [
334             'cronet_test_apk',
335           ],
336           'includes': [ '../build/apk_fake_jar.gypi' ],
337         },
338         {
339           'target_name': 'cronet_test_instrumentation_apk',
340           'type': 'none',
341           'dependencies': [
342             'cronet_test_apk_java',
343             '../base/base.gyp:base_java_test_support',
344           ],
345           'variables': {
346             'apk_name': 'CronetTestInstrumentation',
347             'java_in_dir': 'cronet/android/test/javatests',
348             'resource_dir': 'cronet/android/test/res',
349             'is_test_apk': 1,
350           },
351           'includes': [ '../build/java_apk.gypi' ],
352         },
353         {
354           'target_name': 'cronet_package',
355           'type': 'none',
356           'dependencies': [
357             'libcronet',
358             'cronet',
359             'cronet_stub',
360           ],
361           'variables': {
362             'native_lib': 'libcronet.>(android_product_extension)',
363             'java_lib': 'cronet.jar',
364             'java_stub_lib': 'cronet_stub.jar',
365             'java_src_lib': 'cronet-src.jar',
366             'java_sample_src_lib': 'cronet-sample-src.jar',
367             'lib_java_dir': '<(PRODUCT_DIR)/lib.java',
368             'package_dir': '<(PRODUCT_DIR)/cronet',
369             'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/cronet',
370             'jar_extract_dir': '<(intermediate_dir)/cronet_jar_extract',
371             'jar_extract_stamp': '<(intermediate_dir)/jar_extract.stamp',
372             'cronet_jar_stamp': '<(intermediate_dir)/cronet_jar.stamp',
373           },
374           'actions': [
375             {
376               'action_name': 'strip libcronet',
377               'inputs': ['<(SHARED_LIB_DIR)/<(native_lib)'],
378               'outputs': ['<(package_dir)/libs/<(android_app_abi)/<(native_lib)'],
379               'action': [
380                 '<(android_strip)',
381                 '--strip-unneeded',
382                 '<@(_inputs)',
383                 '-o',
384                 '<@(_outputs)',
385               ],
386             },
387             {
388               'action_name': 'extracting from jars',
389               'inputs':  [
390                 '<(lib_java_dir)/<(java_lib)',
391                 '<(lib_java_dir)/base_java.jar',
392                 '<(lib_java_dir)/net_java.jar',
393                 '<(lib_java_dir)/url_java.jar',
394               ],
395               'outputs': ['<(jar_extract_stamp)', '<(jar_extract_dir)'],
396               'action': [
397                 'python',
398                 'cronet/tools/extract_from_jars.py',
399                 '--classes-dir=<(jar_extract_dir)',
400                 '--jars=<@(_inputs)',
401                 '--stamp=<(jar_extract_stamp)',
402               ],
403             },
404             {
405               'action_name': 'jar_<(_target_name)',
406               'message': 'Creating <(_target_name) jar',
407               'inputs': [
408                 '<(DEPTH)/build/android/gyp/util/build_utils.py',
409                 '<(DEPTH)/build/android/gyp/util/md5_check.py',
410                 '<(DEPTH)/build/android/gyp/jar.py',
411                 '<(jar_extract_stamp)',
412               ],
413               'outputs': [
414                 '<(package_dir)/<(java_lib)',
415                 '<(cronet_jar_stamp)',
416               ],
417               'action': [
418                 'python', '<(DEPTH)/build/android/gyp/jar.py',
419                 '--classes-dir=<(jar_extract_dir)',
420                 '--jar-path=<(package_dir)/<(java_lib)',
421                 '--stamp=<(cronet_jar_stamp)',
422               ]
423             },
424             {
425               'action_name': 'jar_src_<(_target_name)',
426               'inputs': ['cronet/tools/jar_src.py'] ,
427               'outputs': ['<(package_dir)/<(java_src_lib)'],
428               'action': [
429                 'python',
430                 '<@(_inputs)',
431                 '--src-dir=cronet/android/java/src',
432                 '--jar-path=<(package_dir)/<(java_src_lib)',
433               ],
434             },
435             {
436               'action_name': 'jar_sample_src_<(_target_name)',
437               'inputs': ['cronet/tools/jar_src.py'] ,
438               'outputs': ['<(package_dir)/<(java_sample_src_lib)'],
439               'action': [
440                 'python',
441                 '<@(_inputs)',
442                 '--src-dir=cronet/android/sample',
443                 '--jar-path=<(package_dir)/<(java_sample_src_lib)',
444               ],
445             },
446             {
447               'action_name': 'generate licenses',
448               'inputs': ['cronet/tools/cronet_licenses.py'] ,
449               'outputs': ['<(package_dir)/LICENSE'],
450               'action': [
451                 'python',
452                 '<@(_inputs)',
453                 'license',
454                 '<@(_outputs)',
455               ],
456             },
457           ],
458           'copies': [
459             {
460               'destination': '<(package_dir)',
461               'files': [
462                 '../AUTHORS',
463                 '../chrome/VERSION',
464                 'cronet/android/proguard.cfg',
465                 '<(lib_java_dir)/<(java_stub_lib)'
466               ],
467             },
468             {
469               'destination': '<(package_dir)/symbols/<(android_app_abi)',
470               'files': [
471                 '<(SHARED_LIB_DIR)/<(native_lib)',
472               ],
473             },
474           ],
475         },
476       ],
477     }],  # OS=="android"
478   ],