blob: 019a3687a63f83fefd48cc6ded8af979ad2d9c96 [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",
Steven Morelanda06e68c2021-04-27 00:09:23 +000079 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Elliott Hughesdc699a22018-02-16 17:58:14 -080080 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070081 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070082 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070083 "libutils_headers",
84 ],
85 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070086 "libutils_headers",
87 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070088
Steven Moreland1f642412017-06-26 13:52:06 -070089 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070090 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070091 "liblog",
92 ],
Steven Moreland9c832022020-07-07 22:37:07 +000093 sanitize: {
94 misc_undefined: ["integer"],
95 },
Steven Moreland1f642412017-06-26 13:52:06 -070096
Dan Willemsen2e1591b2016-07-12 17:20:18 -070097 target: {
98 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070099 cflags: ["-fvisibility=protected"],
100
101 shared_libs: [
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 },
Anis Assie75dd9a2022-03-08 19:48:19 +0000132 fuzz_config: {
133 cc: ["smoreland@google.com"],
134 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700135}
136
David Sehrabfb9f32018-01-17 17:07:09 -0800137cc_library {
138 name: "libutils",
139 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200140 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800141
142 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800143 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800144 "FileMap.cpp",
145 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000146 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800147 "NativeHandle.cpp",
148 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800149 "RefBase.cpp",
150 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800151 "StopWatch.cpp",
152 "String8.cpp",
153 "String16.cpp",
154 "StrongPointer.cpp",
155 "SystemClock.cpp",
156 "Threads.cpp",
157 "Timers.cpp",
158 "Tokenizer.cpp",
159 "Unicode.cpp",
160 "VectorImpl.cpp",
161 "misc.cpp",
162 ],
163
164 target: {
165 android: {
166 srcs: [
167 "Trace.cpp",
168 ],
169 },
170 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800171 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800172 srcs: [
173 "Looper.cpp",
174 ],
175 },
176 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800177
178 apex_available: [
179 "//apex_available:anyapex",
180 "//apex_available:platform",
181 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900182 min_sdk_version: "apex_inherit",
Yi Kong6ee028f2021-12-23 15:57:40 +0800183
184 afdo: true,
Hsin-Yi Chenc7d93202022-05-26 14:06:36 +0800185
186 header_abi_checker: {
187 diff_flags: ["-allow-adding-removing-weak-symbols"],
188 },
David Sehrabfb9f32018-01-17 17:07:09 -0800189}
190
191cc_library {
192 name: "libutilscallstack",
193 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200194 // TODO(b/153609531): remove when no longer needed.
195 native_bridge_supported: true,
Steven Moreland6c509ca2022-04-11 22:30:07 +0000196 min_sdk_version: "29",
David Sehrabfb9f32018-01-17 17:07:09 -0800197
198 srcs: [
199 "CallStack.cpp",
200 ],
201
Steven Morelande6132be2019-03-25 20:38:56 -0700202 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700203 "libutils",
204 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700205 ],
206
David Sehrabfb9f32018-01-17 17:07:09 -0800207 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800208 linux: {
209 srcs: [
210 "ProcessCallStack.cpp",
211 ],
212 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700213 darwin: {
214 enabled: false,
215 },
Steven Morelande6132be2019-03-25 20:38:56 -0700216 windows: {
217 enabled: false,
218 },
David Sehrabfb9f32018-01-17 17:07:09 -0800219 },
220}
221
Dylan Katz9d5845b2020-05-11 15:44:01 -0700222cc_defaults {
223 name: "libutils_fuzz_defaults",
224 host_supported: true,
225 shared_libs: [
226 "libutils",
227 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700228 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700229 ],
230}
231
232cc_fuzz {
233 name: "libutils_fuzz_bitset",
234 defaults: ["libutils_fuzz_defaults"],
235 srcs: ["BitSet_fuzz.cpp"],
236}
237
238cc_fuzz {
239 name: "libutils_fuzz_filemap",
240 defaults: ["libutils_fuzz_defaults"],
241 srcs: ["FileMap_fuzz.cpp"],
242}
243
244cc_fuzz {
245 name: "libutils_fuzz_string8",
246 defaults: ["libutils_fuzz_defaults"],
247 srcs: ["String8_fuzz.cpp"],
248}
249
250cc_fuzz {
251 name: "libutils_fuzz_string16",
252 defaults: ["libutils_fuzz_defaults"],
253 srcs: ["String16_fuzz.cpp"],
254}
255
256cc_fuzz {
257 name: "libutils_fuzz_vector",
258 defaults: ["libutils_fuzz_defaults"],
259 srcs: ["Vector_fuzz.cpp"],
260}
261
Dylan Katz7168f272020-07-02 11:51:44 -0700262cc_fuzz {
263 name: "libutils_fuzz_printer",
264 defaults: ["libutils_fuzz_defaults"],
265 srcs: ["Printer_fuzz.cpp"],
266}
267
268cc_fuzz {
269 name: "libutils_fuzz_callstack",
270 defaults: ["libutils_fuzz_defaults"],
271 srcs: ["CallStack_fuzz.cpp"],
272 shared_libs: [
273 "libutilscallstack",
274 ],
275}
276
277cc_fuzz {
278 name: "libutils_fuzz_process_callstack",
279 defaults: ["libutils_fuzz_defaults"],
280 srcs: ["ProcessCallStack_fuzz.cpp"],
281 shared_libs: [
282 "libutilscallstack",
283 ],
284}
285
286cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700287 name: "libutils_fuzz_refbase",
288 defaults: ["libutils_fuzz_defaults"],
289 srcs: ["RefBase_fuzz.cpp"],
290}
291
292cc_fuzz {
293 name: "libutils_fuzz_lrucache",
294 defaults: ["libutils_fuzz_defaults"],
295 srcs: ["LruCache_fuzz.cpp"],
296}
297
298cc_fuzz {
299 name: "libutils_fuzz_looper",
300 defaults: ["libutils_fuzz_defaults"],
301 srcs: ["Looper_fuzz.cpp"],
302}
303
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700304cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800305 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700306 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800307
308 srcs: [
309 "BitSet_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900310 "Errors_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800311 "FileMap_test.cpp",
312 "LruCache_test.cpp",
313 "Mutex_test.cpp",
314 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800315 "Singleton_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700316 "String16_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900317 "String8_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800318 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700319 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800320 "Unicode_test.cpp",
321 "Vector_test.cpp",
322 ],
323
324 target: {
325 android: {
326 srcs: [
327 "SystemClock_test.cpp",
328 ],
329 shared_libs: [
330 "libz",
331 "liblog",
332 "libcutils",
333 "libutils",
334 "libbase",
335 ],
336 },
337 linux: {
338 srcs: [
339 "Looper_test.cpp",
340 "RefBase_test.cpp",
341 ],
342 },
343 host: {
344 static_libs: [
345 "libutils",
346 "liblog",
347 "libbase",
348 ],
349 },
350 },
351
Yo Chiang5b028ba2020-07-10 19:34:53 +0800352 data_libs: [
353 "libutils_test_singleton1",
354 "libutils_test_singleton2",
355 ],
356
Elliott Hughes01705e42019-02-07 12:41:37 -0800357 cflags: [
358 "-Wall",
359 "-Wextra",
360 "-Werror",
361 "-Wthread-safety",
362 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800363
364 test_suites: ["device-tests"],
365}
366
Elliott Hughes01705e42019-02-07 12:41:37 -0800367cc_test_library {
368 name: "libutils_test_singleton1",
369 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800370 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800371 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800372 cflags: [
373 "-Wall",
374 "-Werror",
375 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900376 header_libs: ["libutils_headers"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700377}
Elliott Hughes01705e42019-02-07 12:41:37 -0800378
379cc_test_library {
380 name: "libutils_test_singleton2",
381 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800382 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800383 srcs: ["Singleton_test2.cpp"],
384 cflags: [
385 "-Wall",
386 "-Werror",
387 ],
388 shared_libs: ["libutils_test_singleton1"],
Jiyong Park705abe22021-12-14 22:55:34 +0900389 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800390}
Steven Morelandc732c032019-09-03 18:04:50 -0700391
392cc_benchmark {
393 name: "libutils_benchmark",
394 srcs: ["Vector_benchmark.cpp"],
395 shared_libs: ["libutils"],
396}