blob: 162f0f44b73e09972b2cf3c4085dfed92837032a [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,
Zhi Douff9e6402022-12-09 22:30:57 +000024 defaults: [
25 "apex-lowest-min-sdk-version",
26 ],
Jiyong Park8bf9b162020-03-07 16:36:09 +090027 apex_available: [
28 "//apex_available:platform",
29 "//apex_available:anyapex",
30 ],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070031
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090032 header_libs: [
Jiyong Park705abe22021-12-14 22:55:34 +090033 "libbase_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080034 "libcutils_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090035 "liblog_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000036 "libprocessgroup_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090037 "libsystem_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090038 ],
39 export_header_lib_headers: [
Jiyong Park705abe22021-12-14 22:55:34 +090040 "libbase_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080041 "libcutils_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090042 "liblog_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000043 "libprocessgroup_headers",
Jiyong Park8b196a72022-01-12 09:23:29 +090044 "libsystem_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090045 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080046 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070047
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080048 target: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070049 linux_bionic: {
50 enabled: true,
51 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080052 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070053 enabled: true,
54 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080055 },
56}
57
David Sehrabfb9f32018-01-17 17:07:09 -080058cc_defaults {
59 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070060 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090061 product_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090062 recovery_available: true,
Dan Willemsen2e1591b2016-07-12 17:20:18 -070063 host_supported: true,
64
Elliott Hughesdc699a22018-02-16 17:58:14 -080065 cflags: [
66 "-Wall",
67 "-Werror",
Elliott Hughes48a9eb42021-03-04 09:46:23 -080068 "-Wno-exit-time-destructors",
Steven Morelanda06e68c2021-04-27 00:09:23 +000069 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Elliott Hughesdc699a22018-02-16 17:58:14 -080070 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070071 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070072 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070073 "libutils_headers",
74 ],
75 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070076 "libutils_headers",
77 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070078
Steven Moreland1f642412017-06-26 13:52:06 -070079 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070080 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070081 "liblog",
82 ],
Steven Moreland9c832022020-07-07 22:37:07 +000083 sanitize: {
84 misc_undefined: ["integer"],
85 },
Steven Moreland1f642412017-06-26 13:52:06 -070086
Dan Willemsen2e1591b2016-07-12 17:20:18 -070087 target: {
88 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070089 cflags: ["-fvisibility=protected"],
90
91 shared_libs: [
Jiyong Park0b3c24b2017-05-26 17:57:18 +090092 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070093 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070094
95 sanitize: {
96 misc_undefined: ["integer"],
97 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070098 },
99
Jiyong Park011ee122018-05-29 16:41:30 +0900100 recovery: {
101 exclude_shared_libs: ["libvndksupport"],
102 },
103
Dan Willemsenab34b472016-11-29 13:32:55 -0800104 linux_bionic: {
105 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800106 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700107
108 darwin: {
109 cflags: ["-Wno-unused-parameter"],
110 },
111
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700112 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800113 cflags: [
114 // Under MinGW, ctype.h doesn't need multi-byte support
115 "-DMB_CUR_MAX=1",
116 "-Wno-unused-private-field",
117 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700118
119 enabled: true,
120 },
121 },
Anis Assie75dd9a2022-03-08 19:48:19 +0000122 fuzz_config: {
123 cc: ["smoreland@google.com"],
124 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700125}
126
Steven Moreland377adea2022-10-08 05:06:52 +0000127cc_defaults {
128 name: "libutils_impl_defaults",
Zhi Douff9e6402022-12-09 22:30:57 +0000129 defaults: [
130 "libutils_defaults",
131 "apex-lowest-min-sdk-version",
132 ],
dimitry454ba7e2019-05-16 13:48:17 +0200133 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800134
135 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800136 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800137 "FileMap.cpp",
138 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000139 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800140 "NativeHandle.cpp",
141 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800142 "RefBase.cpp",
143 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800144 "StopWatch.cpp",
145 "String8.cpp",
146 "String16.cpp",
147 "StrongPointer.cpp",
148 "SystemClock.cpp",
149 "Threads.cpp",
150 "Timers.cpp",
151 "Tokenizer.cpp",
152 "Unicode.cpp",
153 "VectorImpl.cpp",
154 "misc.cpp",
155 ],
156
157 target: {
158 android: {
159 srcs: [
160 "Trace.cpp",
161 ],
162 },
163 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800164 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800165 srcs: [
166 "Looper.cpp",
167 ],
168 },
169 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800170
171 apex_available: [
172 "//apex_available:anyapex",
173 "//apex_available:platform",
174 ],
Yi Kong6ee028f2021-12-23 15:57:40 +0800175
176 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800177}
178
179cc_library {
Steven Moreland377adea2022-10-08 05:06:52 +0000180 name: "libutils",
181 defaults: ["libutils_impl_defaults"],
182
183 vndk: {
184 enabled: true,
185 support_system_process: true,
186 },
Hsin-Yi Chen3de02bd2022-12-06 17:19:42 +0800187
188 header_abi_checker: {
189 // AFDO affects weak symbols.
190 diff_flags: ["-allow-adding-removing-weak-symbols"],
191 ref_dump_dirs: ["abi-dumps"],
192 },
Steven Moreland377adea2022-10-08 05:06:52 +0000193}
194
195cc_library {
196 name: "libutils_test_compile",
197 defaults: ["libutils_impl_defaults"],
198
199 cflags: [
200 "-DCALLSTACKS=1",
201 "-DDEBUG_POLL_AND_WAKE=1",
202 "-DDEBUG_REFS=1",
203 "-DDEBUG_TOKENIZER=1",
204 ],
205
206 visibility: [":__subpackages__"],
207}
208
209cc_library {
David Sehrabfb9f32018-01-17 17:07:09 -0800210 name: "libutilscallstack",
211 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200212 // TODO(b/153609531): remove when no longer needed.
213 native_bridge_supported: true,
Steven Moreland6c509ca2022-04-11 22:30:07 +0000214 min_sdk_version: "29",
Steven Moreland377adea2022-10-08 05:06:52 +0000215 vndk: {
216 enabled: true,
217 support_system_process: true,
218 },
David Sehrabfb9f32018-01-17 17:07:09 -0800219
220 srcs: [
221 "CallStack.cpp",
222 ],
223
Steven Morelande6132be2019-03-25 20:38:56 -0700224 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700225 "libutils",
Christopher Ferrisab631242022-05-10 16:13:02 -0700226 "libunwindstack",
Steven Morelande6132be2019-03-25 20:38:56 -0700227 ],
228
David Sehrabfb9f32018-01-17 17:07:09 -0800229 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800230 linux: {
231 srcs: [
232 "ProcessCallStack.cpp",
233 ],
234 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700235 darwin: {
236 enabled: false,
237 },
Steven Morelande6132be2019-03-25 20:38:56 -0700238 windows: {
239 enabled: false,
240 },
David Sehrabfb9f32018-01-17 17:07:09 -0800241 },
242}
243
Dylan Katz9d5845b2020-05-11 15:44:01 -0700244cc_defaults {
245 name: "libutils_fuzz_defaults",
246 host_supported: true,
247 shared_libs: [
248 "libutils",
249 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700250 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700251 ],
252}
253
254cc_fuzz {
255 name: "libutils_fuzz_bitset",
256 defaults: ["libutils_fuzz_defaults"],
257 srcs: ["BitSet_fuzz.cpp"],
258}
259
260cc_fuzz {
261 name: "libutils_fuzz_filemap",
262 defaults: ["libutils_fuzz_defaults"],
263 srcs: ["FileMap_fuzz.cpp"],
264}
265
266cc_fuzz {
267 name: "libutils_fuzz_string8",
268 defaults: ["libutils_fuzz_defaults"],
269 srcs: ["String8_fuzz.cpp"],
270}
271
272cc_fuzz {
273 name: "libutils_fuzz_string16",
274 defaults: ["libutils_fuzz_defaults"],
275 srcs: ["String16_fuzz.cpp"],
276}
277
278cc_fuzz {
279 name: "libutils_fuzz_vector",
280 defaults: ["libutils_fuzz_defaults"],
281 srcs: ["Vector_fuzz.cpp"],
282}
283
Dylan Katz7168f272020-07-02 11:51:44 -0700284cc_fuzz {
285 name: "libutils_fuzz_printer",
286 defaults: ["libutils_fuzz_defaults"],
287 srcs: ["Printer_fuzz.cpp"],
288}
289
290cc_fuzz {
291 name: "libutils_fuzz_callstack",
292 defaults: ["libutils_fuzz_defaults"],
293 srcs: ["CallStack_fuzz.cpp"],
294 shared_libs: [
295 "libutilscallstack",
296 ],
297}
298
299cc_fuzz {
300 name: "libutils_fuzz_process_callstack",
301 defaults: ["libutils_fuzz_defaults"],
302 srcs: ["ProcessCallStack_fuzz.cpp"],
303 shared_libs: [
304 "libutilscallstack",
305 ],
306}
307
308cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700309 name: "libutils_fuzz_refbase",
310 defaults: ["libutils_fuzz_defaults"],
311 srcs: ["RefBase_fuzz.cpp"],
312}
313
314cc_fuzz {
315 name: "libutils_fuzz_lrucache",
316 defaults: ["libutils_fuzz_defaults"],
317 srcs: ["LruCache_fuzz.cpp"],
318}
319
320cc_fuzz {
321 name: "libutils_fuzz_looper",
322 defaults: ["libutils_fuzz_defaults"],
323 srcs: ["Looper_fuzz.cpp"],
324}
325
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700326cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800327 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700328 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800329
330 srcs: [
331 "BitSet_test.cpp",
Christopher Ferris15fee822022-09-12 18:00:10 -0700332 "CallStack_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900333 "Errors_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800334 "FileMap_test.cpp",
335 "LruCache_test.cpp",
336 "Mutex_test.cpp",
337 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800338 "Singleton_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700339 "String16_test.cpp",
Jiyong Park705abe22021-12-14 22:55:34 +0900340 "String8_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800341 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700342 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800343 "Unicode_test.cpp",
344 "Vector_test.cpp",
345 ],
346
347 target: {
348 android: {
349 srcs: [
350 "SystemClock_test.cpp",
351 ],
352 shared_libs: [
Elliott Hughes01705e42019-02-07 12:41:37 -0800353 "libbase",
Christopher Ferris15fee822022-09-12 18:00:10 -0700354 "libcutils",
355 "liblog",
356 "liblzma",
357 "libunwindstack",
358 "libutils",
359 "libutilscallstack",
360 "libz",
Elliott Hughes01705e42019-02-07 12:41:37 -0800361 ],
362 },
363 linux: {
364 srcs: [
365 "Looper_test.cpp",
366 "RefBase_test.cpp",
367 ],
368 },
369 host: {
370 static_libs: [
Elliott Hughes01705e42019-02-07 12:41:37 -0800371 "libbase",
Christopher Ferris15fee822022-09-12 18:00:10 -0700372 "liblog",
373 "liblzma",
374 "libunwindstack_no_dex",
375 "libutils",
376 "libutilscallstack",
Elliott Hughes01705e42019-02-07 12:41:37 -0800377 ],
378 },
379 },
380
Yo Chiang5b028ba2020-07-10 19:34:53 +0800381 data_libs: [
382 "libutils_test_singleton1",
383 "libutils_test_singleton2",
384 ],
385
Elliott Hughes01705e42019-02-07 12:41:37 -0800386 cflags: [
387 "-Wall",
388 "-Wextra",
389 "-Werror",
390 "-Wthread-safety",
391 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800392
393 test_suites: ["device-tests"],
394}
395
Elliott Hughes01705e42019-02-07 12:41:37 -0800396cc_test_library {
397 name: "libutils_test_singleton1",
398 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800399 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800400 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800401 cflags: [
402 "-Wall",
403 "-Werror",
404 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900405 header_libs: ["libutils_headers"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700406}
Elliott Hughes01705e42019-02-07 12:41:37 -0800407
408cc_test_library {
409 name: "libutils_test_singleton2",
410 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800411 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800412 srcs: ["Singleton_test2.cpp"],
413 cflags: [
414 "-Wall",
415 "-Werror",
416 ],
417 shared_libs: ["libutils_test_singleton1"],
Jiyong Park705abe22021-12-14 22:55:34 +0900418 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800419}
Steven Morelandc732c032019-09-03 18:04:50 -0700420
421cc_benchmark {
422 name: "libutils_benchmark",
423 srcs: ["Vector_benchmark.cpp"],
424 shared_libs: ["libutils"],
425}