blob: a9bd7d9b13b588af091114dbb82b133f4951e420 [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",
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: [
Jiyong Park0b3c24b2017-05-26 17:57:18 +0900101 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700102 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -0700103
104 sanitize: {
105 misc_undefined: ["integer"],
106 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700107 },
108
Jiyong Park011ee122018-05-29 16:41:30 +0900109 recovery: {
110 exclude_shared_libs: ["libvndksupport"],
111 },
112
Dan Willemsenab34b472016-11-29 13:32:55 -0800113 linux_bionic: {
114 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800115 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700116
117 darwin: {
118 cflags: ["-Wno-unused-parameter"],
119 },
120
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700121 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800122 cflags: [
123 // Under MinGW, ctype.h doesn't need multi-byte support
124 "-DMB_CUR_MAX=1",
125 "-Wno-unused-private-field",
126 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700127
128 enabled: true,
129 },
130 },
Anis Assie75dd9a2022-03-08 19:48:19 +0000131 fuzz_config: {
132 cc: ["smoreland@google.com"],
133 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700134}
135
David Sehrabfb9f32018-01-17 17:07:09 -0800136cc_library {
137 name: "libutils",
138 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200139 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800140
141 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800142 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800143 "FileMap.cpp",
144 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000145 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800146 "NativeHandle.cpp",
147 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800148 "RefBase.cpp",
149 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800150 "StopWatch.cpp",
151 "String8.cpp",
152 "String16.cpp",
153 "StrongPointer.cpp",
154 "SystemClock.cpp",
155 "Threads.cpp",
156 "Timers.cpp",
157 "Tokenizer.cpp",
158 "Unicode.cpp",
159 "VectorImpl.cpp",
160 "misc.cpp",
161 ],
162
163 target: {
164 android: {
165 srcs: [
166 "Trace.cpp",
167 ],
168 },
169 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800170 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800171 srcs: [
172 "Looper.cpp",
173 ],
174 },
175 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800176
177 apex_available: [
178 "//apex_available:anyapex",
179 "//apex_available:platform",
180 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900181 min_sdk_version: "apex_inherit",
Yi Kong6ee028f2021-12-23 15:57:40 +0800182
183 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800184}
185
186cc_library {
187 name: "libutilscallstack",
188 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200189 // TODO(b/153609531): remove when no longer needed.
190 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800191
192 srcs: [
193 "CallStack.cpp",
194 ],
195
Steven Morelande6132be2019-03-25 20:38:56 -0700196 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700197 "libutils",
198 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700199 ],
200
David Sehrabfb9f32018-01-17 17:07:09 -0800201 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800202 linux: {
203 srcs: [
204 "ProcessCallStack.cpp",
205 ],
206 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700207 darwin: {
208 enabled: false,
209 },
Steven Morelande6132be2019-03-25 20:38:56 -0700210 windows: {
211 enabled: false,
212 },
David Sehrabfb9f32018-01-17 17:07:09 -0800213 },
214}
215
Dylan Katz9d5845b2020-05-11 15:44:01 -0700216cc_defaults {
217 name: "libutils_fuzz_defaults",
218 host_supported: true,
219 shared_libs: [
220 "libutils",
221 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700222 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700223 ],
224}
225
226cc_fuzz {
227 name: "libutils_fuzz_bitset",
228 defaults: ["libutils_fuzz_defaults"],
229 srcs: ["BitSet_fuzz.cpp"],
230}
231
232cc_fuzz {
233 name: "libutils_fuzz_filemap",
234 defaults: ["libutils_fuzz_defaults"],
235 srcs: ["FileMap_fuzz.cpp"],
236}
237
238cc_fuzz {
239 name: "libutils_fuzz_string8",
240 defaults: ["libutils_fuzz_defaults"],
241 srcs: ["String8_fuzz.cpp"],
242}
243
244cc_fuzz {
245 name: "libutils_fuzz_string16",
246 defaults: ["libutils_fuzz_defaults"],
247 srcs: ["String16_fuzz.cpp"],
248}
249
250cc_fuzz {
251 name: "libutils_fuzz_vector",
252 defaults: ["libutils_fuzz_defaults"],
253 srcs: ["Vector_fuzz.cpp"],
254}
255
Dylan Katz7168f272020-07-02 11:51:44 -0700256cc_fuzz {
257 name: "libutils_fuzz_printer",
258 defaults: ["libutils_fuzz_defaults"],
259 srcs: ["Printer_fuzz.cpp"],
260}
261
262cc_fuzz {
263 name: "libutils_fuzz_callstack",
264 defaults: ["libutils_fuzz_defaults"],
265 srcs: ["CallStack_fuzz.cpp"],
266 shared_libs: [
267 "libutilscallstack",
268 ],
269}
270
271cc_fuzz {
272 name: "libutils_fuzz_process_callstack",
273 defaults: ["libutils_fuzz_defaults"],
274 srcs: ["ProcessCallStack_fuzz.cpp"],
275 shared_libs: [
276 "libutilscallstack",
277 ],
278}
279
280cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700281 name: "libutils_fuzz_refbase",
282 defaults: ["libutils_fuzz_defaults"],
283 srcs: ["RefBase_fuzz.cpp"],
284}
285
286cc_fuzz {
287 name: "libutils_fuzz_lrucache",
288 defaults: ["libutils_fuzz_defaults"],
289 srcs: ["LruCache_fuzz.cpp"],
290}
291
292cc_fuzz {
293 name: "libutils_fuzz_looper",
294 defaults: ["libutils_fuzz_defaults"],
295 srcs: ["Looper_fuzz.cpp"],
296}
297
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700298cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800299 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700300 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800301
302 srcs: [
303 "BitSet_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900304 "Errors_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800305 "FileMap_test.cpp",
306 "LruCache_test.cpp",
307 "Mutex_test.cpp",
308 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800309 "Singleton_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700310 "String16_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900311 "String8_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800312 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700313 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800314 "Unicode_test.cpp",
315 "Vector_test.cpp",
316 ],
317
318 target: {
319 android: {
320 srcs: [
321 "SystemClock_test.cpp",
322 ],
323 shared_libs: [
324 "libz",
325 "liblog",
326 "libcutils",
327 "libutils",
328 "libbase",
329 ],
330 },
331 linux: {
332 srcs: [
333 "Looper_test.cpp",
334 "RefBase_test.cpp",
335 ],
336 },
337 host: {
338 static_libs: [
339 "libutils",
340 "liblog",
341 "libbase",
342 ],
343 },
344 },
345
Yo Chiang5b028ba2020-07-10 19:34:53 +0800346 data_libs: [
347 "libutils_test_singleton1",
348 "libutils_test_singleton2",
349 ],
350
Elliott Hughes01705e42019-02-07 12:41:37 -0800351 cflags: [
352 "-Wall",
353 "-Wextra",
354 "-Werror",
355 "-Wthread-safety",
356 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800357
358 test_suites: ["device-tests"],
359}
360
Elliott Hughes01705e42019-02-07 12:41:37 -0800361cc_test_library {
362 name: "libutils_test_singleton1",
363 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800364 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800365 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800366 cflags: [
367 "-Wall",
368 "-Werror",
369 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900370 header_libs: ["libutils_headers"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700371}
Elliott Hughes01705e42019-02-07 12:41:37 -0800372
373cc_test_library {
374 name: "libutils_test_singleton2",
375 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800376 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800377 srcs: ["Singleton_test2.cpp"],
378 cflags: [
379 "-Wall",
380 "-Werror",
381 ],
382 shared_libs: ["libutils_test_singleton1"],
Jiyong Park705abe22021-12-14 22:55:34 +0900383 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800384}
Steven Morelandc732c032019-09-03 18:04:50 -0700385
386cc_benchmark {
387 name: "libutils_benchmark",
388 srcs: ["Vector_benchmark.cpp"],
389 shared_libs: ["libutils"],
390}