blob: f6636719b59316f09d65b4bf391fb890fbed36d2 [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: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070047 linux_bionic: {
48 enabled: true,
49 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080050 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070051 enabled: true,
52 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080053 },
54}
55
David Sehrabfb9f32018-01-17 17:07:09 -080056cc_defaults {
57 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070058 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090059 product_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090060 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090061 vndk: {
62 enabled: true,
63 support_system_process: true,
64 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070065 host_supported: true,
66
Elliott Hughesdc699a22018-02-16 17:58:14 -080067 cflags: [
68 "-Wall",
69 "-Werror",
Elliott Hughes48a9eb42021-03-04 09:46:23 -080070 "-Wno-exit-time-destructors",
Elliott Hughesdc699a22018-02-16 17:58:14 -080071 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070072 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070073 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070074 "libutils_headers",
75 ],
76 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070077 "libutils_headers",
78 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070079
Steven Moreland1f642412017-06-26 13:52:06 -070080 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070081 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070082 "liblog",
83 ],
Steven Moreland9c832022020-07-07 22:37:07 +000084 sanitize: {
85 misc_undefined: ["integer"],
86 },
Steven Moreland1f642412017-06-26 13:52:06 -070087
Dan Willemsen2e1591b2016-07-12 17:20:18 -070088 target: {
89 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070090 cflags: ["-fvisibility=protected"],
91
92 shared_libs: [
Jiyong Park0b3c24b2017-05-26 17:57:18 +090093 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070094 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070095
96 sanitize: {
97 misc_undefined: ["integer"],
98 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070099 },
100
Jiyong Park011ee122018-05-29 16:41:30 +0900101 recovery: {
102 exclude_shared_libs: ["libvndksupport"],
103 },
104
Dan Willemsenab34b472016-11-29 13:32:55 -0800105 linux_bionic: {
106 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800107 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700108
109 darwin: {
110 cflags: ["-Wno-unused-parameter"],
111 },
112
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700113 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800114 cflags: [
115 // Under MinGW, ctype.h doesn't need multi-byte support
116 "-DMB_CUR_MAX=1",
117 "-Wno-unused-private-field",
118 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700119
120 enabled: true,
121 },
122 },
Anis Assie75dd9a2022-03-08 19:48:19 +0000123 fuzz_config: {
124 cc: ["smoreland@google.com"],
125 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700126}
127
David Sehrabfb9f32018-01-17 17:07:09 -0800128cc_library {
129 name: "libutils",
130 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200131 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800132
133 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800134 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800135 "FileMap.cpp",
136 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000137 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800138 "NativeHandle.cpp",
139 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800140 "RefBase.cpp",
141 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800142 "StopWatch.cpp",
143 "String8.cpp",
144 "String16.cpp",
145 "StrongPointer.cpp",
146 "SystemClock.cpp",
147 "Threads.cpp",
148 "Timers.cpp",
149 "Tokenizer.cpp",
150 "Unicode.cpp",
151 "VectorImpl.cpp",
152 "misc.cpp",
153 ],
154
155 target: {
156 android: {
157 srcs: [
158 "Trace.cpp",
159 ],
160 },
161 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800162 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800163 srcs: [
164 "Looper.cpp",
165 ],
166 },
167 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800168
169 apex_available: [
170 "//apex_available:anyapex",
171 "//apex_available:platform",
172 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900173 min_sdk_version: "apex_inherit",
Yi Kong6ee028f2021-12-23 15:57:40 +0800174
175 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800176}
177
178cc_library {
179 name: "libutilscallstack",
180 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200181 // TODO(b/153609531): remove when no longer needed.
182 native_bridge_supported: true,
Steven Moreland6c509ca2022-04-11 22:30:07 +0000183 min_sdk_version: "29",
David Sehrabfb9f32018-01-17 17:07:09 -0800184
185 srcs: [
186 "CallStack.cpp",
187 ],
188
Steven Morelande6132be2019-03-25 20:38:56 -0700189 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700190 "libutils",
Christopher Ferrisab631242022-05-10 16:13:02 -0700191 "libunwindstack",
Steven Morelande6132be2019-03-25 20:38:56 -0700192 ],
193
David Sehrabfb9f32018-01-17 17:07:09 -0800194 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800195 linux: {
196 srcs: [
197 "ProcessCallStack.cpp",
198 ],
199 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700200 darwin: {
201 enabled: false,
202 },
Steven Morelande6132be2019-03-25 20:38:56 -0700203 windows: {
204 enabled: false,
205 },
David Sehrabfb9f32018-01-17 17:07:09 -0800206 },
207}
208
Dylan Katz9d5845b2020-05-11 15:44:01 -0700209cc_defaults {
210 name: "libutils_fuzz_defaults",
211 host_supported: true,
212 shared_libs: [
213 "libutils",
214 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700215 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700216 ],
217}
218
219cc_fuzz {
220 name: "libutils_fuzz_bitset",
221 defaults: ["libutils_fuzz_defaults"],
222 srcs: ["BitSet_fuzz.cpp"],
223}
224
225cc_fuzz {
226 name: "libutils_fuzz_filemap",
227 defaults: ["libutils_fuzz_defaults"],
228 srcs: ["FileMap_fuzz.cpp"],
229}
230
231cc_fuzz {
232 name: "libutils_fuzz_string8",
233 defaults: ["libutils_fuzz_defaults"],
234 srcs: ["String8_fuzz.cpp"],
235}
236
237cc_fuzz {
238 name: "libutils_fuzz_string16",
239 defaults: ["libutils_fuzz_defaults"],
240 srcs: ["String16_fuzz.cpp"],
241}
242
243cc_fuzz {
244 name: "libutils_fuzz_vector",
245 defaults: ["libutils_fuzz_defaults"],
246 srcs: ["Vector_fuzz.cpp"],
247}
248
Dylan Katz7168f272020-07-02 11:51:44 -0700249cc_fuzz {
250 name: "libutils_fuzz_printer",
251 defaults: ["libutils_fuzz_defaults"],
252 srcs: ["Printer_fuzz.cpp"],
253}
254
255cc_fuzz {
256 name: "libutils_fuzz_callstack",
257 defaults: ["libutils_fuzz_defaults"],
258 srcs: ["CallStack_fuzz.cpp"],
259 shared_libs: [
260 "libutilscallstack",
261 ],
262}
263
264cc_fuzz {
265 name: "libutils_fuzz_process_callstack",
266 defaults: ["libutils_fuzz_defaults"],
267 srcs: ["ProcessCallStack_fuzz.cpp"],
268 shared_libs: [
269 "libutilscallstack",
270 ],
271}
272
273cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700274 name: "libutils_fuzz_refbase",
275 defaults: ["libutils_fuzz_defaults"],
276 srcs: ["RefBase_fuzz.cpp"],
277}
278
279cc_fuzz {
280 name: "libutils_fuzz_lrucache",
281 defaults: ["libutils_fuzz_defaults"],
282 srcs: ["LruCache_fuzz.cpp"],
283}
284
285cc_fuzz {
286 name: "libutils_fuzz_looper",
287 defaults: ["libutils_fuzz_defaults"],
288 srcs: ["Looper_fuzz.cpp"],
289}
290
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700291cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800292 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700293 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800294
295 srcs: [
296 "BitSet_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900297 "Errors_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800298 "FileMap_test.cpp",
299 "LruCache_test.cpp",
300 "Mutex_test.cpp",
301 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800302 "Singleton_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700303 "String16_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900304 "String8_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800305 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700306 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800307 "Unicode_test.cpp",
308 "Vector_test.cpp",
309 ],
310
311 target: {
312 android: {
313 srcs: [
314 "SystemClock_test.cpp",
315 ],
316 shared_libs: [
317 "libz",
318 "liblog",
319 "libcutils",
320 "libutils",
321 "libbase",
322 ],
323 },
324 linux: {
325 srcs: [
326 "Looper_test.cpp",
327 "RefBase_test.cpp",
328 ],
329 },
330 host: {
331 static_libs: [
332 "libutils",
333 "liblog",
334 "libbase",
335 ],
336 },
337 },
338
Yo Chiang5b028ba2020-07-10 19:34:53 +0800339 data_libs: [
340 "libutils_test_singleton1",
341 "libutils_test_singleton2",
342 ],
343
Elliott Hughes01705e42019-02-07 12:41:37 -0800344 cflags: [
345 "-Wall",
346 "-Wextra",
347 "-Werror",
348 "-Wthread-safety",
349 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800350
351 test_suites: ["device-tests"],
352}
353
Elliott Hughes01705e42019-02-07 12:41:37 -0800354cc_test_library {
355 name: "libutils_test_singleton1",
356 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800357 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800358 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800359 cflags: [
360 "-Wall",
361 "-Werror",
362 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900363 header_libs: ["libutils_headers"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700364}
Elliott Hughes01705e42019-02-07 12:41:37 -0800365
366cc_test_library {
367 name: "libutils_test_singleton2",
368 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800369 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800370 srcs: ["Singleton_test2.cpp"],
371 cflags: [
372 "-Wall",
373 "-Werror",
374 ],
375 shared_libs: ["libutils_test_singleton1"],
Jiyong Park705abe22021-12-14 22:55:34 +0900376 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800377}
Steven Morelandc732c032019-09-03 18:04:50 -0700378
379cc_benchmark {
380 name: "libutils_benchmark",
381 srcs: ["Vector_benchmark.cpp"],
382 shared_libs: ["libutils"],
383}