blob: b07058a5241824f2a1f84dd88af64cb376fdab78 [file] [log] [blame]
Bob Badourd69ad692021-02-16 19:02:14 -08001package {
2 default_applicable_licenses: ["system_core_libutils_license"],
3}
4
Bob Badourd69ad692021-02-16 19:02:14 -08005license {
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
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080016cc_library_headers {
17 name: "libutils_headers",
Steven Moreland91527ed2017-04-11 12:43:16 -070018 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090019 product_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090020 recovery_available: true,
Yifan Hong55015ff2020-10-27 16:37:06 -070021 vendor_ramdisk_available: true,
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080022 host_supported: true,
dimitry454ba7e2019-05-16 13:48:17 +020023 native_bridge_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +090024 apex_available: [
25 "//apex_available:platform",
26 "//apex_available:anyapex",
27 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +090028 min_sdk_version: "apex_inherit",
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070029
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090030 header_libs: [
Jiyong Park705abe22021-12-14 22:55:34 +090031 "libbase_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080032 "libcutils_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090033 "liblog_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000034 "libprocessgroup_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090035 "libsystem_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090036 ],
37 export_header_lib_headers: [
Jiyong Park705abe22021-12-14 22:55:34 +090038 "libbase_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080039 "libcutils_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090040 "liblog_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000041 "libprocessgroup_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090042 "libsystem_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090043 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080044 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070045
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080046 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070047 linux_bionic: {
48 enabled: true,
49 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080050 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070051 enabled: true,
52 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080053 },
54}
55
David Sehrabfb9f32018-01-17 17:07:09 -080056cc_defaults {
57 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070058 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090059 product_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090060 recovery_available: true,
Dan Willemsen2e1591b2016-07-12 17:20:18 -070061 host_supported: true,
62
Elliott Hughesdc699a22018-02-16 17:58:14 -080063 cflags: [
64 "-Wall",
65 "-Werror",
Elliott Hughes48a9eb42021-03-04 09:46:23 -080066 "-Wno-exit-time-destructors",
Steven Morelanda06e68c2021-04-27 00:09:23 +000067 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Elliott Hughesdc699a22018-02-16 17:58:14 -080068 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070069 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070070 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070071 "libutils_headers",
72 ],
73 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070074 "libutils_headers",
75 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070076
Steven Moreland1f642412017-06-26 13:52:06 -070077 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070078 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070079 "liblog",
80 ],
Steven Moreland9c832022020-07-07 22:37:07 +000081 sanitize: {
82 misc_undefined: ["integer"],
83 },
Steven Moreland1f642412017-06-26 13:52:06 -070084
Dan Willemsen2e1591b2016-07-12 17:20:18 -070085 target: {
86 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070087 cflags: ["-fvisibility=protected"],
88
89 shared_libs: [
Jiyong Park0b3c24b2017-05-26 17:57:18 +090090 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070091 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070092
93 sanitize: {
94 misc_undefined: ["integer"],
95 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070096 },
97
Jiyong Park011ee122018-05-29 16:41:30 +090098 recovery: {
99 exclude_shared_libs: ["libvndksupport"],
100 },
101
Dan Willemsenab34b472016-11-29 13:32:55 -0800102 linux_bionic: {
103 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800104 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700105
106 darwin: {
107 cflags: ["-Wno-unused-parameter"],
108 },
109
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700110 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800111 cflags: [
112 // Under MinGW, ctype.h doesn't need multi-byte support
113 "-DMB_CUR_MAX=1",
114 "-Wno-unused-private-field",
115 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700116
117 enabled: true,
118 },
119 },
Anis Assie75dd9a2022-03-08 19:48:19 +0000120 fuzz_config: {
121 cc: ["smoreland@google.com"],
122 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700123}
124
Steven Moreland377adea2022-10-08 05:06:52 +0000125cc_defaults {
126 name: "libutils_impl_defaults",
David Sehrabfb9f32018-01-17 17:07:09 -0800127 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200128 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800129
130 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800131 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800132 "FileMap.cpp",
133 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000134 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800135 "NativeHandle.cpp",
136 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800137 "RefBase.cpp",
138 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800139 "StopWatch.cpp",
140 "String8.cpp",
141 "String16.cpp",
142 "StrongPointer.cpp",
143 "SystemClock.cpp",
144 "Threads.cpp",
145 "Timers.cpp",
146 "Tokenizer.cpp",
147 "Unicode.cpp",
148 "VectorImpl.cpp",
149 "misc.cpp",
150 ],
151
152 target: {
153 android: {
154 srcs: [
155 "Trace.cpp",
156 ],
157 },
158 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800159 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800160 srcs: [
161 "Looper.cpp",
162 ],
163 },
164 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800165
166 apex_available: [
167 "//apex_available:anyapex",
168 "//apex_available:platform",
169 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900170 min_sdk_version: "apex_inherit",
Yi Kong6ee028f2021-12-23 15:57:40 +0800171
172 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800173}
174
175cc_library {
Steven Moreland377adea2022-10-08 05:06:52 +0000176 name: "libutils",
177 defaults: ["libutils_impl_defaults"],
178
179 vndk: {
180 enabled: true,
181 support_system_process: true,
182 },
Hsin-Yi Chen3de02bd2022-12-06 17:19:42 +0800183
184 header_abi_checker: {
185 // AFDO affects weak symbols.
186 diff_flags: ["-allow-adding-removing-weak-symbols"],
187 ref_dump_dirs: ["abi-dumps"],
188 },
Steven Moreland377adea2022-10-08 05:06:52 +0000189}
190
191cc_library {
192 name: "libutils_test_compile",
193 defaults: ["libutils_impl_defaults"],
194
195 cflags: [
196 "-DCALLSTACKS=1",
197 "-DDEBUG_POLL_AND_WAKE=1",
198 "-DDEBUG_REFS=1",
199 "-DDEBUG_TOKENIZER=1",
200 ],
201
202 visibility: [":__subpackages__"],
203}
204
205cc_library {
David Sehrabfb9f32018-01-17 17:07:09 -0800206 name: "libutilscallstack",
207 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200208 // TODO(b/153609531): remove when no longer needed.
209 native_bridge_supported: true,
Steven Moreland6c509ca2022-04-11 22:30:07 +0000210 min_sdk_version: "29",
Steven Moreland377adea2022-10-08 05:06:52 +0000211 vndk: {
212 enabled: true,
213 support_system_process: true,
214 },
David Sehrabfb9f32018-01-17 17:07:09 -0800215
216 srcs: [
217 "CallStack.cpp",
218 ],
219
Steven Morelande6132be2019-03-25 20:38:56 -0700220 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700221 "libutils",
Christopher Ferrisab631242022-05-10 16:13:02 -0700222 "libunwindstack",
Steven Morelande6132be2019-03-25 20:38:56 -0700223 ],
224
David Sehrabfb9f32018-01-17 17:07:09 -0800225 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800226 linux: {
227 srcs: [
228 "ProcessCallStack.cpp",
229 ],
230 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700231 darwin: {
232 enabled: false,
233 },
Steven Morelande6132be2019-03-25 20:38:56 -0700234 windows: {
235 enabled: false,
236 },
David Sehrabfb9f32018-01-17 17:07:09 -0800237 },
238}
239
Dylan Katz9d5845b2020-05-11 15:44:01 -0700240cc_defaults {
241 name: "libutils_fuzz_defaults",
242 host_supported: true,
243 shared_libs: [
244 "libutils",
245 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700246 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700247 ],
248}
249
250cc_fuzz {
251 name: "libutils_fuzz_bitset",
252 defaults: ["libutils_fuzz_defaults"],
253 srcs: ["BitSet_fuzz.cpp"],
254}
255
256cc_fuzz {
257 name: "libutils_fuzz_filemap",
258 defaults: ["libutils_fuzz_defaults"],
259 srcs: ["FileMap_fuzz.cpp"],
260}
261
262cc_fuzz {
263 name: "libutils_fuzz_string8",
264 defaults: ["libutils_fuzz_defaults"],
265 srcs: ["String8_fuzz.cpp"],
266}
267
268cc_fuzz {
269 name: "libutils_fuzz_string16",
270 defaults: ["libutils_fuzz_defaults"],
271 srcs: ["String16_fuzz.cpp"],
272}
273
274cc_fuzz {
275 name: "libutils_fuzz_vector",
276 defaults: ["libutils_fuzz_defaults"],
277 srcs: ["Vector_fuzz.cpp"],
278}
279
Dylan Katz7168f272020-07-02 11:51:44 -0700280cc_fuzz {
281 name: "libutils_fuzz_printer",
282 defaults: ["libutils_fuzz_defaults"],
283 srcs: ["Printer_fuzz.cpp"],
284}
285
286cc_fuzz {
287 name: "libutils_fuzz_callstack",
288 defaults: ["libutils_fuzz_defaults"],
289 srcs: ["CallStack_fuzz.cpp"],
290 shared_libs: [
291 "libutilscallstack",
292 ],
293}
294
295cc_fuzz {
296 name: "libutils_fuzz_process_callstack",
297 defaults: ["libutils_fuzz_defaults"],
298 srcs: ["ProcessCallStack_fuzz.cpp"],
299 shared_libs: [
300 "libutilscallstack",
301 ],
302}
303
304cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700305 name: "libutils_fuzz_refbase",
306 defaults: ["libutils_fuzz_defaults"],
307 srcs: ["RefBase_fuzz.cpp"],
308}
309
310cc_fuzz {
311 name: "libutils_fuzz_lrucache",
312 defaults: ["libutils_fuzz_defaults"],
313 srcs: ["LruCache_fuzz.cpp"],
314}
315
316cc_fuzz {
317 name: "libutils_fuzz_looper",
318 defaults: ["libutils_fuzz_defaults"],
319 srcs: ["Looper_fuzz.cpp"],
320}
321
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700322cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800323 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700324 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800325
326 srcs: [
327 "BitSet_test.cpp",
Christopher Ferris15fee822022-09-12 18:00:10 -0700328 "CallStack_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900329 "Errors_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800330 "FileMap_test.cpp",
331 "LruCache_test.cpp",
332 "Mutex_test.cpp",
333 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800334 "Singleton_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700335 "String16_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900336 "String8_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800337 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700338 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800339 "Unicode_test.cpp",
340 "Vector_test.cpp",
341 ],
342
343 target: {
344 android: {
345 srcs: [
346 "SystemClock_test.cpp",
347 ],
348 shared_libs: [
Elliott Hughes01705e42019-02-07 12:41:37 -0800349 "libbase",
Christopher Ferris15fee822022-09-12 18:00:10 -0700350 "libcutils",
351 "liblog",
352 "liblzma",
353 "libunwindstack",
354 "libutils",
355 "libutilscallstack",
356 "libz",
Elliott Hughes01705e42019-02-07 12:41:37 -0800357 ],
358 },
359 linux: {
360 srcs: [
361 "Looper_test.cpp",
362 "RefBase_test.cpp",
363 ],
364 },
365 host: {
366 static_libs: [
Elliott Hughes01705e42019-02-07 12:41:37 -0800367 "libbase",
Christopher Ferris15fee822022-09-12 18:00:10 -0700368 "liblog",
369 "liblzma",
370 "libunwindstack_no_dex",
371 "libutils",
372 "libutilscallstack",
Elliott Hughes01705e42019-02-07 12:41:37 -0800373 ],
374 },
375 },
376
Yo Chiang5b028ba2020-07-10 19:34:53 +0800377 data_libs: [
378 "libutils_test_singleton1",
379 "libutils_test_singleton2",
380 ],
381
Elliott Hughes01705e42019-02-07 12:41:37 -0800382 cflags: [
383 "-Wall",
384 "-Wextra",
385 "-Werror",
386 "-Wthread-safety",
387 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800388
389 test_suites: ["device-tests"],
390}
391
Elliott Hughes01705e42019-02-07 12:41:37 -0800392cc_test_library {
393 name: "libutils_test_singleton1",
394 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800395 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800396 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800397 cflags: [
398 "-Wall",
399 "-Werror",
400 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900401 header_libs: ["libutils_headers"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700402}
Elliott Hughes01705e42019-02-07 12:41:37 -0800403
404cc_test_library {
405 name: "libutils_test_singleton2",
406 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800407 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800408 srcs: ["Singleton_test2.cpp"],
409 cflags: [
410 "-Wall",
411 "-Werror",
412 ],
413 shared_libs: ["libutils_test_singleton1"],
Jiyong Park705abe22021-12-14 22:55:34 +0900414 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800415}
Steven Morelandc732c032019-09-03 18:04:50 -0700416
417cc_benchmark {
418 name: "libutils_benchmark",
419 srcs: ["Vector_benchmark.cpp"],
420 shared_libs: ["libutils"],
421}