blob: 63955677d11066d7c1a4ac4558b9ec882a713624 [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: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070031 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090032 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080033 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000034 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090035 ],
36 export_header_lib_headers: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070037 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090038 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080039 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000040 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090041 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080042 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070043
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080044 target: {
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070045 android: {
46 header_libs: ["libbacktrace_headers"],
47 export_header_lib_headers: ["libbacktrace_headers"],
48 },
Christopher Ferris0e691602020-10-14 14:13:58 -070049 linux_glibc: {
50 header_libs: ["libbacktrace_headers"],
51 export_header_lib_headers: ["libbacktrace_headers"],
52 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070053 linux_bionic: {
Christopher Ferris0e691602020-10-14 14:13:58 -070054 header_libs: ["libbacktrace_headers"],
55 export_header_lib_headers: ["libbacktrace_headers"],
Dan Willemsene0cd1e02017-03-15 15:23:36 -070056 enabled: true,
57 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080058 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070059 enabled: true,
60 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080061 },
62}
63
David Sehrabfb9f32018-01-17 17:07:09 -080064cc_defaults {
65 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070066 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090067 product_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090068 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090069 vndk: {
70 enabled: true,
71 support_system_process: true,
72 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070073 host_supported: true,
74
Elliott Hughesdc699a22018-02-16 17:58:14 -080075 cflags: [
76 "-Wall",
77 "-Werror",
Elliott Hughes48a9eb42021-03-04 09:46:23 -080078 "-Wno-exit-time-destructors",
Elliott Hughesdc699a22018-02-16 17:58:14 -080079 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070080 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070081 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070082 "libutils_headers",
83 ],
84 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070085 "libutils_headers",
86 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070087
Steven Moreland1f642412017-06-26 13:52:06 -070088 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070089 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070090 "liblog",
91 ],
Steven Moreland9c832022020-07-07 22:37:07 +000092 sanitize: {
93 misc_undefined: ["integer"],
94 },
Steven Moreland1f642412017-06-26 13:52:06 -070095
Dan Willemsen2e1591b2016-07-12 17:20:18 -070096 target: {
97 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070098 cflags: ["-fvisibility=protected"],
99
100 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +0000101 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700102 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +0900103 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700104 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -0700105
106 sanitize: {
107 misc_undefined: ["integer"],
108 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700109 },
110
Jiyong Park011ee122018-05-29 16:41:30 +0900111 recovery: {
112 exclude_shared_libs: ["libvndksupport"],
113 },
114
Dan Willemsenab34b472016-11-29 13:32:55 -0800115 linux_bionic: {
116 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800117 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700118
119 darwin: {
120 cflags: ["-Wno-unused-parameter"],
121 },
122
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700123 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800124 cflags: [
125 // Under MinGW, ctype.h doesn't need multi-byte support
126 "-DMB_CUR_MAX=1",
127 "-Wno-unused-private-field",
128 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700129
130 enabled: true,
131 },
132 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700133}
134
David Sehrabfb9f32018-01-17 17:07:09 -0800135cc_library {
136 name: "libutils",
137 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200138 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800139
140 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800141 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800142 "FileMap.cpp",
143 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000144 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800145 "NativeHandle.cpp",
146 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800147 "RefBase.cpp",
148 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800149 "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: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800169 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800170 srcs: [
171 "Looper.cpp",
172 ],
173 },
174 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800175
176 apex_available: [
177 "//apex_available:anyapex",
178 "//apex_available:platform",
179 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900180 min_sdk_version: "apex_inherit",
David Sehrabfb9f32018-01-17 17:07:09 -0800181}
182
183cc_library {
184 name: "libutilscallstack",
185 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200186 // TODO(b/153609531): remove when no longer needed.
187 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800188
189 srcs: [
190 "CallStack.cpp",
191 ],
192
Steven Morelande6132be2019-03-25 20:38:56 -0700193 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700194 "libutils",
195 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700196 ],
197
David Sehrabfb9f32018-01-17 17:07:09 -0800198 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800199 linux: {
200 srcs: [
201 "ProcessCallStack.cpp",
202 ],
203 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700204 darwin: {
205 enabled: false,
206 },
Steven Morelande6132be2019-03-25 20:38:56 -0700207 windows: {
208 enabled: false,
209 },
David Sehrabfb9f32018-01-17 17:07:09 -0800210 },
211}
212
Dylan Katz9d5845b2020-05-11 15:44:01 -0700213cc_defaults {
214 name: "libutils_fuzz_defaults",
215 host_supported: true,
216 shared_libs: [
217 "libutils",
218 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700219 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700220 ],
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
Dylan Katz7168f272020-07-02 11:51:44 -0700253cc_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_stopwatch",
279 defaults: ["libutils_fuzz_defaults"],
280 srcs: ["StopWatch_fuzz.cpp"],
281}
282
283cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700284 name: "libutils_fuzz_refbase",
285 defaults: ["libutils_fuzz_defaults"],
286 srcs: ["RefBase_fuzz.cpp"],
287}
288
289cc_fuzz {
290 name: "libutils_fuzz_lrucache",
291 defaults: ["libutils_fuzz_defaults"],
292 srcs: ["LruCache_fuzz.cpp"],
293}
294
295cc_fuzz {
296 name: "libutils_fuzz_looper",
297 defaults: ["libutils_fuzz_defaults"],
298 srcs: ["Looper_fuzz.cpp"],
299}
300
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700301cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800302 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700303 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800304
305 srcs: [
306 "BitSet_test.cpp",
307 "FileMap_test.cpp",
308 "LruCache_test.cpp",
309 "Mutex_test.cpp",
310 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800311 "Singleton_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800312 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700313 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800314 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700315 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800316 "Unicode_test.cpp",
317 "Vector_test.cpp",
318 ],
319
320 target: {
321 android: {
322 srcs: [
323 "SystemClock_test.cpp",
324 ],
325 shared_libs: [
326 "libz",
327 "liblog",
328 "libcutils",
329 "libutils",
330 "libbase",
331 ],
332 },
333 linux: {
334 srcs: [
335 "Looper_test.cpp",
336 "RefBase_test.cpp",
337 ],
338 },
339 host: {
340 static_libs: [
341 "libutils",
342 "liblog",
343 "libbase",
344 ],
345 },
346 },
347
Yo Chiang5b028ba2020-07-10 19:34:53 +0800348 data_libs: [
349 "libutils_test_singleton1",
350 "libutils_test_singleton2",
351 ],
352
Elliott Hughes01705e42019-02-07 12:41:37 -0800353 cflags: [
354 "-Wall",
355 "-Wextra",
356 "-Werror",
357 "-Wthread-safety",
358 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800359
360 test_suites: ["device-tests"],
361}
362
Elliott Hughes01705e42019-02-07 12:41:37 -0800363cc_test_library {
364 name: "libutils_test_singleton1",
365 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800366 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800367 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800368 cflags: [
369 "-Wall",
370 "-Werror",
371 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700372}
Elliott Hughes01705e42019-02-07 12:41:37 -0800373
374cc_test_library {
375 name: "libutils_test_singleton2",
376 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800377 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800378 srcs: ["Singleton_test2.cpp"],
379 cflags: [
380 "-Wall",
381 "-Werror",
382 ],
383 shared_libs: ["libutils_test_singleton1"],
384}
Steven Morelandc732c032019-09-03 18:04:50 -0700385
386cc_benchmark {
387 name: "libutils_benchmark",
388 srcs: ["Vector_benchmark.cpp"],
389 shared_libs: ["libutils"],
390}