blob: 7d6a6c5380953796569edddf6667bffd74a5353c [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",
Steven Morelanda06e68c2021-04-27 00:09:23 +000079 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Elliott Hughesdc699a22018-02-16 17:58:14 -080080 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070081 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070082 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070083 "libutils_headers",
84 ],
85 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070086 "libutils_headers",
87 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070088
Steven Moreland1f642412017-06-26 13:52:06 -070089 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070090 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070091 "liblog",
92 ],
Steven Moreland9c832022020-07-07 22:37:07 +000093 sanitize: {
94 misc_undefined: ["integer"],
95 },
Steven Moreland1f642412017-06-26 13:52:06 -070096
Dan Willemsen2e1591b2016-07-12 17:20:18 -070097 target: {
98 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070099 cflags: ["-fvisibility=protected"],
100
101 shared_libs: [
Jiyong Park0b3c24b2017-05-26 17:57:18 +0900102 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700103 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -0700104
105 sanitize: {
106 misc_undefined: ["integer"],
107 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700108 },
109
Jiyong Park011ee122018-05-29 16:41:30 +0900110 recovery: {
111 exclude_shared_libs: ["libvndksupport"],
112 },
113
Dan Willemsenab34b472016-11-29 13:32:55 -0800114 linux_bionic: {
115 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800116 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700117
118 darwin: {
119 cflags: ["-Wno-unused-parameter"],
120 },
121
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700122 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800123 cflags: [
124 // Under MinGW, ctype.h doesn't need multi-byte support
125 "-DMB_CUR_MAX=1",
126 "-Wno-unused-private-field",
127 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700128
129 enabled: true,
130 },
131 },
Anis Assie75dd9a2022-03-08 19:48:19 +0000132 fuzz_config: {
133 cc: ["smoreland@google.com"],
134 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700135}
136
David Sehrabfb9f32018-01-17 17:07:09 -0800137cc_library {
138 name: "libutils",
139 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200140 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800141
142 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800143 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800144 "FileMap.cpp",
145 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000146 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800147 "NativeHandle.cpp",
148 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800149 "RefBase.cpp",
150 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800151 "StopWatch.cpp",
152 "String8.cpp",
153 "String16.cpp",
154 "StrongPointer.cpp",
155 "SystemClock.cpp",
156 "Threads.cpp",
157 "Timers.cpp",
158 "Tokenizer.cpp",
159 "Unicode.cpp",
160 "VectorImpl.cpp",
161 "misc.cpp",
162 ],
163
164 target: {
165 android: {
166 srcs: [
167 "Trace.cpp",
168 ],
169 },
170 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800171 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800172 srcs: [
173 "Looper.cpp",
174 ],
175 },
176 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800177
178 apex_available: [
179 "//apex_available:anyapex",
180 "//apex_available:platform",
181 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900182 min_sdk_version: "apex_inherit",
Yi Kong6ee028f2021-12-23 15:57:40 +0800183
184 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800185}
186
187cc_library {
188 name: "libutilscallstack",
189 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200190 // TODO(b/153609531): remove when no longer needed.
191 native_bridge_supported: true,
Steven Moreland6c509ca2022-04-11 22:30:07 +0000192 min_sdk_version: "29",
David Sehrabfb9f32018-01-17 17:07:09 -0800193
194 srcs: [
195 "CallStack.cpp",
196 ],
197
Steven Morelande6132be2019-03-25 20:38:56 -0700198 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700199 "libutils",
200 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700201 ],
202
David Sehrabfb9f32018-01-17 17:07:09 -0800203 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800204 linux: {
205 srcs: [
206 "ProcessCallStack.cpp",
207 ],
208 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700209 darwin: {
210 enabled: false,
211 },
Steven Morelande6132be2019-03-25 20:38:56 -0700212 windows: {
213 enabled: false,
214 },
David Sehrabfb9f32018-01-17 17:07:09 -0800215 },
216}
217
Dylan Katz9d5845b2020-05-11 15:44:01 -0700218cc_defaults {
219 name: "libutils_fuzz_defaults",
220 host_supported: true,
221 shared_libs: [
222 "libutils",
223 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700224 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700225 ],
226}
227
228cc_fuzz {
229 name: "libutils_fuzz_bitset",
230 defaults: ["libutils_fuzz_defaults"],
231 srcs: ["BitSet_fuzz.cpp"],
232}
233
234cc_fuzz {
235 name: "libutils_fuzz_filemap",
236 defaults: ["libutils_fuzz_defaults"],
237 srcs: ["FileMap_fuzz.cpp"],
238}
239
240cc_fuzz {
241 name: "libutils_fuzz_string8",
242 defaults: ["libutils_fuzz_defaults"],
243 srcs: ["String8_fuzz.cpp"],
244}
245
246cc_fuzz {
247 name: "libutils_fuzz_string16",
248 defaults: ["libutils_fuzz_defaults"],
249 srcs: ["String16_fuzz.cpp"],
250}
251
252cc_fuzz {
253 name: "libutils_fuzz_vector",
254 defaults: ["libutils_fuzz_defaults"],
255 srcs: ["Vector_fuzz.cpp"],
256}
257
Dylan Katz7168f272020-07-02 11:51:44 -0700258cc_fuzz {
259 name: "libutils_fuzz_printer",
260 defaults: ["libutils_fuzz_defaults"],
261 srcs: ["Printer_fuzz.cpp"],
262}
263
264cc_fuzz {
265 name: "libutils_fuzz_callstack",
266 defaults: ["libutils_fuzz_defaults"],
267 srcs: ["CallStack_fuzz.cpp"],
268 shared_libs: [
269 "libutilscallstack",
270 ],
271}
272
273cc_fuzz {
274 name: "libutils_fuzz_process_callstack",
275 defaults: ["libutils_fuzz_defaults"],
276 srcs: ["ProcessCallStack_fuzz.cpp"],
277 shared_libs: [
278 "libutilscallstack",
279 ],
280}
281
282cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700283 name: "libutils_fuzz_refbase",
284 defaults: ["libutils_fuzz_defaults"],
285 srcs: ["RefBase_fuzz.cpp"],
286}
287
288cc_fuzz {
289 name: "libutils_fuzz_lrucache",
290 defaults: ["libutils_fuzz_defaults"],
291 srcs: ["LruCache_fuzz.cpp"],
292}
293
294cc_fuzz {
295 name: "libutils_fuzz_looper",
296 defaults: ["libutils_fuzz_defaults"],
297 srcs: ["Looper_fuzz.cpp"],
298}
299
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700300cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800301 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700302 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800303
304 srcs: [
305 "BitSet_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900306 "Errors_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800307 "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",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700312 "String16_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900313 "String8_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 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900372 header_libs: ["libutils_headers"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700373}
Elliott Hughes01705e42019-02-07 12:41:37 -0800374
375cc_test_library {
376 name: "libutils_test_singleton2",
377 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800378 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800379 srcs: ["Singleton_test2.cpp"],
380 cflags: [
381 "-Wall",
382 "-Werror",
383 ],
384 shared_libs: ["libutils_test_singleton1"],
Jiyong Park705abe22021-12-14 22:55:34 +0900385 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800386}
Steven Morelandc732c032019-09-03 18:04:50 -0700387
388cc_benchmark {
389 name: "libutils_benchmark",
390 srcs: ["Vector_benchmark.cpp"],
391 shared_libs: ["libutils"],
392}