blob: 53f6065cc41d0fb661047910f6508e6ef67eb2f6 [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",
Elliott Hughesdc699a22018-02-16 17:58:14 -080081 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070082 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070083 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070084 "libutils_headers",
85 ],
86 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070087 "libutils_headers",
88 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070089
Steven Moreland1f642412017-06-26 13:52:06 -070090 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070091 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070092 "liblog",
93 ],
Steven Moreland9c832022020-07-07 22:37:07 +000094 sanitize: {
95 misc_undefined: ["integer"],
96 },
Steven Moreland1f642412017-06-26 13:52:06 -070097
Dan Willemsen2e1591b2016-07-12 17:20:18 -070098 target: {
99 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700100 cflags: ["-fvisibility=protected"],
101
102 shared_libs: [
Jiyong Park0b3c24b2017-05-26 17:57:18 +0900103 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700104 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -0700105
106 sanitize: {
107 misc_undefined: ["integer"],
108 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700109 },
110
Jiyong Park011ee122018-05-29 16:41:30 +0900111 recovery: {
112 exclude_shared_libs: ["libvndksupport"],
113 },
114
Dan Willemsenab34b472016-11-29 13:32:55 -0800115 linux_bionic: {
116 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800117 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700118
119 darwin: {
120 cflags: ["-Wno-unused-parameter"],
121 },
122
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700123 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800124 cflags: [
125 // Under MinGW, ctype.h doesn't need multi-byte support
126 "-DMB_CUR_MAX=1",
127 "-Wno-unused-private-field",
128 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700129
130 enabled: true,
131 },
132 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700133}
134
David Sehrabfb9f32018-01-17 17:07:09 -0800135cc_library {
136 name: "libutils",
137 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200138 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800139
140 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800141 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800142 "FileMap.cpp",
143 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000144 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800145 "NativeHandle.cpp",
146 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800147 "RefBase.cpp",
148 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800149 "StopWatch.cpp",
150 "String8.cpp",
151 "String16.cpp",
152 "StrongPointer.cpp",
153 "SystemClock.cpp",
154 "Threads.cpp",
155 "Timers.cpp",
156 "Tokenizer.cpp",
157 "Unicode.cpp",
158 "VectorImpl.cpp",
159 "misc.cpp",
160 ],
161
162 target: {
163 android: {
164 srcs: [
165 "Trace.cpp",
166 ],
167 },
168 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800169 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800170 srcs: [
171 "Looper.cpp",
172 ],
173 },
174 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800175
176 apex_available: [
177 "//apex_available:anyapex",
178 "//apex_available:platform",
179 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900180 min_sdk_version: "apex_inherit",
Yi Kong6ee028f2021-12-23 15:57:40 +0800181
182 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800183}
184
185cc_library {
186 name: "libutilscallstack",
187 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200188 // TODO(b/153609531): remove when no longer needed.
189 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800190
191 srcs: [
192 "CallStack.cpp",
193 ],
194
Steven Morelande6132be2019-03-25 20:38:56 -0700195 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700196 "libutils",
197 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700198 ],
199
David Sehrabfb9f32018-01-17 17:07:09 -0800200 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800201 linux: {
202 srcs: [
203 "ProcessCallStack.cpp",
204 ],
205 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700206 darwin: {
207 enabled: false,
208 },
Steven Morelande6132be2019-03-25 20:38:56 -0700209 windows: {
210 enabled: false,
211 },
David Sehrabfb9f32018-01-17 17:07:09 -0800212 },
213}
214
Dylan Katz9d5845b2020-05-11 15:44:01 -0700215cc_defaults {
216 name: "libutils_fuzz_defaults",
217 host_supported: true,
218 shared_libs: [
219 "libutils",
220 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700221 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700222 ],
223}
224
225cc_fuzz {
226 name: "libutils_fuzz_bitset",
227 defaults: ["libutils_fuzz_defaults"],
228 srcs: ["BitSet_fuzz.cpp"],
229}
230
231cc_fuzz {
232 name: "libutils_fuzz_filemap",
233 defaults: ["libutils_fuzz_defaults"],
234 srcs: ["FileMap_fuzz.cpp"],
235}
236
237cc_fuzz {
238 name: "libutils_fuzz_string8",
239 defaults: ["libutils_fuzz_defaults"],
240 srcs: ["String8_fuzz.cpp"],
241}
242
243cc_fuzz {
244 name: "libutils_fuzz_string16",
245 defaults: ["libutils_fuzz_defaults"],
246 srcs: ["String16_fuzz.cpp"],
247}
248
249cc_fuzz {
250 name: "libutils_fuzz_vector",
251 defaults: ["libutils_fuzz_defaults"],
252 srcs: ["Vector_fuzz.cpp"],
253}
254
Dylan Katz7168f272020-07-02 11:51:44 -0700255cc_fuzz {
256 name: "libutils_fuzz_printer",
257 defaults: ["libutils_fuzz_defaults"],
258 srcs: ["Printer_fuzz.cpp"],
259}
260
261cc_fuzz {
262 name: "libutils_fuzz_callstack",
263 defaults: ["libutils_fuzz_defaults"],
264 srcs: ["CallStack_fuzz.cpp"],
265 shared_libs: [
266 "libutilscallstack",
267 ],
268}
269
270cc_fuzz {
271 name: "libutils_fuzz_process_callstack",
272 defaults: ["libutils_fuzz_defaults"],
273 srcs: ["ProcessCallStack_fuzz.cpp"],
274 shared_libs: [
275 "libutilscallstack",
276 ],
277}
278
279cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700280 name: "libutils_fuzz_refbase",
281 defaults: ["libutils_fuzz_defaults"],
282 srcs: ["RefBase_fuzz.cpp"],
283}
284
285cc_fuzz {
286 name: "libutils_fuzz_lrucache",
287 defaults: ["libutils_fuzz_defaults"],
288 srcs: ["LruCache_fuzz.cpp"],
289}
290
291cc_fuzz {
292 name: "libutils_fuzz_looper",
293 defaults: ["libutils_fuzz_defaults"],
294 srcs: ["Looper_fuzz.cpp"],
295}
296
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700297cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800298 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700299 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800300
301 srcs: [
302 "BitSet_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900303 "Errors_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800304 "FileMap_test.cpp",
305 "LruCache_test.cpp",
306 "Mutex_test.cpp",
307 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800308 "Singleton_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700309 "String16_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900310 "String8_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800311 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700312 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800313 "Unicode_test.cpp",
314 "Vector_test.cpp",
315 ],
316
317 target: {
318 android: {
319 srcs: [
320 "SystemClock_test.cpp",
321 ],
322 shared_libs: [
323 "libz",
324 "liblog",
325 "libcutils",
326 "libutils",
327 "libbase",
328 ],
329 },
330 linux: {
331 srcs: [
332 "Looper_test.cpp",
333 "RefBase_test.cpp",
334 ],
335 },
336 host: {
337 static_libs: [
338 "libutils",
339 "liblog",
340 "libbase",
341 ],
342 },
343 },
344
Yo Chiang5b028ba2020-07-10 19:34:53 +0800345 data_libs: [
346 "libutils_test_singleton1",
347 "libutils_test_singleton2",
348 ],
349
Elliott Hughes01705e42019-02-07 12:41:37 -0800350 cflags: [
351 "-Wall",
352 "-Wextra",
353 "-Werror",
354 "-Wthread-safety",
355 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800356
357 test_suites: ["device-tests"],
358}
359
Elliott Hughes01705e42019-02-07 12:41:37 -0800360cc_test_library {
361 name: "libutils_test_singleton1",
362 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800363 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800364 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800365 cflags: [
366 "-Wall",
367 "-Werror",
368 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900369 header_libs: ["libutils_headers"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700370}
Elliott Hughes01705e42019-02-07 12:41:37 -0800371
372cc_test_library {
373 name: "libutils_test_singleton2",
374 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800375 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800376 srcs: ["Singleton_test2.cpp"],
377 cflags: [
378 "-Wall",
379 "-Werror",
380 ],
381 shared_libs: ["libutils_test_singleton1"],
Jiyong Park705abe22021-12-14 22:55:34 +0900382 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800383}
Steven Morelandc732c032019-09-03 18:04:50 -0700384
385cc_benchmark {
386 name: "libutils_benchmark",
387 srcs: ["Vector_benchmark.cpp"],
388 shared_libs: ["libutils"],
389}