blob: 305cbf0a8834d90e83432b7cf24c1cd8b9670f12 [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",
Jiyong Park8b196a72022-01-12 09:23:29 +090036 "libsystem_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090037 ],
38 export_header_lib_headers: [
Jiyong Park705abe22021-12-14 22:55:34 +090039 "libbase_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080040 "libcutils_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090041 "liblog_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 {
Tomasz Wasilczyk1578cb32023-11-21 08:56:06 -080057 name: "libutils_defaults_nodeps",
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 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070069
Steven Moreland9c832022020-07-07 22:37:07 +000070 sanitize: {
71 misc_undefined: ["integer"],
72 },
Steven Moreland1f642412017-06-26 13:52:06 -070073
Dan Willemsen2e1591b2016-07-12 17:20:18 -070074 target: {
75 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070076 cflags: ["-fvisibility=protected"],
77
78 shared_libs: [
Jiyong Park0b3c24b2017-05-26 17:57:18 +090079 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070080 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070081
82 sanitize: {
83 misc_undefined: ["integer"],
84 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070085 },
86
Jiyong Park011ee122018-05-29 16:41:30 +090087 recovery: {
88 exclude_shared_libs: ["libvndksupport"],
89 },
90
Dan Willemsenab34b472016-11-29 13:32:55 -080091 linux_bionic: {
92 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -080093 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070094
95 darwin: {
96 cflags: ["-Wno-unused-parameter"],
97 },
98
Dan Willemsen2e1591b2016-07-12 17:20:18 -070099 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800100 cflags: [
101 // Under MinGW, ctype.h doesn't need multi-byte support
102 "-DMB_CUR_MAX=1",
103 "-Wno-unused-private-field",
104 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700105
106 enabled: true,
107 },
108 },
Anis Assie75dd9a2022-03-08 19:48:19 +0000109 fuzz_config: {
Akshata Kadam541f8502024-04-11 14:26:17 +0530110 cc: ["smoreland@google.com"],
Anis Assie75dd9a2022-03-08 19:48:19 +0000111 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700112}
113
Steven Moreland377adea2022-10-08 05:06:52 +0000114cc_defaults {
Tomasz Wasilczyk1578cb32023-11-21 08:56:06 -0800115 name: "libutils_defaults",
116 defaults: [
117 "libutils_defaults_nodeps",
118 ],
119
120 shared_libs: [
121 "libcutils",
122 "liblog",
123 ],
124}
125
126cc_defaults {
Steven Moreland377adea2022-10-08 05:06:52 +0000127 name: "libutils_impl_defaults",
Zhi Douff9e6402022-12-09 22:30:57 +0000128 defaults: [
129 "libutils_defaults",
130 "apex-lowest-min-sdk-version",
131 ],
dimitry454ba7e2019-05-16 13:48:17 +0200132 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800133
Steven Moreland7a1ca592023-10-07 01:09:39 +0000134 whole_static_libs: ["libutils_binder"],
135
Steven Morelandc7383702023-10-21 00:43:52 +0000136 header_libs: [
137 "libbase_headers",
138 "libutils_headers",
139 ],
140 export_header_lib_headers: [
141 "libutils_headers",
142 ],
143
David Sehrabfb9f32018-01-17 17:07:09 -0800144 srcs: [
145 "FileMap.cpp",
146 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000147 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800148 "NativeHandle.cpp",
149 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800150 "StopWatch.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800151 "SystemClock.cpp",
152 "Threads.cpp",
153 "Timers.cpp",
154 "Tokenizer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800155 "misc.cpp",
156 ],
157
158 target: {
159 android: {
160 srcs: [
161 "Trace.cpp",
162 ],
163 },
164 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800165 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800166 srcs: [
167 "Looper.cpp",
168 ],
169 },
170 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800171
172 apex_available: [
173 "//apex_available:anyapex",
174 "//apex_available:platform",
175 ],
Yi Kong6ee028f2021-12-23 15:57:40 +0800176
177 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800178}
179
180cc_library {
Steven Moreland377adea2022-10-08 05:06:52 +0000181 name: "libutils",
182 defaults: ["libutils_impl_defaults"],
183
Kiyoung Kimad8cf522024-03-11 13:04:38 +0900184 double_loadable: true,
Hsin-Yi Chen3de02bd2022-12-06 17:19:42 +0800185
Hsin-Yi Chene474f212023-09-04 11:16:34 +0800186 target: {
187 product: {
188 header_abi_checker: {
Hsin-Yi Chene5b667b2024-01-08 18:49:37 +0800189 enabled: true,
Hsin-Yi Chene474f212023-09-04 11:16:34 +0800190 // AFDO affects weak symbols.
191 diff_flags: ["-allow-adding-removing-weak-symbols"],
192 ref_dump_dirs: ["abi-dumps"],
193 },
194 },
195 vendor: {
196 header_abi_checker: {
Hsin-Yi Chene5b667b2024-01-08 18:49:37 +0800197 enabled: true,
Hsin-Yi Chene474f212023-09-04 11:16:34 +0800198 // AFDO affects weak symbols.
199 diff_flags: ["-allow-adding-removing-weak-symbols"],
200 ref_dump_dirs: ["abi-dumps"],
201 },
202 },
Hsin-Yi Chen3de02bd2022-12-06 17:19:42 +0800203 },
Steven Moreland377adea2022-10-08 05:06:52 +0000204}
205
206cc_library {
207 name: "libutils_test_compile",
208 defaults: ["libutils_impl_defaults"],
209
210 cflags: [
Kai Sky862f0492023-11-24 14:20:20 +0000211 "-DDEBUG_CALLBACKS=1",
Steven Moreland377adea2022-10-08 05:06:52 +0000212 "-DDEBUG_POLL_AND_WAKE=1",
213 "-DDEBUG_REFS=1",
214 "-DDEBUG_TOKENIZER=1",
215 ],
216
217 visibility: [":__subpackages__"],
218}
219
220cc_library {
David Sehrabfb9f32018-01-17 17:07:09 -0800221 name: "libutilscallstack",
222 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200223 // TODO(b/153609531): remove when no longer needed.
224 native_bridge_supported: true,
Steven Moreland6c509ca2022-04-11 22:30:07 +0000225 min_sdk_version: "29",
Kiyoung Kimad8cf522024-03-11 13:04:38 +0900226 double_loadable: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800227
Steven Morelandc7383702023-10-21 00:43:52 +0000228 header_libs: [
229 "libbase_headers",
230 "libutils_headers",
231 ],
232 export_header_lib_headers: [
233 "libutils_headers",
234 ],
235
David Sehrabfb9f32018-01-17 17:07:09 -0800236 srcs: [
237 "CallStack.cpp",
238 ],
239
Steven Morelande6132be2019-03-25 20:38:56 -0700240 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700241 "libutils",
Christopher Ferrisab631242022-05-10 16:13:02 -0700242 "libunwindstack",
Steven Morelande6132be2019-03-25 20:38:56 -0700243 ],
244
David Sehrabfb9f32018-01-17 17:07:09 -0800245 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800246 linux: {
247 srcs: [
248 "ProcessCallStack.cpp",
249 ],
250 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700251 darwin: {
252 enabled: false,
253 },
Steven Morelande6132be2019-03-25 20:38:56 -0700254 windows: {
255 enabled: false,
256 },
David Sehrabfb9f32018-01-17 17:07:09 -0800257 },
258}
259
Dylan Katz9d5845b2020-05-11 15:44:01 -0700260cc_defaults {
261 name: "libutils_fuzz_defaults",
262 host_supported: true,
263 shared_libs: [
264 "libutils",
265 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700266 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700267 ],
Akshata Kadam541f8502024-04-11 14:26:17 +0530268 fuzz_config: {
269 cc: [
270 "smoreland@google.com",
271 ],
272 componentid: 128577,
273 description: "The fuzzer targets the APIs of libutils",
274 vector: "local_no_privileges_required",
275 service_privilege: "privileged",
276 users: "multi_user",
277 fuzzed_code_usage: "shipped",
278 },
Dylan Katz9d5845b2020-05-11 15:44:01 -0700279}
280
281cc_fuzz {
282 name: "libutils_fuzz_bitset",
283 defaults: ["libutils_fuzz_defaults"],
284 srcs: ["BitSet_fuzz.cpp"],
285}
286
287cc_fuzz {
288 name: "libutils_fuzz_filemap",
289 defaults: ["libutils_fuzz_defaults"],
290 srcs: ["FileMap_fuzz.cpp"],
291}
292
293cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700294 name: "libutils_fuzz_printer",
295 defaults: ["libutils_fuzz_defaults"],
296 srcs: ["Printer_fuzz.cpp"],
297}
298
299cc_fuzz {
300 name: "libutils_fuzz_callstack",
301 defaults: ["libutils_fuzz_defaults"],
302 srcs: ["CallStack_fuzz.cpp"],
303 shared_libs: [
304 "libutilscallstack",
305 ],
306}
307
308cc_fuzz {
309 name: "libutils_fuzz_process_callstack",
310 defaults: ["libutils_fuzz_defaults"],
311 srcs: ["ProcessCallStack_fuzz.cpp"],
312 shared_libs: [
313 "libutilscallstack",
314 ],
315}
316
317cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700318 name: "libutils_fuzz_lrucache",
319 defaults: ["libutils_fuzz_defaults"],
320 srcs: ["LruCache_fuzz.cpp"],
321}
322
323cc_fuzz {
324 name: "libutils_fuzz_looper",
325 defaults: ["libutils_fuzz_defaults"],
326 srcs: ["Looper_fuzz.cpp"],
327}
328
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700329cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800330 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700331 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800332
333 srcs: [
334 "BitSet_test.cpp",
Christopher Ferris15fee822022-09-12 18:00:10 -0700335 "CallStack_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800336 "FileMap_test.cpp",
337 "LruCache_test.cpp",
338 "Mutex_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800339 "Singleton_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700340 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800341 ],
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",
Elliott Hughes01705e42019-02-07 12:41:37 -0800362 ],
363 },
364 host: {
365 static_libs: [
Elliott Hughes01705e42019-02-07 12:41:37 -0800366 "libbase",
Christopher Ferris15fee822022-09-12 18:00:10 -0700367 "liblog",
368 "liblzma",
369 "libunwindstack_no_dex",
370 "libutils",
371 "libutilscallstack",
Spandan Dasc4db5462024-01-20 20:12:03 +0000372 "libz",
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}