blob: 85a0fd209b5ea14228d5eedbd69670031a2cebf5 [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 {
59 name: "libutils_defaults",
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 Moreland1f642412017-06-26 13:52:06 -070072 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070073 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070074 "liblog",
75 ],
Steven Moreland9c832022020-07-07 22:37:07 +000076 sanitize: {
77 misc_undefined: ["integer"],
78 },
Steven Moreland1f642412017-06-26 13:52:06 -070079
Dan Willemsen2e1591b2016-07-12 17:20:18 -070080 target: {
81 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070082 cflags: ["-fvisibility=protected"],
83
84 shared_libs: [
Jiyong Park0b3c24b2017-05-26 17:57:18 +090085 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070086 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070087
88 sanitize: {
89 misc_undefined: ["integer"],
90 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070091 },
92
Jiyong Park011ee122018-05-29 16:41:30 +090093 recovery: {
94 exclude_shared_libs: ["libvndksupport"],
95 },
96
Dan Willemsenab34b472016-11-29 13:32:55 -080097 linux_bionic: {
98 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -080099 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700100
101 darwin: {
102 cflags: ["-Wno-unused-parameter"],
103 },
104
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700105 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800106 cflags: [
107 // Under MinGW, ctype.h doesn't need multi-byte support
108 "-DMB_CUR_MAX=1",
109 "-Wno-unused-private-field",
110 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700111
112 enabled: true,
113 },
114 },
Anis Assie75dd9a2022-03-08 19:48:19 +0000115 fuzz_config: {
116 cc: ["smoreland@google.com"],
117 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700118}
119
Steven Moreland377adea2022-10-08 05:06:52 +0000120cc_defaults {
121 name: "libutils_impl_defaults",
Zhi Douff9e6402022-12-09 22:30:57 +0000122 defaults: [
123 "libutils_defaults",
124 "apex-lowest-min-sdk-version",
125 ],
dimitry454ba7e2019-05-16 13:48:17 +0200126 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800127
Steven Moreland7a1ca592023-10-07 01:09:39 +0000128 whole_static_libs: ["libutils_binder"],
129
Steven Morelandc7383702023-10-21 00:43:52 +0000130 header_libs: [
131 "libbase_headers",
132 "libutils_headers",
133 ],
134 export_header_lib_headers: [
135 "libutils_headers",
136 ],
137
David Sehrabfb9f32018-01-17 17:07:09 -0800138 srcs: [
139 "FileMap.cpp",
140 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000141 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800142 "NativeHandle.cpp",
143 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800144 "StopWatch.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800145 "SystemClock.cpp",
146 "Threads.cpp",
147 "Timers.cpp",
148 "Tokenizer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800149 "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 ],
Yi Kong6ee028f2021-12-23 15:57:40 +0800170
171 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800172}
173
174cc_library {
Steven Moreland377adea2022-10-08 05:06:52 +0000175 name: "libutils",
176 defaults: ["libutils_impl_defaults"],
177
178 vndk: {
179 enabled: true,
180 support_system_process: true,
181 },
Hsin-Yi Chen3de02bd2022-12-06 17:19:42 +0800182
Hsin-Yi Chene474f212023-09-04 11:16:34 +0800183 target: {
184 product: {
185 header_abi_checker: {
186 // AFDO affects weak symbols.
187 diff_flags: ["-allow-adding-removing-weak-symbols"],
188 ref_dump_dirs: ["abi-dumps"],
189 },
190 },
191 vendor: {
192 header_abi_checker: {
193 // AFDO affects weak symbols.
194 diff_flags: ["-allow-adding-removing-weak-symbols"],
195 ref_dump_dirs: ["abi-dumps"],
196 },
197 },
Hsin-Yi Chen3de02bd2022-12-06 17:19:42 +0800198 },
Steven Moreland377adea2022-10-08 05:06:52 +0000199}
200
201cc_library {
202 name: "libutils_test_compile",
203 defaults: ["libutils_impl_defaults"],
204
205 cflags: [
Kai Sky862f0492023-11-24 14:20:20 +0000206 "-DDEBUG_CALLBACKS=1",
Steven Moreland377adea2022-10-08 05:06:52 +0000207 "-DDEBUG_POLL_AND_WAKE=1",
208 "-DDEBUG_REFS=1",
209 "-DDEBUG_TOKENIZER=1",
210 ],
211
212 visibility: [":__subpackages__"],
213}
214
215cc_library {
David Sehrabfb9f32018-01-17 17:07:09 -0800216 name: "libutilscallstack",
217 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200218 // TODO(b/153609531): remove when no longer needed.
219 native_bridge_supported: true,
Steven Moreland6c509ca2022-04-11 22:30:07 +0000220 min_sdk_version: "29",
Steven Moreland377adea2022-10-08 05:06:52 +0000221 vndk: {
222 enabled: true,
223 support_system_process: true,
224 },
David Sehrabfb9f32018-01-17 17:07:09 -0800225
Steven Morelandc7383702023-10-21 00:43:52 +0000226 header_libs: [
227 "libbase_headers",
228 "libutils_headers",
229 ],
230 export_header_lib_headers: [
231 "libutils_headers",
232 ],
233
David Sehrabfb9f32018-01-17 17:07:09 -0800234 srcs: [
235 "CallStack.cpp",
236 ],
237
Steven Morelande6132be2019-03-25 20:38:56 -0700238 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700239 "libutils",
Christopher Ferrisab631242022-05-10 16:13:02 -0700240 "libunwindstack",
Steven Morelande6132be2019-03-25 20:38:56 -0700241 ],
242
David Sehrabfb9f32018-01-17 17:07:09 -0800243 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800244 linux: {
245 srcs: [
246 "ProcessCallStack.cpp",
247 ],
248 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700249 darwin: {
250 enabled: false,
251 },
Steven Morelande6132be2019-03-25 20:38:56 -0700252 windows: {
253 enabled: false,
254 },
David Sehrabfb9f32018-01-17 17:07:09 -0800255 },
256}
257
Dylan Katz9d5845b2020-05-11 15:44:01 -0700258cc_defaults {
259 name: "libutils_fuzz_defaults",
260 host_supported: true,
261 shared_libs: [
262 "libutils",
263 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700264 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700265 ],
266}
267
268cc_fuzz {
269 name: "libutils_fuzz_bitset",
270 defaults: ["libutils_fuzz_defaults"],
271 srcs: ["BitSet_fuzz.cpp"],
272}
273
274cc_fuzz {
275 name: "libutils_fuzz_filemap",
276 defaults: ["libutils_fuzz_defaults"],
277 srcs: ["FileMap_fuzz.cpp"],
278}
279
280cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700281 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_lrucache",
306 defaults: ["libutils_fuzz_defaults"],
307 srcs: ["LruCache_fuzz.cpp"],
308}
309
310cc_fuzz {
311 name: "libutils_fuzz_looper",
312 defaults: ["libutils_fuzz_defaults"],
313 srcs: ["Looper_fuzz.cpp"],
314}
315
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700316cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800317 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700318 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800319
320 srcs: [
321 "BitSet_test.cpp",
Christopher Ferris15fee822022-09-12 18:00:10 -0700322 "CallStack_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800323 "FileMap_test.cpp",
324 "LruCache_test.cpp",
325 "Mutex_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800326 "Singleton_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700327 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800328 ],
329
330 target: {
331 android: {
332 srcs: [
333 "SystemClock_test.cpp",
334 ],
335 shared_libs: [
Elliott Hughes01705e42019-02-07 12:41:37 -0800336 "libbase",
Christopher Ferris15fee822022-09-12 18:00:10 -0700337 "libcutils",
338 "liblog",
339 "liblzma",
340 "libunwindstack",
341 "libutils",
342 "libutilscallstack",
343 "libz",
Elliott Hughes01705e42019-02-07 12:41:37 -0800344 ],
345 },
346 linux: {
347 srcs: [
348 "Looper_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800349 ],
350 },
351 host: {
352 static_libs: [
Elliott Hughes01705e42019-02-07 12:41:37 -0800353 "libbase",
Christopher Ferris15fee822022-09-12 18:00:10 -0700354 "liblog",
355 "liblzma",
356 "libunwindstack_no_dex",
357 "libutils",
358 "libutilscallstack",
Elliott Hughes01705e42019-02-07 12:41:37 -0800359 ],
360 },
361 },
362
Yo Chiang5b028ba2020-07-10 19:34:53 +0800363 data_libs: [
364 "libutils_test_singleton1",
365 "libutils_test_singleton2",
366 ],
367
Elliott Hughes01705e42019-02-07 12:41:37 -0800368 cflags: [
369 "-Wall",
370 "-Wextra",
371 "-Werror",
372 "-Wthread-safety",
373 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800374
375 test_suites: ["device-tests"],
376}
377
Elliott Hughes01705e42019-02-07 12:41:37 -0800378cc_test_library {
379 name: "libutils_test_singleton1",
380 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800381 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800382 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800383 cflags: [
384 "-Wall",
385 "-Werror",
386 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900387 header_libs: ["libutils_headers"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700388}
Elliott Hughes01705e42019-02-07 12:41:37 -0800389
390cc_test_library {
391 name: "libutils_test_singleton2",
392 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800393 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800394 srcs: ["Singleton_test2.cpp"],
395 cflags: [
396 "-Wall",
397 "-Werror",
398 ],
399 shared_libs: ["libutils_test_singleton1"],
Jiyong Park705abe22021-12-14 22:55:34 +0900400 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800401}