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