blob: bda9d6bdf3645d35bad5b1e9cc58b469b633f48c [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",
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 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700132}
133
David Sehrabfb9f32018-01-17 17:07:09 -0800134cc_library {
135 name: "libutils",
136 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200137 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800138
139 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800140 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800141 "FileMap.cpp",
142 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000143 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800144 "NativeHandle.cpp",
145 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800146 "RefBase.cpp",
147 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800148 "StopWatch.cpp",
149 "String8.cpp",
150 "String16.cpp",
151 "StrongPointer.cpp",
152 "SystemClock.cpp",
153 "Threads.cpp",
154 "Timers.cpp",
155 "Tokenizer.cpp",
156 "Unicode.cpp",
157 "VectorImpl.cpp",
158 "misc.cpp",
159 ],
160
161 target: {
162 android: {
163 srcs: [
164 "Trace.cpp",
165 ],
166 },
167 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800168 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800169 srcs: [
170 "Looper.cpp",
171 ],
172 },
173 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800174
175 apex_available: [
176 "//apex_available:anyapex",
177 "//apex_available:platform",
178 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900179 min_sdk_version: "apex_inherit",
Yi Kong6ee028f2021-12-23 15:57:40 +0800180
181 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800182}
183
184cc_library {
185 name: "libutilscallstack",
186 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200187 // TODO(b/153609531): remove when no longer needed.
188 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800189
190 srcs: [
191 "CallStack.cpp",
192 ],
193
Steven Morelande6132be2019-03-25 20:38:56 -0700194 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700195 "libutils",
196 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700197 ],
198
David Sehrabfb9f32018-01-17 17:07:09 -0800199 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800200 linux: {
201 srcs: [
202 "ProcessCallStack.cpp",
203 ],
204 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700205 darwin: {
206 enabled: false,
207 },
Steven Morelande6132be2019-03-25 20:38:56 -0700208 windows: {
209 enabled: false,
210 },
David Sehrabfb9f32018-01-17 17:07:09 -0800211 },
212}
213
Dylan Katz9d5845b2020-05-11 15:44:01 -0700214cc_defaults {
215 name: "libutils_fuzz_defaults",
216 host_supported: true,
217 shared_libs: [
218 "libutils",
219 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700220 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700221 ],
222}
223
224cc_fuzz {
225 name: "libutils_fuzz_bitset",
226 defaults: ["libutils_fuzz_defaults"],
227 srcs: ["BitSet_fuzz.cpp"],
228}
229
230cc_fuzz {
231 name: "libutils_fuzz_filemap",
232 defaults: ["libutils_fuzz_defaults"],
233 srcs: ["FileMap_fuzz.cpp"],
234}
235
236cc_fuzz {
237 name: "libutils_fuzz_string8",
238 defaults: ["libutils_fuzz_defaults"],
239 srcs: ["String8_fuzz.cpp"],
240}
241
242cc_fuzz {
243 name: "libutils_fuzz_string16",
244 defaults: ["libutils_fuzz_defaults"],
245 srcs: ["String16_fuzz.cpp"],
246}
247
248cc_fuzz {
249 name: "libutils_fuzz_vector",
250 defaults: ["libutils_fuzz_defaults"],
251 srcs: ["Vector_fuzz.cpp"],
252}
253
Dylan Katz7168f272020-07-02 11:51:44 -0700254cc_fuzz {
255 name: "libutils_fuzz_printer",
256 defaults: ["libutils_fuzz_defaults"],
257 srcs: ["Printer_fuzz.cpp"],
258}
259
260cc_fuzz {
261 name: "libutils_fuzz_callstack",
262 defaults: ["libutils_fuzz_defaults"],
263 srcs: ["CallStack_fuzz.cpp"],
264 shared_libs: [
265 "libutilscallstack",
266 ],
267}
268
269cc_fuzz {
270 name: "libutils_fuzz_process_callstack",
271 defaults: ["libutils_fuzz_defaults"],
272 srcs: ["ProcessCallStack_fuzz.cpp"],
273 shared_libs: [
274 "libutilscallstack",
275 ],
276}
277
278cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700279 name: "libutils_fuzz_refbase",
280 defaults: ["libutils_fuzz_defaults"],
281 srcs: ["RefBase_fuzz.cpp"],
282}
283
284cc_fuzz {
285 name: "libutils_fuzz_lrucache",
286 defaults: ["libutils_fuzz_defaults"],
287 srcs: ["LruCache_fuzz.cpp"],
288}
289
290cc_fuzz {
291 name: "libutils_fuzz_looper",
292 defaults: ["libutils_fuzz_defaults"],
293 srcs: ["Looper_fuzz.cpp"],
294}
295
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700296cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800297 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700298 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800299
300 srcs: [
301 "BitSet_test.cpp",
302 "FileMap_test.cpp",
303 "LruCache_test.cpp",
304 "Mutex_test.cpp",
305 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800306 "Singleton_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800307 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700308 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800309 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700310 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800311 "Unicode_test.cpp",
312 "Vector_test.cpp",
313 ],
314
315 target: {
316 android: {
317 srcs: [
318 "SystemClock_test.cpp",
319 ],
320 shared_libs: [
321 "libz",
322 "liblog",
323 "libcutils",
324 "libutils",
325 "libbase",
326 ],
327 },
328 linux: {
329 srcs: [
330 "Looper_test.cpp",
331 "RefBase_test.cpp",
332 ],
333 },
334 host: {
335 static_libs: [
336 "libutils",
337 "liblog",
338 "libbase",
339 ],
340 },
341 },
342
Yo Chiang5b028ba2020-07-10 19:34:53 +0800343 data_libs: [
344 "libutils_test_singleton1",
345 "libutils_test_singleton2",
346 ],
347
Elliott Hughes01705e42019-02-07 12:41:37 -0800348 cflags: [
349 "-Wall",
350 "-Wextra",
351 "-Werror",
352 "-Wthread-safety",
353 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800354
355 test_suites: ["device-tests"],
356}
357
Elliott Hughes01705e42019-02-07 12:41:37 -0800358cc_test_library {
359 name: "libutils_test_singleton1",
360 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800361 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800362 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800363 cflags: [
364 "-Wall",
365 "-Werror",
366 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700367}
Elliott Hughes01705e42019-02-07 12:41:37 -0800368
369cc_test_library {
370 name: "libutils_test_singleton2",
371 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800372 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800373 srcs: ["Singleton_test2.cpp"],
374 cflags: [
375 "-Wall",
376 "-Werror",
377 ],
378 shared_libs: ["libutils_test_singleton1"],
379}
Steven Morelandc732c032019-09-03 18:04:50 -0700380
381cc_benchmark {
382 name: "libutils_benchmark",
383 srcs: ["Vector_benchmark.cpp"],
384 shared_libs: ["libutils"],
385}