blob: 79722ae95dbfe3b25938e9aa34dff9fff04c2816 [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 },
Christopher Ferris0e691602020-10-14 14:13:58 -070051 linux_glibc: {
52 header_libs: ["libbacktrace_headers"],
53 export_header_lib_headers: ["libbacktrace_headers"],
54 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070055 linux_bionic: {
Christopher Ferris0e691602020-10-14 14:13:58 -070056 header_libs: ["libbacktrace_headers"],
57 export_header_lib_headers: ["libbacktrace_headers"],
Dan Willemsene0cd1e02017-03-15 15:23:36 -070058 enabled: true,
59 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080060 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070061 enabled: true,
62 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080063 },
64}
65
David Sehrabfb9f32018-01-17 17:07:09 -080066cc_defaults {
67 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070068 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090069 product_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090070 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090071 vndk: {
72 enabled: true,
73 support_system_process: true,
74 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070075 host_supported: true,
76
Elliott Hughesdc699a22018-02-16 17:58:14 -080077 cflags: [
78 "-Wall",
79 "-Werror",
Elliott Hughes48a9eb42021-03-04 09:46:23 -080080 "-Wno-exit-time-destructors",
Steven Morelanda06e68c2021-04-27 00:09:23 +000081 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Elliott Hughesdc699a22018-02-16 17:58:14 -080082 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070083 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070084 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070085 "libutils_headers",
86 ],
87 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070088 "libutils_headers",
89 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070090
Steven Moreland1f642412017-06-26 13:52:06 -070091 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070092 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070093 "liblog",
94 ],
Steven Moreland9c832022020-07-07 22:37:07 +000095 sanitize: {
96 misc_undefined: ["integer"],
97 },
Steven Moreland1f642412017-06-26 13:52:06 -070098
Dan Willemsen2e1591b2016-07-12 17:20:18 -070099 target: {
100 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700101 cflags: ["-fvisibility=protected"],
102
103 shared_libs: [
Jiyong Park0b3c24b2017-05-26 17:57:18 +0900104 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700105 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -0700106
107 sanitize: {
108 misc_undefined: ["integer"],
109 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700110 },
111
Jiyong Park011ee122018-05-29 16:41:30 +0900112 recovery: {
113 exclude_shared_libs: ["libvndksupport"],
114 },
115
Dan Willemsenab34b472016-11-29 13:32:55 -0800116 linux_bionic: {
117 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800118 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700119
120 darwin: {
121 cflags: ["-Wno-unused-parameter"],
122 },
123
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700124 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800125 cflags: [
126 // Under MinGW, ctype.h doesn't need multi-byte support
127 "-DMB_CUR_MAX=1",
128 "-Wno-unused-private-field",
129 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700130
131 enabled: true,
132 },
133 },
Anis Assie75dd9a2022-03-08 19:48:19 +0000134 fuzz_config: {
135 cc: ["smoreland@google.com"],
136 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700137}
138
David Sehrabfb9f32018-01-17 17:07:09 -0800139cc_library {
140 name: "libutils",
141 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200142 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800143
144 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800145 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800146 "FileMap.cpp",
147 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000148 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800149 "NativeHandle.cpp",
150 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800151 "RefBase.cpp",
152 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800153 "StopWatch.cpp",
154 "String8.cpp",
155 "String16.cpp",
156 "StrongPointer.cpp",
157 "SystemClock.cpp",
158 "Threads.cpp",
159 "Timers.cpp",
160 "Tokenizer.cpp",
161 "Unicode.cpp",
162 "VectorImpl.cpp",
163 "misc.cpp",
164 ],
165
166 target: {
167 android: {
168 srcs: [
169 "Trace.cpp",
170 ],
171 },
172 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800173 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800174 srcs: [
175 "Looper.cpp",
176 ],
177 },
178 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800179
180 apex_available: [
181 "//apex_available:anyapex",
182 "//apex_available:platform",
183 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900184 min_sdk_version: "apex_inherit",
Yi Kong6ee028f2021-12-23 15:57:40 +0800185
186 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800187}
188
189cc_library {
190 name: "libutilscallstack",
191 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200192 // TODO(b/153609531): remove when no longer needed.
193 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800194
195 srcs: [
196 "CallStack.cpp",
197 ],
198
Steven Morelande6132be2019-03-25 20:38:56 -0700199 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700200 "libutils",
201 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700202 ],
203
David Sehrabfb9f32018-01-17 17:07:09 -0800204 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800205 linux: {
206 srcs: [
207 "ProcessCallStack.cpp",
208 ],
209 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700210 darwin: {
211 enabled: false,
212 },
Steven Morelande6132be2019-03-25 20:38:56 -0700213 windows: {
214 enabled: false,
215 },
David Sehrabfb9f32018-01-17 17:07:09 -0800216 },
217}
218
Dylan Katz9d5845b2020-05-11 15:44:01 -0700219cc_defaults {
220 name: "libutils_fuzz_defaults",
221 host_supported: true,
222 shared_libs: [
223 "libutils",
224 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700225 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700226 ],
227}
228
229cc_fuzz {
230 name: "libutils_fuzz_bitset",
231 defaults: ["libutils_fuzz_defaults"],
232 srcs: ["BitSet_fuzz.cpp"],
233}
234
235cc_fuzz {
236 name: "libutils_fuzz_filemap",
237 defaults: ["libutils_fuzz_defaults"],
238 srcs: ["FileMap_fuzz.cpp"],
239}
240
241cc_fuzz {
242 name: "libutils_fuzz_string8",
243 defaults: ["libutils_fuzz_defaults"],
244 srcs: ["String8_fuzz.cpp"],
245}
246
247cc_fuzz {
248 name: "libutils_fuzz_string16",
249 defaults: ["libutils_fuzz_defaults"],
250 srcs: ["String16_fuzz.cpp"],
251}
252
253cc_fuzz {
254 name: "libutils_fuzz_vector",
255 defaults: ["libutils_fuzz_defaults"],
256 srcs: ["Vector_fuzz.cpp"],
257}
258
Dylan Katz7168f272020-07-02 11:51:44 -0700259cc_fuzz {
260 name: "libutils_fuzz_printer",
261 defaults: ["libutils_fuzz_defaults"],
262 srcs: ["Printer_fuzz.cpp"],
263}
264
265cc_fuzz {
266 name: "libutils_fuzz_callstack",
267 defaults: ["libutils_fuzz_defaults"],
268 srcs: ["CallStack_fuzz.cpp"],
269 shared_libs: [
270 "libutilscallstack",
271 ],
272}
273
274cc_fuzz {
275 name: "libutils_fuzz_process_callstack",
276 defaults: ["libutils_fuzz_defaults"],
277 srcs: ["ProcessCallStack_fuzz.cpp"],
278 shared_libs: [
279 "libutilscallstack",
280 ],
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",
Jiyong Park705abe22021-12-14 22:55:34 +0900307 "Errors_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800308 "FileMap_test.cpp",
309 "LruCache_test.cpp",
310 "Mutex_test.cpp",
311 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800312 "Singleton_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700313 "String16_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900314 "String8_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800315 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700316 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800317 "Unicode_test.cpp",
318 "Vector_test.cpp",
319 ],
320
321 target: {
322 android: {
323 srcs: [
324 "SystemClock_test.cpp",
325 ],
326 shared_libs: [
327 "libz",
328 "liblog",
329 "libcutils",
330 "libutils",
331 "libbase",
332 ],
333 },
334 linux: {
335 srcs: [
336 "Looper_test.cpp",
337 "RefBase_test.cpp",
338 ],
339 },
340 host: {
341 static_libs: [
342 "libutils",
343 "liblog",
344 "libbase",
345 ],
346 },
347 },
348
Yo Chiang5b028ba2020-07-10 19:34:53 +0800349 data_libs: [
350 "libutils_test_singleton1",
351 "libutils_test_singleton2",
352 ],
353
Elliott Hughes01705e42019-02-07 12:41:37 -0800354 cflags: [
355 "-Wall",
356 "-Wextra",
357 "-Werror",
358 "-Wthread-safety",
359 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800360
361 test_suites: ["device-tests"],
362}
363
Elliott Hughes01705e42019-02-07 12:41:37 -0800364cc_test_library {
365 name: "libutils_test_singleton1",
366 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800367 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800368 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800369 cflags: [
370 "-Wall",
371 "-Werror",
372 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900373 header_libs: ["libutils_headers"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700374}
Elliott Hughes01705e42019-02-07 12:41:37 -0800375
376cc_test_library {
377 name: "libutils_test_singleton2",
378 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800379 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800380 srcs: ["Singleton_test2.cpp"],
381 cflags: [
382 "-Wall",
383 "-Werror",
384 ],
385 shared_libs: ["libutils_test_singleton1"],
Jiyong Park705abe22021-12-14 22:55:34 +0900386 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800387}
Steven Morelandc732c032019-09-03 18:04:50 -0700388
389cc_benchmark {
390 name: "libutils_benchmark",
391 srcs: ["Vector_benchmark.cpp"],
392 shared_libs: ["libutils"],
393}