blob: e6d9a4c6efeb78e6bc48874ca8966c2ac002c706 [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",
David Sehrabfb9f32018-01-17 17:07:09 -0800180}
181
182cc_library {
183 name: "libutilscallstack",
184 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200185 // TODO(b/153609531): remove when no longer needed.
186 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800187
188 srcs: [
189 "CallStack.cpp",
190 ],
191
Steven Morelande6132be2019-03-25 20:38:56 -0700192 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700193 "libutils",
194 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700195 ],
196
David Sehrabfb9f32018-01-17 17:07:09 -0800197 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800198 linux: {
199 srcs: [
200 "ProcessCallStack.cpp",
201 ],
202 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700203 darwin: {
204 enabled: false,
205 },
Steven Morelande6132be2019-03-25 20:38:56 -0700206 windows: {
207 enabled: false,
208 },
David Sehrabfb9f32018-01-17 17:07:09 -0800209 },
210}
211
Dylan Katz9d5845b2020-05-11 15:44:01 -0700212cc_defaults {
213 name: "libutils_fuzz_defaults",
214 host_supported: true,
215 shared_libs: [
216 "libutils",
217 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700218 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700219 ],
220}
221
222cc_fuzz {
223 name: "libutils_fuzz_bitset",
224 defaults: ["libutils_fuzz_defaults"],
225 srcs: ["BitSet_fuzz.cpp"],
226}
227
228cc_fuzz {
229 name: "libutils_fuzz_filemap",
230 defaults: ["libutils_fuzz_defaults"],
231 srcs: ["FileMap_fuzz.cpp"],
232}
233
234cc_fuzz {
235 name: "libutils_fuzz_string8",
236 defaults: ["libutils_fuzz_defaults"],
237 srcs: ["String8_fuzz.cpp"],
238}
239
240cc_fuzz {
241 name: "libutils_fuzz_string16",
242 defaults: ["libutils_fuzz_defaults"],
243 srcs: ["String16_fuzz.cpp"],
244}
245
246cc_fuzz {
247 name: "libutils_fuzz_vector",
248 defaults: ["libutils_fuzz_defaults"],
249 srcs: ["Vector_fuzz.cpp"],
250}
251
Dylan Katz7168f272020-07-02 11:51:44 -0700252cc_fuzz {
253 name: "libutils_fuzz_printer",
254 defaults: ["libutils_fuzz_defaults"],
255 srcs: ["Printer_fuzz.cpp"],
256}
257
258cc_fuzz {
259 name: "libutils_fuzz_callstack",
260 defaults: ["libutils_fuzz_defaults"],
261 srcs: ["CallStack_fuzz.cpp"],
262 shared_libs: [
263 "libutilscallstack",
264 ],
265}
266
267cc_fuzz {
268 name: "libutils_fuzz_process_callstack",
269 defaults: ["libutils_fuzz_defaults"],
270 srcs: ["ProcessCallStack_fuzz.cpp"],
271 shared_libs: [
272 "libutilscallstack",
273 ],
274}
275
276cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700277 name: "libutils_fuzz_refbase",
278 defaults: ["libutils_fuzz_defaults"],
279 srcs: ["RefBase_fuzz.cpp"],
280}
281
282cc_fuzz {
283 name: "libutils_fuzz_lrucache",
284 defaults: ["libutils_fuzz_defaults"],
285 srcs: ["LruCache_fuzz.cpp"],
286}
287
288cc_fuzz {
289 name: "libutils_fuzz_looper",
290 defaults: ["libutils_fuzz_defaults"],
291 srcs: ["Looper_fuzz.cpp"],
292}
293
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700294cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800295 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700296 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800297
298 srcs: [
299 "BitSet_test.cpp",
300 "FileMap_test.cpp",
301 "LruCache_test.cpp",
302 "Mutex_test.cpp",
303 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800304 "Singleton_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800305 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700306 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800307 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700308 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800309 "Unicode_test.cpp",
310 "Vector_test.cpp",
311 ],
312
313 target: {
314 android: {
315 srcs: [
316 "SystemClock_test.cpp",
317 ],
318 shared_libs: [
319 "libz",
320 "liblog",
321 "libcutils",
322 "libutils",
323 "libbase",
324 ],
325 },
326 linux: {
327 srcs: [
328 "Looper_test.cpp",
329 "RefBase_test.cpp",
330 ],
331 },
332 host: {
333 static_libs: [
334 "libutils",
335 "liblog",
336 "libbase",
337 ],
338 },
339 },
340
Yo Chiang5b028ba2020-07-10 19:34:53 +0800341 data_libs: [
342 "libutils_test_singleton1",
343 "libutils_test_singleton2",
344 ],
345
Elliott Hughes01705e42019-02-07 12:41:37 -0800346 cflags: [
347 "-Wall",
348 "-Wextra",
349 "-Werror",
350 "-Wthread-safety",
351 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800352
353 test_suites: ["device-tests"],
354}
355
Elliott Hughes01705e42019-02-07 12:41:37 -0800356cc_test_library {
357 name: "libutils_test_singleton1",
358 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800359 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800360 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800361 cflags: [
362 "-Wall",
363 "-Werror",
364 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700365}
Elliott Hughes01705e42019-02-07 12:41:37 -0800366
367cc_test_library {
368 name: "libutils_test_singleton2",
369 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800370 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800371 srcs: ["Singleton_test2.cpp"],
372 cflags: [
373 "-Wall",
374 "-Werror",
375 ],
376 shared_libs: ["libutils_test_singleton1"],
377}
Steven Morelandc732c032019-09-03 18:04:50 -0700378
379cc_benchmark {
380 name: "libutils_benchmark",
381 srcs: ["Vector_benchmark.cpp"],
382 shared_libs: ["libutils"],
383}