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