1// Copyright (C) 2025 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15soong_config_module_type { 16 name: "enable_cronet_tot_java_defaults", 17 module_type: "java_defaults", 18 config_namespace: "cronet", 19 bool_variables: [ 20 "enable_cronet_tot", 21 ], 22 properties: [ 23 "static_libs", 24 "jni_libs", 25 "asset_dirs", 26 "resource_dirs", 27 "data", 28 "srcs", 29 ], 30} 31 32soong_config_module_type { 33 name: "enable_cronet_tot_apex_defaults", 34 module_type: "apex_defaults", 35 config_namespace: "cronet", 36 bool_variables: [ 37 "enable_cronet_tot", 38 ], 39 properties: [ 40 "jni_libs", 41 ], 42} 43 44soong_config_module_type { 45 name: "enable_cronet_tot_license", 46 module_type: "license", 47 config_namespace: "cronet", 48 bool_variables: [ 49 "enable_cronet_tot", 50 ], 51 properties: [ 52 "license_text", 53 ], 54} 55 56soong_config_bool_variable { 57 name: "enable_cronet_tot", 58} 59 60enable_cronet_tot_java_defaults { 61 name: "cronet_api", 62 soong_config_variables: { 63 enable_cronet_tot: { 64 static_libs: [ 65 "tot_cronet_components_cronet_android_cronet_api_java", 66 ], 67 conditions_default: { 68 static_libs: [ 69 "stable_cronet_components_cronet_android_cronet_api_java", 70 ], 71 }, 72 }, 73 }, 74} 75 76enable_cronet_tot_java_defaults { 77 name: "cronet_impl", 78 soong_config_variables: { 79 enable_cronet_tot: { 80 static_libs: [ 81 "tot_cronet_components_cronet_android_cronet_impl_native_java", 82 "tot_cronet_components_cronet_android_cronet_jni_registration_java", 83 ], 84 conditions_default: { 85 static_libs: [ 86 "stable_cronet_components_cronet_android_cronet_impl_native_java", 87 "stable_cronet_components_cronet_android_cronet_jni_registration_java", 88 ], 89 }, 90 }, 91 }, 92} 93 94enable_cronet_tot_java_defaults { 95 name: "cronet_testing", 96 soong_config_variables: { 97 enable_cronet_tot: { 98 static_libs: [ 99 "tot_cronet_components_cronet_android_cronet_impl_native_java__testing", 100 "tot_cronet_components_cronet_android_cronet_jni_registration_java__testing", 101 "tot_cronet_components_cronet_android_cronet_tests_jni_registration_java__testing", 102 ], 103 conditions_default: { 104 static_libs: [ 105 "stable_cronet_components_cronet_android_cronet_impl_native_java__testing", 106 "stable_cronet_components_cronet_android_cronet_jni_registration_java__testing", 107 "stable_cronet_components_cronet_android_cronet_tests_jni_registration_java__testing", 108 ], 109 }, 110 }, 111 }, 112} 113 114enable_cronet_tot_license { 115 name: "external_cronet_license", 116 license_kinds: [ 117 "SPDX-license-identifier-Apache-2.0", 118 "SPDX-license-identifier-BSD", 119 "SPDX-license-identifier-BSD-3-Clause", 120 "SPDX-license-identifier-BSD-Source-Code", 121 "SPDX-license-identifier-BSD-2-Clause", 122 "SPDX-license-identifier-BSD-4-Clause", 123 "SPDX-license-identifier-BSL-1.0", 124 "SPDX-license-identifier-ICU", 125 "SPDX-license-identifier-ISC", 126 "SPDX-license-identifier-MIT", 127 "SPDX-license-identifier-MPL", 128 "SPDX-license-identifier-MPL-1.1", 129 "SPDX-license-identifier-MPL-2.0", 130 "SPDX-license-identifier-NCSA", 131 "SPDX-license-identifier-Zlib", 132 // "SPDX-license-identifier-GPL-2.0-with-autoconf-exception", // ICU TODO(aymanm): Reapply those once aosp/2470343 is merged 133 // "SPDX-license-identifier-GPL-3.0-with-autoconf-exception", // ICU TODO(aymanm): Reapply those once aosp/2470343 is merged 134 "SPDX-license-identifier-OpenSSL", 135 "SPDX-license-identifier-Unicode-DFS-2016", 136 "legacy_unencumbered", 137 ], 138 soong_config_variables: { 139 enable_cronet_tot: { 140 license_text: [ 141 "tot/LICENSE", 142 ], 143 conditions_default: { 144 license_text: [ 145 "stable/LICENSE", 146 ], 147 }, 148 } 149 } 150} 151 152java_library { 153 // Don't change the name of the module. 154 name: "cronet_aml_api_java", 155 defaults: [ 156 "cronet_api", 157 ], 158 sdk_version: "module_current", 159 min_sdk_version: "30", 160 visibility: [ 161 "//packages/modules/Connectivity:__subpackages__", 162 "//external/cronet/android:__subpackages__", 163 ], 164 apex_available: [ 165 "com.android.tethering", 166 ], 167} 168 169java_library { 170 // Don't change the name of the module. 171 name: "cronet_aml_java", 172 defaults: [ 173 "cronet_impl", 174 ], 175 sdk_version: "module_current", 176 min_sdk_version: "30", 177 visibility: [ 178 "//packages/modules/Connectivity:__subpackages__", 179 "//external/cronet/android:__subpackages__", 180 ], 181 apex_available: [ 182 "com.android.tethering", 183 ], 184} 185 186java_library { 187 name: "cronet_aml_java__testing", 188 defaults: [ 189 "cronet_testing", 190 ], 191 sdk_version: "module_current", 192 min_sdk_version: "30", 193 visibility: [ 194 "//external/cronet/android:__subpackages__", 195 ], 196 apex_available: [ 197 "com.android.tethering", 198 ], 199} 200 201enable_cronet_tot_java_defaults { 202 name: "cronet_native_unittests_defaults", 203 defaults: [ 204 "mts-target-sdk-version-current", 205 ], 206 aaptflags: ["-0 .dat"], 207 compile_multilib: "both", 208 min_sdk_version: "31", // b/270049141 209 soong_config_variables: { 210 enable_cronet_tot: { 211 asset_dirs: [ 212 "tot/third_party/icu/android", 213 ], 214 static_libs: [ 215 "tot_cronet_testing_android_native_test_native_test_java__testing", 216 "cronet_aml_java__testing", 217 "androidx.annotation_annotation", 218 "junit", 219 ], 220 conditions_default: { 221 asset_dirs: [ 222 "stable/third_party/icu/android", 223 ], 224 static_libs: [ 225 "stable_cronet_testing_android_native_test_native_test_java__testing", 226 "cronet_aml_java__testing", 227 "androidx.annotation_annotation", 228 "junit", 229 ], 230 }, 231 }, 232 }, 233} 234 235enable_cronet_tot_java_defaults { 236 name: "cronet_native_net_unittests_defaults", 237 soong_config_variables: { 238 enable_cronet_tot: { 239 jni_libs: [ 240 "tot_cronet_net_net_unittests__library__testing", 241 ], 242 static_libs: ["tot_cronet_for_testing_net_java"], 243 resource_dirs: [ 244 "tot/net/android/unittest_support/res", 245 ], 246 conditions_default: { 247 jni_libs: [ 248 "stable_cronet_net_net_unittests__library__testing", 249 ], 250 static_libs: ["stable_cronet_for_testing_net_java"], 251 resource_dirs: [ 252 "stable/net/android/unittest_support/res", 253 ], 254 }, 255 }, 256 }, 257} 258 259enable_cronet_tot_apex_defaults { 260 name: "CronetInTetheringApexDefaults", 261 soong_config_variables: { 262 enable_cronet_tot: { 263 jni_libs: [ 264 "tot_cronet_components_cronet_android_cronet", 265 "tot_cronet_libcrypto", 266 "tot_cronet_libssl", 267 ], 268 conditions_default: { 269 jni_libs: [ 270 "stable_cronet_components_cronet_android_cronet", 271 "stable_cronet_libcrypto", 272 "stable_cronet_libssl", 273 ], 274 }, 275 }, 276 }, 277} 278 279enable_cronet_tot_java_defaults { 280 name: "cronet_aml_components_cronet_android_api_version", 281 soong_config_variables: { 282 enable_cronet_tot: { 283 srcs: [ 284 ":tot_cronet_components_cronet_android_api_version", 285 ], 286 conditions_default: { 287 srcs: [ 288 ":stable_cronet_components_cronet_android_api_version", 289 ], 290 }, 291 }, 292 }, 293} 294 295enable_cronet_tot_java_defaults { 296 name: "cronet_java_tests", 297 soong_config_variables: { 298 enable_cronet_tot: { 299 static_libs: [ 300 "tot_cronet_java_tests", 301 ], 302 jni_libs: [ 303 "tot_cronet_components_cronet_android_cronet_tests__testing", 304 "tot_cronet_components_cronet_android_cronet__testing", 305 "tot_cronet_third_party_netty_tcnative_netty_tcnative_so__testing", 306 ], 307 data: [":tot_cronet_javatests_resources"], 308 conditions_default: { 309 static_libs: [ 310 "stable_cronet_java_tests", 311 ], 312 jni_libs: [ 313 "stable_cronet_components_cronet_android_cronet_tests__testing", 314 "stable_cronet_components_cronet_android_cronet__testing", 315 "stable_cronet_third_party_netty_tcnative_netty_tcnative_so__testing", 316 ], 317 data: [":stable_cronet_javatests_resources"], 318 }, 319 }, 320 }, 321} 322 323enable_cronet_tot_java_defaults { 324 name: "net_unittests_data", 325 soong_config_variables: { 326 enable_cronet_tot: { 327 data: [ 328 ":tot_cronet_net_unittests_data", 329 ], 330 conditions_default: { 331 data: [ 332 ":stable_cronet_net_unittests_data", 333 ], 334 }, 335 }, 336 }, 337} 338 339android_test_helper_app { 340 name: "cronet_tester_app", 341 defaults: [ 342 "cronet_native_unittests_defaults", 343 ], 344 jni_libs: select(release_flag("RELEASE_ENABLE_TOT_CRONET"), { 345 true: [ 346 "tot_cronet_components_cronet_android_cronet_unittests_android__library__testing", 347 ], 348 default: [ 349 "stable_cronet_components_cronet_android_cronet_unittests_android__library__testing", 350 ], 351 }), 352 manifest: "test_runner/AndroidManifest.xml", 353} 354 355// This is required to keep testing Cronet Stable. TH does not support, trivially, presubmit 356// testing of non-trunk_staging targets. In trunk_staging, Cronet ToT is "selected", while 357// Stable is selected everywhere else. To circumvent that, we expose a targets which are 358// always backed by Cronet Stable (hence the stable_ prefix). 359android_test_helper_app { 360 name: "stable_cronet_tester_app", 361 defaults: [ 362 "mts-target-sdk-version-current", 363 ], 364 aaptflags: ["-0 .dat"], 365 compile_multilib: "both", 366 min_sdk_version: "31", // b/270049141 367 asset_dirs: [ 368 "stable/third_party/icu/android", 369 ], 370 static_libs: [ 371 "stable_cronet_testing_android_native_test_native_test_java__testing", 372 "stable_cronet_components_cronet_android_cronet_impl_native_java__testing", 373 "stable_cronet_components_cronet_android_cronet_jni_registration_java__testing", 374 "stable_cronet_components_cronet_android_cronet_tests_jni_registration_java__testing", 375 "androidx.annotation_annotation", 376 "junit", 377 ], 378 jni_libs: [ 379 "stable_cronet_components_cronet_android_cronet_unittests_android__library__testing", 380 ], 381 manifest: "test_runner/AndroidManifest.xml", 382} 383 384android_test_helper_app { 385 name: "cronet_net_tester_app", 386 defaults: [ 387 "cronet_native_unittests_defaults", 388 "cronet_native_net_unittests_defaults", 389 ], 390 manifest: "test_runner/AndroidNetManifest.xml", 391} 392 393// This is required to keep testing Cronet Stable. TH does not support, trivially, presubmit 394// testing of non-trunk_staging targets. In trunk_staging, Cronet ToT is "selected", while 395// Stable is selected everywhere else. To circumvent that, we expose a targets which are 396// always backed by Cronet Stable (hence the stable_ prefix). 397android_test_helper_app { 398 name: "stable_cronet_net_tester_app", 399 defaults: [ 400 "mts-target-sdk-version-current", 401 ], 402 aaptflags: ["-0 .dat"], 403 compile_multilib: "both", 404 min_sdk_version: "31", // b/270049141 405 asset_dirs: [ 406 "stable/third_party/icu/android", 407 ], 408 static_libs: [ 409 "stable_cronet_testing_android_native_test_native_test_java__testing", 410 "stable_cronet_components_cronet_android_cronet_impl_native_java__testing", 411 "stable_cronet_components_cronet_android_cronet_jni_registration_java__testing", 412 "stable_cronet_components_cronet_android_cronet_tests_jni_registration_java__testing", 413 "androidx.annotation_annotation", 414 "stable_cronet_for_testing_net_java", 415 "junit", 416 ], 417 jni_libs: [ 418 "stable_cronet_net_net_unittests__library__testing", 419 ], 420 manifest: "test_runner/AndroidNetManifest.xml", 421 resource_dirs: [ 422 "stable/net/android/unittest_support/res", 423 ], 424} 425