blob: 17411871ca5054073b87cc233b129c6ee6d0f122 [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,
Zhi Douff9e6402022-12-09 22:30:57 +000024 defaults: [
25 "apex-lowest-min-sdk-version",
26 ],
Jiyong Park8bf9b162020-03-07 16:36:09 +090027 apex_available: [
28 "//apex_available:platform",
29 "//apex_available:anyapex",
30 ],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070031
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090032 header_libs: [
Jiyong Park705abe22021-12-14 22:55:34 +090033 "libbase_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080034 "libcutils_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090035 "liblog_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000036 "libprocessgroup_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090037 "libsystem_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090038 ],
39 export_header_lib_headers: [
Jiyong Park705abe22021-12-14 22:55:34 +090040 "libbase_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080041 "libcutils_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090042 "liblog_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000043 "libprocessgroup_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090044 "libsystem_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090045 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080046 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070047
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080048 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070049 linux_bionic: {
50 enabled: true,
51 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080052 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070053 enabled: true,
54 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080055 },
56}
57
David Sehrabfb9f32018-01-17 17:07:09 -080058cc_defaults {
Tomasz Wasilczyk1578cb32023-11-21 08:56:06 -080059 name: "libutils_defaults_nodeps",
Steven Moreland91527ed2017-04-11 12:43:16 -070060 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090061 product_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090062 recovery_available: true,
Dan Willemsen2e1591b2016-07-12 17:20:18 -070063 host_supported: true,
64
Elliott Hughesdc699a22018-02-16 17:58:14 -080065 cflags: [
66 "-Wall",
67 "-Werror",
Elliott Hughes48a9eb42021-03-04 09:46:23 -080068 "-Wno-exit-time-destructors",
Steven Morelanda06e68c2021-04-27 00:09:23 +000069 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Elliott Hughesdc699a22018-02-16 17:58:14 -080070 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070071
Steven Moreland9c832022020-07-07 22:37:07 +000072 sanitize: {
73 misc_undefined: ["integer"],
74 },
Steven Moreland1f642412017-06-26 13:52:06 -070075
Dan Willemsen2e1591b2016-07-12 17:20:18 -070076 target: {
77 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070078 cflags: ["-fvisibility=protected"],
79
80 shared_libs: [
Jiyong Park0b3c24b2017-05-26 17:57:18 +090081 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070082 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070083
84 sanitize: {
85 misc_undefined: ["integer"],
86 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070087 },
88
Jiyong Park011ee122018-05-29 16:41:30 +090089 recovery: {
90 exclude_shared_libs: ["libvndksupport"],
91 },
92
Dan Willemsenab34b472016-11-29 13:32:55 -080093 linux_bionic: {
94 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -080095 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070096
97 darwin: {
98 cflags: ["-Wno-unused-parameter"],
99 },
100
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700101 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800102 cflags: [
103 // Under MinGW, ctype.h doesn't need multi-byte support
104 "-DMB_CUR_MAX=1",
105 "-Wno-unused-private-field",
106 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700107
108 enabled: true,
109 },
110 },
Anis Assie75dd9a2022-03-08 19:48:19 +0000111 fuzz_config: {
Akshata Kadam541f8502024-04-11 14:26:17 +0530112 cc: ["smoreland@google.com"],
Anis Assie75dd9a2022-03-08 19:48:19 +0000113 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700114}
115
Steven Moreland377adea2022-10-08 05:06:52 +0000116cc_defaults {
Tomasz Wasilczyk1578cb32023-11-21 08:56:06 -0800117 name: "libutils_defaults",
118 defaults: [
119 "libutils_defaults_nodeps",
120 ],
121
122 shared_libs: [
123 "libcutils",
124 "liblog",
125 ],
126}
127
128cc_defaults {
Steven Moreland377adea2022-10-08 05:06:52 +0000129 name: "libutils_impl_defaults",
Zhi Douff9e6402022-12-09 22:30:57 +0000130 defaults: [
131 "libutils_defaults",
132 "apex-lowest-min-sdk-version",
133 ],
dimitry454ba7e2019-05-16 13:48:17 +0200134 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800135
Steven Moreland7a1ca592023-10-07 01:09:39 +0000136 whole_static_libs: ["libutils_binder"],
137
Steven Morelandc7383702023-10-21 00:43:52 +0000138 header_libs: [
139 "libbase_headers",
140 "libutils_headers",
141 ],
142 export_header_lib_headers: [
143 "libutils_headers",
144 ],
145
David Sehrabfb9f32018-01-17 17:07:09 -0800146 srcs: [
147 "FileMap.cpp",
148 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000149 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800150 "NativeHandle.cpp",
151 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800152 "StopWatch.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800153 "SystemClock.cpp",
154 "Threads.cpp",
155 "Timers.cpp",
156 "Tokenizer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800157 "misc.cpp",
158 ],
159
160 target: {
161 android: {
162 srcs: [
163 "Trace.cpp",
164 ],
165 },
166 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800167 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800168 srcs: [
169 "Looper.cpp",
170 ],
171 },
172 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800173
174 apex_available: [
175 "//apex_available:anyapex",
176 "//apex_available:platform",
177 ],
Yi Kong6ee028f2021-12-23 15:57:40 +0800178
179 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800180}
181
182cc_library {
Steven Moreland377adea2022-10-08 05:06:52 +0000183 name: "libutils",
184 defaults: ["libutils_impl_defaults"],
185
186 vndk: {
187 enabled: true,
188 support_system_process: true,
189 },
Hsin-Yi Chen3de02bd2022-12-06 17:19:42 +0800190
Hsin-Yi Chene474f212023-09-04 11:16:34 +0800191 target: {
192 product: {
193 header_abi_checker: {
Hsin-Yi Chene5b667b2024-01-08 18:49:37 +0800194 enabled: true,
Hsin-Yi Chene474f212023-09-04 11:16:34 +0800195 // AFDO affects weak symbols.
196 diff_flags: ["-allow-adding-removing-weak-symbols"],
197 ref_dump_dirs: ["abi-dumps"],
198 },
199 },
200 vendor: {
201 header_abi_checker: {
Hsin-Yi Chene5b667b2024-01-08 18:49:37 +0800202 enabled: true,
Hsin-Yi Chene474f212023-09-04 11:16:34 +0800203 // AFDO affects weak symbols.
204 diff_flags: ["-allow-adding-removing-weak-symbols"],
205 ref_dump_dirs: ["abi-dumps"],
206 },
207 },
Hsin-Yi Chen3de02bd2022-12-06 17:19:42 +0800208 },
Steven Moreland377adea2022-10-08 05:06:52 +0000209}
210
211cc_library {
212 name: "libutils_test_compile",
213 defaults: ["libutils_impl_defaults"],
214
215 cflags: [
Kai Sky862f0492023-11-24 14:20:20 +0000216 "-DDEBUG_CALLBACKS=1",
Steven Moreland377adea2022-10-08 05:06:52 +0000217 "-DDEBUG_POLL_AND_WAKE=1",
218 "-DDEBUG_REFS=1",
219 "-DDEBUG_TOKENIZER=1",
220 ],
221
222 visibility: [":__subpackages__"],
223}
224
225cc_library {
David Sehrabfb9f32018-01-17 17:07:09 -0800226 name: "libutilscallstack",
227 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200228 // TODO(b/153609531): remove when no longer needed.
229 native_bridge_supported: true,
Steven Moreland6c509ca2022-04-11 22:30:07 +0000230 min_sdk_version: "29",
Steven Moreland377adea2022-10-08 05:06:52 +0000231 vndk: {
232 enabled: true,
233 support_system_process: true,
234 },
David Sehrabfb9f32018-01-17 17:07:09 -0800235
Steven Morelandc7383702023-10-21 00:43:52 +0000236 header_libs: [
237 "libbase_headers",
238 "libutils_headers",
239 ],
240 export_header_lib_headers: [
241 "libutils_headers",
242 ],
243
David Sehrabfb9f32018-01-17 17:07:09 -0800244 srcs: [
245 "CallStack.cpp",
246 ],
247
Steven Morelande6132be2019-03-25 20:38:56 -0700248 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700249 "libutils",
Christopher Ferrisab631242022-05-10 16:13:02 -0700250 "libunwindstack",
Steven Morelande6132be2019-03-25 20:38:56 -0700251 ],
252
David Sehrabfb9f32018-01-17 17:07:09 -0800253 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800254 linux: {
255 srcs: [
256 "ProcessCallStack.cpp",
257 ],
258 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700259 darwin: {
260 enabled: false,
261 },
Steven Morelande6132be2019-03-25 20:38:56 -0700262 windows: {
263 enabled: false,
264 },
David Sehrabfb9f32018-01-17 17:07:09 -0800265 },
266}
267
Dylan Katz9d5845b2020-05-11 15:44:01 -0700268cc_defaults {
269 name: "libutils_fuzz_defaults",
270 host_supported: true,
271 shared_libs: [
272 "libutils",
273 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700274 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700275 ],
Akshata Kadam541f8502024-04-11 14:26:17 +0530276 fuzz_config: {
277 cc: [
278 "smoreland@google.com",
279 ],
280 componentid: 128577,
281 description: "The fuzzer targets the APIs of libutils",
282 vector: "local_no_privileges_required",
283 service_privilege: "privileged",
284 users: "multi_user",
285 fuzzed_code_usage: "shipped",
286 },
Dylan Katz9d5845b2020-05-11 15:44:01 -0700287}
288
289cc_fuzz {
290 name: "libutils_fuzz_bitset",
291 defaults: ["libutils_fuzz_defaults"],
292 srcs: ["BitSet_fuzz.cpp"],
293}
294
295cc_fuzz {
296 name: "libutils_fuzz_filemap",
297 defaults: ["libutils_fuzz_defaults"],
298 srcs: ["FileMap_fuzz.cpp"],
299}
300
301cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700302 name: "libutils_fuzz_printer",
303 defaults: ["libutils_fuzz_defaults"],
304 srcs: ["Printer_fuzz.cpp"],
305}
306
307cc_fuzz {
308 name: "libutils_fuzz_callstack",
309 defaults: ["libutils_fuzz_defaults"],
310 srcs: ["CallStack_fuzz.cpp"],
311 shared_libs: [
312 "libutilscallstack",
313 ],
314}
315
316cc_fuzz {
317 name: "libutils_fuzz_process_callstack",
318 defaults: ["libutils_fuzz_defaults"],
319 srcs: ["ProcessCallStack_fuzz.cpp"],
320 shared_libs: [
321 "libutilscallstack",
322 ],
323}
324
325cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700326 name: "libutils_fuzz_lrucache",
327 defaults: ["libutils_fuzz_defaults"],
328 srcs: ["LruCache_fuzz.cpp"],
329}
330
331cc_fuzz {
332 name: "libutils_fuzz_looper",
333 defaults: ["libutils_fuzz_defaults"],
334 srcs: ["Looper_fuzz.cpp"],
335}
336
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700337cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800338 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700339 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800340
341 srcs: [
342 "BitSet_test.cpp",
Christopher Ferris15fee822022-09-12 18:00:10 -0700343 "CallStack_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800344 "FileMap_test.cpp",
345 "LruCache_test.cpp",
346 "Mutex_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800347 "Singleton_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700348 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800349 ],
350
351 target: {
352 android: {
353 srcs: [
354 "SystemClock_test.cpp",
355 ],
356 shared_libs: [
Elliott Hughes01705e42019-02-07 12:41:37 -0800357 "libbase",
Christopher Ferris15fee822022-09-12 18:00:10 -0700358 "libcutils",
359 "liblog",
360 "liblzma",
361 "libunwindstack",
362 "libutils",
363 "libutilscallstack",
364 "libz",
Elliott Hughes01705e42019-02-07 12:41:37 -0800365 ],
366 },
367 linux: {
368 srcs: [
369 "Looper_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800370 ],
371 },
372 host: {
373 static_libs: [
Elliott Hughes01705e42019-02-07 12:41:37 -0800374 "libbase",
Christopher Ferris15fee822022-09-12 18:00:10 -0700375 "liblog",
376 "liblzma",
377 "libunwindstack_no_dex",
378 "libutils",
379 "libutilscallstack",
Elliott Hughes01705e42019-02-07 12:41:37 -0800380 ],
381 },
382 },
383
Yo Chiang5b028ba2020-07-10 19:34:53 +0800384 data_libs: [
385 "libutils_test_singleton1",
386 "libutils_test_singleton2",
387 ],
388
Elliott Hughes01705e42019-02-07 12:41:37 -0800389 cflags: [
390 "-Wall",
391 "-Wextra",
392 "-Werror",
393 "-Wthread-safety",
394 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800395
396 test_suites: ["device-tests"],
397}
398
Elliott Hughes01705e42019-02-07 12:41:37 -0800399cc_test_library {
400 name: "libutils_test_singleton1",
401 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800402 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800403 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800404 cflags: [
405 "-Wall",
406 "-Werror",
407 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900408 header_libs: ["libutils_headers"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700409}
Elliott Hughes01705e42019-02-07 12:41:37 -0800410
411cc_test_library {
412 name: "libutils_test_singleton2",
413 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800414 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800415 srcs: ["Singleton_test2.cpp"],
416 cflags: [
417 "-Wall",
418 "-Werror",
419 ],
420 shared_libs: ["libutils_test_singleton1"],
Jiyong Park705abe22021-12-14 22:55:34 +0900421 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800422}