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