blob: 1b292857c6427dd619ecf079d0935ccc08c9a92f [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: {
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070047 android: {
48 header_libs: ["libbacktrace_headers"],
49 export_header_lib_headers: ["libbacktrace_headers"],
50 },
Colin Cross10bbb012022-03-24 15:59:08 -070051 host_linux: {
Christopher Ferris0e691602020-10-14 14:13:58 -070052 header_libs: ["libbacktrace_headers"],
53 export_header_lib_headers: ["libbacktrace_headers"],
54 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070055 linux_bionic: {
56 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: [
Jiyong Park0b3c24b2017-05-26 17:57:18 +0900101 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700102 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -0700103
104 sanitize: {
105 misc_undefined: ["integer"],
106 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700107 },
108
Jiyong Park011ee122018-05-29 16:41:30 +0900109 recovery: {
110 exclude_shared_libs: ["libvndksupport"],
111 },
112
Dan Willemsenab34b472016-11-29 13:32:55 -0800113 linux_bionic: {
114 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800115 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700116
117 darwin: {
118 cflags: ["-Wno-unused-parameter"],
119 },
120
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700121 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800122 cflags: [
123 // Under MinGW, ctype.h doesn't need multi-byte support
124 "-DMB_CUR_MAX=1",
125 "-Wno-unused-private-field",
126 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700127
128 enabled: true,
129 },
130 },
Anis Assie75dd9a2022-03-08 19:48:19 +0000131 fuzz_config: {
132 cc: ["smoreland@google.com"],
133 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700134}
135
David Sehrabfb9f32018-01-17 17:07:09 -0800136cc_library {
137 name: "libutils",
138 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200139 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800140
141 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800142 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800143 "FileMap.cpp",
144 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000145 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800146 "NativeHandle.cpp",
147 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800148 "RefBase.cpp",
149 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800150 "StopWatch.cpp",
151 "String8.cpp",
152 "String16.cpp",
153 "StrongPointer.cpp",
154 "SystemClock.cpp",
155 "Threads.cpp",
156 "Timers.cpp",
157 "Tokenizer.cpp",
158 "Unicode.cpp",
159 "VectorImpl.cpp",
160 "misc.cpp",
161 ],
162
163 target: {
164 android: {
165 srcs: [
166 "Trace.cpp",
167 ],
168 },
169 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800170 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800171 srcs: [
172 "Looper.cpp",
173 ],
174 },
175 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800176
177 apex_available: [
178 "//apex_available:anyapex",
179 "//apex_available:platform",
180 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900181 min_sdk_version: "apex_inherit",
Yi Kong6ee028f2021-12-23 15:57:40 +0800182
183 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800184}
185
186cc_library {
187 name: "libutilscallstack",
188 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200189 // TODO(b/153609531): remove when no longer needed.
190 native_bridge_supported: true,
Steven Moreland6c509ca2022-04-11 22:30:07 +0000191 min_sdk_version: "29",
David Sehrabfb9f32018-01-17 17:07:09 -0800192
193 srcs: [
194 "CallStack.cpp",
195 ],
196
Steven Morelande6132be2019-03-25 20:38:56 -0700197 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700198 "libutils",
199 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700200 ],
201
David Sehrabfb9f32018-01-17 17:07:09 -0800202 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800203 linux: {
204 srcs: [
205 "ProcessCallStack.cpp",
206 ],
207 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700208 darwin: {
209 enabled: false,
210 },
Steven Morelande6132be2019-03-25 20:38:56 -0700211 windows: {
212 enabled: false,
213 },
David Sehrabfb9f32018-01-17 17:07:09 -0800214 },
215}
216
Dylan Katz9d5845b2020-05-11 15:44:01 -0700217cc_defaults {
218 name: "libutils_fuzz_defaults",
219 host_supported: true,
220 shared_libs: [
221 "libutils",
222 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700223 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700224 ],
225}
226
227cc_fuzz {
228 name: "libutils_fuzz_bitset",
229 defaults: ["libutils_fuzz_defaults"],
230 srcs: ["BitSet_fuzz.cpp"],
231}
232
233cc_fuzz {
234 name: "libutils_fuzz_filemap",
235 defaults: ["libutils_fuzz_defaults"],
236 srcs: ["FileMap_fuzz.cpp"],
237}
238
239cc_fuzz {
240 name: "libutils_fuzz_string8",
241 defaults: ["libutils_fuzz_defaults"],
242 srcs: ["String8_fuzz.cpp"],
243}
244
245cc_fuzz {
246 name: "libutils_fuzz_string16",
247 defaults: ["libutils_fuzz_defaults"],
248 srcs: ["String16_fuzz.cpp"],
249}
250
251cc_fuzz {
252 name: "libutils_fuzz_vector",
253 defaults: ["libutils_fuzz_defaults"],
254 srcs: ["Vector_fuzz.cpp"],
255}
256
Dylan Katz7168f272020-07-02 11:51:44 -0700257cc_fuzz {
258 name: "libutils_fuzz_printer",
259 defaults: ["libutils_fuzz_defaults"],
260 srcs: ["Printer_fuzz.cpp"],
261}
262
263cc_fuzz {
264 name: "libutils_fuzz_callstack",
265 defaults: ["libutils_fuzz_defaults"],
266 srcs: ["CallStack_fuzz.cpp"],
267 shared_libs: [
268 "libutilscallstack",
269 ],
270}
271
272cc_fuzz {
273 name: "libutils_fuzz_process_callstack",
274 defaults: ["libutils_fuzz_defaults"],
275 srcs: ["ProcessCallStack_fuzz.cpp"],
276 shared_libs: [
277 "libutilscallstack",
278 ],
279}
280
281cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700282 name: "libutils_fuzz_refbase",
283 defaults: ["libutils_fuzz_defaults"],
284 srcs: ["RefBase_fuzz.cpp"],
285}
286
287cc_fuzz {
288 name: "libutils_fuzz_lrucache",
289 defaults: ["libutils_fuzz_defaults"],
290 srcs: ["LruCache_fuzz.cpp"],
291}
292
293cc_fuzz {
294 name: "libutils_fuzz_looper",
295 defaults: ["libutils_fuzz_defaults"],
296 srcs: ["Looper_fuzz.cpp"],
297}
298
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700299cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800300 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700301 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800302
303 srcs: [
304 "BitSet_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900305 "Errors_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800306 "FileMap_test.cpp",
307 "LruCache_test.cpp",
308 "Mutex_test.cpp",
309 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800310 "Singleton_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700311 "String16_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900312 "String8_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800313 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700314 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800315 "Unicode_test.cpp",
316 "Vector_test.cpp",
317 ],
318
319 target: {
320 android: {
321 srcs: [
322 "SystemClock_test.cpp",
323 ],
324 shared_libs: [
325 "libz",
326 "liblog",
327 "libcutils",
328 "libutils",
329 "libbase",
330 ],
331 },
332 linux: {
333 srcs: [
334 "Looper_test.cpp",
335 "RefBase_test.cpp",
336 ],
337 },
338 host: {
339 static_libs: [
340 "libutils",
341 "liblog",
342 "libbase",
343 ],
344 },
345 },
346
Yo Chiang5b028ba2020-07-10 19:34:53 +0800347 data_libs: [
348 "libutils_test_singleton1",
349 "libutils_test_singleton2",
350 ],
351
Elliott Hughes01705e42019-02-07 12:41:37 -0800352 cflags: [
353 "-Wall",
354 "-Wextra",
355 "-Werror",
356 "-Wthread-safety",
357 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800358
359 test_suites: ["device-tests"],
360}
361
Elliott Hughes01705e42019-02-07 12:41:37 -0800362cc_test_library {
363 name: "libutils_test_singleton1",
364 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800365 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800366 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800367 cflags: [
368 "-Wall",
369 "-Werror",
370 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900371 header_libs: ["libutils_headers"],
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"],
Jiyong Park705abe22021-12-14 22:55:34 +0900384 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800385}
Steven Morelandc732c032019-09-03 18:04:50 -0700386
387cc_benchmark {
388 name: "libutils_benchmark",
389 srcs: ["Vector_benchmark.cpp"],
390 shared_libs: ["libutils"],
391}