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/UrlRequest.java', 15 'cronet/android/java/src/org/chromium/net/UrlRequestContext.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/UrlRequestError.template', 27 ], 28 'variables': { 29 'package_name': 'org/chromium/cronet', 30 'template_deps': ['cronet/android/org_chromium_net_UrlRequest_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/UrlRequestPriority.template', 39 ], 40 'variables': { 41 'package_name': 'org/chromium/cronet', 42 'template_deps': ['cronet/android/org_chromium_net_UrlRequest_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': 'libcronet', 60 'type': 'shared_library', 61 'dependencies': [ 62 '../base/base.gyp:base', 63 '../base/base.gyp:base_i18n', 64 '../third_party/icu/icu.gyp:icui18n', 65 '../third_party/icu/icu.gyp:icuuc', 66 '../url/url.gyp:url_lib', 67 'cronet_jni_headers', 68 'cronet_url_request_context_config_list', 69 'cronet_url_request_error_list', 70 'cronet_url_request_priority_list', 71 '../net/net.gyp:net', 72 ], 73 'sources': [ 74 'cronet/url_request_context_config.cc', 75 'cronet/url_request_context_config.h', 76 'cronet/url_request_context_config_list.h', 77 'cronet/android/cronet_jni.cc', 78 'cronet/android/org_chromium_net_UrlRequest.cc', 79 'cronet/android/org_chromium_net_UrlRequest.h', 80 'cronet/android/org_chromium_net_UrlRequest_error_list.h', 81 'cronet/android/org_chromium_net_UrlRequest_priority_list.h', 82 'cronet/android/org_chromium_net_UrlRequestContext.cc', 83 'cronet/android/org_chromium_net_UrlRequestContext.h', 84 'cronet/android/org_chromium_net_UrlRequestContext_config_list.h', 85 'cronet/android/url_request_context_peer.cc', 86 'cronet/android/url_request_context_peer.h', 87 'cronet/android/url_request_peer.cc', 88 'cronet/android/url_request_peer.h', 89 ], 90 'cflags': [ 91 # TODO(mef): Figure out a good way to get version from chrome_version_info_posix.h. 92 '-DCHROMIUM_VERSION=\\"TBD\\"', 93 '-DLOGGING=1', 94 '-fdata-sections', 95 '-ffunction-sections', 96 '-fno-rtti', 97 '-fvisibility=hidden', 98 '-fvisibility-inlines-hidden', 99 '-Wno-sign-promo', 100 '-Wno-missing-field-initializers', 101 ], 102 'ldflags': [ 103 '-llog', 104 '-landroid', 105 '-Wl,--gc-sections', 106 '-Wl,--exclude-libs,ALL' 107 ], 108 'conditions': [ 109 [ 'use_icu_alternatives_on_android == 1', { 110 'dependencies!': [ 111 '../base/base.gyp:base_i18n', 112 '../third_party/icu/icu.gyp:icui18n', 113 '../third_party/icu/icu.gyp:icuuc', 114 ] 115 }, 116 ], 117 ], 118 }, 119 { 120 'target_name': 'cronet', 121 'type': 'none', 122 'dependencies': [ 123 '../base/base.gyp:base', 124 'libcronet', 125 'cronet_url_request_error_list', 126 'cronet_url_request_priority_list', 127 ], 128 'variables': { 129 'java_in_dir': 'cronet/android/java', 130 }, 131 'includes': [ '../build/java.gypi' ], 132 }, 133 { 134 'target_name': 'cronet_package', 135 'type': 'none', 136 'dependencies': [ 137 'libcronet', 138 'cronet', 139 ], 140 'variables': { 141 'native_lib': 'libcronet.>(android_product_extension)', 142 'java_lib': 'cronet.jar', 143 'package_dir': '<(PRODUCT_DIR)/cronet', 144 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/cronet', 145 'jar_extract_dir': '<(intermediate_dir)/cronet_jar_extract', 146 'jar_excluded_classes': [ 147 '*/BaseChromiumApp*.class', 148 ], 149 'jar_extract_stamp': '<(intermediate_dir)/jar_extract.stamp', 150 'cronet_jar_stamp': '<(intermediate_dir)/cronet_jar.stamp', 151 }, 152 'actions': [ 153 { 154 'action_name': 'strip libcronet', 155 'inputs': ['<(SHARED_LIB_DIR)/<(native_lib)'], 156 'outputs': ['<(package_dir)/libs/<(android_app_abi)/<(native_lib)'], 157 'action': [ 158 '<(android_strip)', 159 '--strip-unneeded', 160 '<@(_inputs)', 161 '-o', 162 '<@(_outputs)', 163 ], 164 }, 165 { 166 'action_name': 'extracting from jars', 167 'inputs': [ 168 '<(PRODUCT_DIR)/lib.java/<(java_lib)', 169 '<(PRODUCT_DIR)/lib.java/base_java.jar', 170 '<(PRODUCT_DIR)/lib.java/net_java.jar', 171 '<(PRODUCT_DIR)/lib.java/url_java.jar', 172 ], 173 'outputs': ['<(jar_extract_stamp)', '<(jar_extract_dir)'], 174 'action': [ 175 'python', 176 'cronet/tools/extract_from_jars.py', 177 '--classes-dir=<(jar_extract_dir)', 178 '--jars=<@(_inputs)', 179 '--stamp=<(jar_extract_stamp)', 180 ], 181 }, 182 { 183 'action_name': 'jar_<(_target_name)', 184 'message': 'Creating <(_target_name) jar', 185 'inputs': [ 186 '<(DEPTH)/build/android/gyp/util/build_utils.py', 187 '<(DEPTH)/build/android/gyp/util/md5_check.py', 188 '<(DEPTH)/build/android/gyp/jar.py', 189 '<(jar_extract_stamp)', 190 ], 191 'outputs': [ 192 '<(package_dir)/<(java_lib)', 193 '<(cronet_jar_stamp)', 194 ], 195 'action': [ 196 'python', '<(DEPTH)/build/android/gyp/jar.py', 197 '--classes-dir=<(jar_extract_dir)', 198 '--jar-path=<(package_dir)/<(java_lib)', 199 '--excluded-classes=<@(jar_excluded_classes)', 200 '--stamp=<(cronet_jar_stamp)', 201 ] 202 }, 203 { 204 'action_name': 'generate licenses', 205 'inputs': ['cronet/tools/cronet_licenses.py'] , 206 'outputs': ['<(package_dir)/LICENSE'], 207 'action': [ 208 'python', 209 '<@(_inputs)', 210 'license', 211 '<@(_outputs)', 212 ], 213 }, 214 ], 215 'copies': [ 216 { 217 'destination': '<(package_dir)', 218 'files': [ 219 '../AUTHORS', 220 '../chrome/VERSION', 221 ], 222 }, 223 ], 224 }, 225 { 226 'target_name': 'cronet_sample_apk', 227 'type': 'none', 228 'dependencies': [ 229 'cronet', 230 ], 231 'variables': { 232 'apk_name': 'CronetSample', 233 'java_in_dir': 'cronet/android/sample', 234 'resource_dir': 'cronet/android/sample/res', 235 'native_lib_target': 'libcronet', 236 }, 237 'includes': [ '../build/java_apk.gypi' ], 238 }, 239 { 240 # cronet_sample_apk creates a .jar as a side effect. Any java targets 241 # that need that .jar in their classpath should depend on this target, 242 # cronet_sample_apk_java. Dependents of cronet_sample_apk receive its 243 # jar path in the variable 'apk_output_jar_path'. This target should 244 # only be used by targets which instrument cronet_sample_apk. 245 'target_name': 'cronet_sample_apk_java', 246 'type': 'none', 247 'dependencies': [ 248 'cronet_sample_apk', 249 ], 250 'includes': [ '../build/apk_fake_jar.gypi' ], 251 }, 252 { 253 'target_name': 'cronet_sample_test_apk', 254 'type': 'none', 255 'dependencies': [ 256 'cronet_sample_apk_java', 257 '../base/base.gyp:base_java', 258 '../base/base.gyp:base_javatests', 259 '../base/base.gyp:base_java_test_support', 260 # TODO(mef): Figure out why some tests are failing. 261 #'../net/net.gyp:net_javatests', 262 #'../net/net.gyp:net_java_test_support', 263 ], 264 'variables': { 265 'apk_name': 'CronetSampleTest', 266 'java_in_dir': 'cronet/android/sample/javatests', 267 'resource_dir': 'cronet/android/sample/res', 268 'is_test_apk': 1, 269 }, 270 'includes': [ '../build/java_apk.gypi' ], 271 }, 272 ], 273 }], # OS=="android" 274 ], 275} 276