1package { 2 default_applicable_licenses: ["system_core_libutils_license"], 3} 4 5license { 6 name: "system_core_libutils_license", 7 visibility: [":__subpackages__"], 8 license_kinds: [ 9 "SPDX-license-identifier-Apache-2.0", 10 ], 11 license_text: [ 12 "NOTICE", 13 ], 14} 15 16cc_library_headers { 17 name: "libutils_headers", 18 vendor_available: true, 19 product_available: true, 20 recovery_available: true, 21 vendor_ramdisk_available: true, 22 host_supported: true, 23 native_bridge_supported: true, 24 defaults: [ 25 "apex-lowest-min-sdk-version", 26 ], 27 apex_available: [ 28 "//apex_available:platform", 29 "//apex_available:anyapex", 30 ], 31 32 header_libs: [ 33 "libbase_headers", 34 "libcutils_headers", 35 "liblog_headers", 36 "libprocessgroup_headers", 37 "libsystem_headers", 38 ], 39 export_header_lib_headers: [ 40 "libbase_headers", 41 "libcutils_headers", 42 "liblog_headers", 43 "libprocessgroup_headers", 44 "libsystem_headers", 45 ], 46 export_include_dirs: ["include"], 47 48 target: { 49 linux_bionic: { 50 enabled: true, 51 }, 52 windows: { 53 enabled: true, 54 }, 55 }, 56} 57 58cc_defaults { 59 name: "libutils_defaults", 60 vendor_available: true, 61 product_available: true, 62 recovery_available: true, 63 host_supported: true, 64 65 cflags: [ 66 "-Wall", 67 "-Werror", 68 "-Wno-exit-time-destructors", 69 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", 70 ], 71 header_libs: [ 72 "libbase_headers", 73 "libutils_headers", 74 ], 75 export_header_lib_headers: [ 76 "libutils_headers", 77 ], 78 79 shared_libs: [ 80 "libcutils", 81 "liblog", 82 ], 83 sanitize: { 84 misc_undefined: ["integer"], 85 }, 86 87 target: { 88 android: { 89 cflags: ["-fvisibility=protected"], 90 91 shared_libs: [ 92 "libvndksupport", 93 ], 94 95 sanitize: { 96 misc_undefined: ["integer"], 97 }, 98 }, 99 100 recovery: { 101 exclude_shared_libs: ["libvndksupport"], 102 }, 103 104 linux_bionic: { 105 enabled: true, 106 }, 107 108 darwin: { 109 cflags: ["-Wno-unused-parameter"], 110 }, 111 112 windows: { 113 cflags: [ 114 // Under MinGW, ctype.h doesn't need multi-byte support 115 "-DMB_CUR_MAX=1", 116 "-Wno-unused-private-field", 117 ], 118 119 enabled: true, 120 }, 121 }, 122 fuzz_config: { 123 cc: ["smoreland@google.com"], 124 }, 125} 126 127cc_defaults { 128 name: "libutils_impl_defaults", 129 defaults: [ 130 "libutils_defaults", 131 "apex-lowest-min-sdk-version", 132 ], 133 native_bridge_supported: true, 134 135 srcs: [ 136 "Errors.cpp", 137 "FileMap.cpp", 138 "JenkinsHash.cpp", 139 "LightRefBase.cpp", 140 "NativeHandle.cpp", 141 "Printer.cpp", 142 "RefBase.cpp", 143 "SharedBuffer.cpp", 144 "StopWatch.cpp", 145 "String8.cpp", 146 "String16.cpp", 147 "StrongPointer.cpp", 148 "SystemClock.cpp", 149 "Threads.cpp", 150 "Timers.cpp", 151 "Tokenizer.cpp", 152 "Unicode.cpp", 153 "VectorImpl.cpp", 154 "misc.cpp", 155 ], 156 157 target: { 158 android: { 159 srcs: [ 160 "Trace.cpp", 161 ], 162 }, 163 linux: { 164 header_libs: ["libbase_headers"], 165 srcs: [ 166 "Looper.cpp", 167 ], 168 }, 169 }, 170 171 apex_available: [ 172 "//apex_available:anyapex", 173 "//apex_available:platform", 174 ], 175 176 afdo: true, 177} 178 179cc_library { 180 name: "libutils", 181 defaults: ["libutils_impl_defaults"], 182 183 vndk: { 184 enabled: true, 185 support_system_process: true, 186 }, 187 188 header_abi_checker: { 189 // AFDO affects weak symbols. 190 diff_flags: ["-allow-adding-removing-weak-symbols"], 191 ref_dump_dirs: ["abi-dumps"], 192 }, 193} 194 195cc_library { 196 name: "libutils_test_compile", 197 defaults: ["libutils_impl_defaults"], 198 199 cflags: [ 200 "-DCALLSTACKS=1", 201 "-DDEBUG_POLL_AND_WAKE=1", 202 "-DDEBUG_REFS=1", 203 "-DDEBUG_TOKENIZER=1", 204 ], 205 206 visibility: [":__subpackages__"], 207} 208 209cc_library { 210 name: "libutilscallstack", 211 defaults: ["libutils_defaults"], 212 // TODO(b/153609531): remove when no longer needed. 213 native_bridge_supported: true, 214 min_sdk_version: "29", 215 vndk: { 216 enabled: true, 217 support_system_process: true, 218 }, 219 220 srcs: [ 221 "CallStack.cpp", 222 ], 223 224 shared_libs: [ 225 "libutils", 226 "libunwindstack", 227 ], 228 229 target: { 230 linux: { 231 srcs: [ 232 "ProcessCallStack.cpp", 233 ], 234 }, 235 darwin: { 236 enabled: false, 237 }, 238 windows: { 239 enabled: false, 240 }, 241 }, 242} 243 244cc_defaults { 245 name: "libutils_fuzz_defaults", 246 host_supported: true, 247 shared_libs: [ 248 "libutils", 249 "libbase", 250 "liblog", 251 ], 252} 253 254cc_fuzz { 255 name: "libutils_fuzz_bitset", 256 defaults: ["libutils_fuzz_defaults"], 257 srcs: ["BitSet_fuzz.cpp"], 258} 259 260cc_fuzz { 261 name: "libutils_fuzz_filemap", 262 defaults: ["libutils_fuzz_defaults"], 263 srcs: ["FileMap_fuzz.cpp"], 264} 265 266cc_fuzz { 267 name: "libutils_fuzz_string8", 268 defaults: ["libutils_fuzz_defaults"], 269 srcs: ["String8_fuzz.cpp"], 270} 271 272cc_fuzz { 273 name: "libutils_fuzz_string16", 274 defaults: ["libutils_fuzz_defaults"], 275 srcs: ["String16_fuzz.cpp"], 276} 277 278cc_fuzz { 279 name: "libutils_fuzz_vector", 280 defaults: ["libutils_fuzz_defaults"], 281 srcs: ["Vector_fuzz.cpp"], 282} 283 284cc_fuzz { 285 name: "libutils_fuzz_printer", 286 defaults: ["libutils_fuzz_defaults"], 287 srcs: ["Printer_fuzz.cpp"], 288} 289 290cc_fuzz { 291 name: "libutils_fuzz_callstack", 292 defaults: ["libutils_fuzz_defaults"], 293 srcs: ["CallStack_fuzz.cpp"], 294 shared_libs: [ 295 "libutilscallstack", 296 ], 297} 298 299cc_fuzz { 300 name: "libutils_fuzz_process_callstack", 301 defaults: ["libutils_fuzz_defaults"], 302 srcs: ["ProcessCallStack_fuzz.cpp"], 303 shared_libs: [ 304 "libutilscallstack", 305 ], 306} 307 308cc_fuzz { 309 name: "libutils_fuzz_refbase", 310 defaults: ["libutils_fuzz_defaults"], 311 srcs: ["RefBase_fuzz.cpp"], 312} 313 314cc_fuzz { 315 name: "libutils_fuzz_lrucache", 316 defaults: ["libutils_fuzz_defaults"], 317 srcs: ["LruCache_fuzz.cpp"], 318} 319 320cc_fuzz { 321 name: "libutils_fuzz_looper", 322 defaults: ["libutils_fuzz_defaults"], 323 srcs: ["Looper_fuzz.cpp"], 324} 325 326cc_test { 327 name: "libutils_test", 328 host_supported: true, 329 330 srcs: [ 331 "BitSet_test.cpp", 332 "CallStack_test.cpp", 333 "Errors_test.cpp", 334 "FileMap_test.cpp", 335 "LruCache_test.cpp", 336 "Mutex_test.cpp", 337 "SharedBuffer_test.cpp", 338 "Singleton_test.cpp", 339 "String16_test.cpp", 340 "String8_test.cpp", 341 "StrongPointer_test.cpp", 342 "Timers_test.cpp", 343 "Unicode_test.cpp", 344 "Vector_test.cpp", 345 ], 346 347 target: { 348 android: { 349 srcs: [ 350 "SystemClock_test.cpp", 351 ], 352 shared_libs: [ 353 "libbase", 354 "libcutils", 355 "liblog", 356 "liblzma", 357 "libunwindstack", 358 "libutils", 359 "libutilscallstack", 360 "libz", 361 ], 362 }, 363 linux: { 364 srcs: [ 365 "Looper_test.cpp", 366 "RefBase_test.cpp", 367 ], 368 }, 369 host: { 370 static_libs: [ 371 "libbase", 372 "liblog", 373 "liblzma", 374 "libunwindstack_no_dex", 375 "libutils", 376 "libutilscallstack", 377 ], 378 }, 379 }, 380 381 data_libs: [ 382 "libutils_test_singleton1", 383 "libutils_test_singleton2", 384 ], 385 386 cflags: [ 387 "-Wall", 388 "-Wextra", 389 "-Werror", 390 "-Wthread-safety", 391 ], 392 393 test_suites: ["device-tests"], 394} 395 396cc_test_library { 397 name: "libutils_test_singleton1", 398 host_supported: true, 399 installable: false, 400 srcs: ["Singleton_test1.cpp"], 401 cflags: [ 402 "-Wall", 403 "-Werror", 404 ], 405 header_libs: ["libutils_headers"], 406} 407 408cc_test_library { 409 name: "libutils_test_singleton2", 410 host_supported: true, 411 installable: false, 412 srcs: ["Singleton_test2.cpp"], 413 cflags: [ 414 "-Wall", 415 "-Werror", 416 ], 417 shared_libs: ["libutils_test_singleton1"], 418 header_libs: ["libutils_headers"], 419} 420 421cc_benchmark { 422 name: "libutils_benchmark", 423 srcs: ["Vector_benchmark.cpp"], 424 shared_libs: ["libutils"], 425} 426