blob: b3ddda3b372d123ab68a1dfa793ea0edbd903bc4 [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
Steven Moreland7a1ca592023-10-07 01:09:39 +0000135 whole_static_libs: ["libutils_binder"],
136
David Sehrabfb9f32018-01-17 17:07:09 -0800137 srcs: [
138 "FileMap.cpp",
139 "JenkinsHash.cpp",
Steven Morelandc2dc7cd2021-05-04 21:27:56 +0000140 "LightRefBase.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800141 "NativeHandle.cpp",
142 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800143 "StopWatch.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800144 "SystemClock.cpp",
145 "Threads.cpp",
146 "Timers.cpp",
147 "Tokenizer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800148 "misc.cpp",
149 ],
150
151 target: {
152 android: {
153 srcs: [
154 "Trace.cpp",
155 ],
156 },
157 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800158 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800159 srcs: [
160 "Looper.cpp",
161 ],
162 },
163 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800164
165 apex_available: [
166 "//apex_available:anyapex",
167 "//apex_available:platform",
168 ],
Yi Kong6ee028f2021-12-23 15:57:40 +0800169
170 afdo: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800171}
172
173cc_library {
Steven Moreland377adea2022-10-08 05:06:52 +0000174 name: "libutils",
175 defaults: ["libutils_impl_defaults"],
176
177 vndk: {
178 enabled: true,
179 support_system_process: true,
180 },
Hsin-Yi Chen3de02bd2022-12-06 17:19:42 +0800181
Hsin-Yi Chene474f212023-09-04 11:16:34 +0800182 target: {
183 product: {
184 header_abi_checker: {
185 // AFDO affects weak symbols.
186 diff_flags: ["-allow-adding-removing-weak-symbols"],
187 ref_dump_dirs: ["abi-dumps"],
188 },
189 },
190 vendor: {
191 header_abi_checker: {
192 // AFDO affects weak symbols.
193 diff_flags: ["-allow-adding-removing-weak-symbols"],
194 ref_dump_dirs: ["abi-dumps"],
195 },
196 },
Hsin-Yi Chen3de02bd2022-12-06 17:19:42 +0800197 },
Steven Moreland377adea2022-10-08 05:06:52 +0000198}
199
200cc_library {
201 name: "libutils_test_compile",
202 defaults: ["libutils_impl_defaults"],
203
204 cflags: [
Steven Moreland377adea2022-10-08 05:06:52 +0000205 "-DDEBUG_POLL_AND_WAKE=1",
206 "-DDEBUG_REFS=1",
207 "-DDEBUG_TOKENIZER=1",
208 ],
209
210 visibility: [":__subpackages__"],
211}
212
213cc_library {
David Sehrabfb9f32018-01-17 17:07:09 -0800214 name: "libutilscallstack",
215 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200216 // TODO(b/153609531): remove when no longer needed.
217 native_bridge_supported: true,
Steven Moreland6c509ca2022-04-11 22:30:07 +0000218 min_sdk_version: "29",
Steven Moreland377adea2022-10-08 05:06:52 +0000219 vndk: {
220 enabled: true,
221 support_system_process: true,
222 },
David Sehrabfb9f32018-01-17 17:07:09 -0800223
224 srcs: [
225 "CallStack.cpp",
226 ],
227
Steven Morelande6132be2019-03-25 20:38:56 -0700228 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700229 "libutils",
Christopher Ferrisab631242022-05-10 16:13:02 -0700230 "libunwindstack",
Steven Morelande6132be2019-03-25 20:38:56 -0700231 ],
232
David Sehrabfb9f32018-01-17 17:07:09 -0800233 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800234 linux: {
235 srcs: [
236 "ProcessCallStack.cpp",
237 ],
238 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700239 darwin: {
240 enabled: false,
241 },
Steven Morelande6132be2019-03-25 20:38:56 -0700242 windows: {
243 enabled: false,
244 },
David Sehrabfb9f32018-01-17 17:07:09 -0800245 },
246}
247
Dylan Katz9d5845b2020-05-11 15:44:01 -0700248cc_defaults {
249 name: "libutils_fuzz_defaults",
250 host_supported: true,
251 shared_libs: [
252 "libutils",
253 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700254 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700255 ],
256}
257
258cc_fuzz {
259 name: "libutils_fuzz_bitset",
260 defaults: ["libutils_fuzz_defaults"],
261 srcs: ["BitSet_fuzz.cpp"],
262}
263
264cc_fuzz {
265 name: "libutils_fuzz_filemap",
266 defaults: ["libutils_fuzz_defaults"],
267 srcs: ["FileMap_fuzz.cpp"],
268}
269
270cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700271 name: "libutils_fuzz_printer",
272 defaults: ["libutils_fuzz_defaults"],
273 srcs: ["Printer_fuzz.cpp"],
274}
275
276cc_fuzz {
277 name: "libutils_fuzz_callstack",
278 defaults: ["libutils_fuzz_defaults"],
279 srcs: ["CallStack_fuzz.cpp"],
280 shared_libs: [
281 "libutilscallstack",
282 ],
283}
284
285cc_fuzz {
286 name: "libutils_fuzz_process_callstack",
287 defaults: ["libutils_fuzz_defaults"],
288 srcs: ["ProcessCallStack_fuzz.cpp"],
289 shared_libs: [
290 "libutilscallstack",
291 ],
292}
293
294cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700295 name: "libutils_fuzz_lrucache",
296 defaults: ["libutils_fuzz_defaults"],
297 srcs: ["LruCache_fuzz.cpp"],
298}
299
300cc_fuzz {
301 name: "libutils_fuzz_looper",
302 defaults: ["libutils_fuzz_defaults"],
303 srcs: ["Looper_fuzz.cpp"],
304}
305
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700306cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800307 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700308 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800309
310 srcs: [
311 "BitSet_test.cpp",
Christopher Ferris15fee822022-09-12 18:00:10 -0700312 "CallStack_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800313 "FileMap_test.cpp",
314 "LruCache_test.cpp",
315 "Mutex_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800316 "Singleton_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700317 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800318 ],
319
320 target: {
321 android: {
322 srcs: [
323 "SystemClock_test.cpp",
324 ],
325 shared_libs: [
Elliott Hughes01705e42019-02-07 12:41:37 -0800326 "libbase",
Christopher Ferris15fee822022-09-12 18:00:10 -0700327 "libcutils",
328 "liblog",
329 "liblzma",
330 "libunwindstack",
331 "libutils",
332 "libutilscallstack",
333 "libz",
Elliott Hughes01705e42019-02-07 12:41:37 -0800334 ],
335 },
336 linux: {
337 srcs: [
338 "Looper_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800339 ],
340 },
341 host: {
342 static_libs: [
Elliott Hughes01705e42019-02-07 12:41:37 -0800343 "libbase",
Christopher Ferris15fee822022-09-12 18:00:10 -0700344 "liblog",
345 "liblzma",
346 "libunwindstack_no_dex",
347 "libutils",
348 "libutilscallstack",
Elliott Hughes01705e42019-02-07 12:41:37 -0800349 ],
350 },
351 },
352
Yo Chiang5b028ba2020-07-10 19:34:53 +0800353 data_libs: [
354 "libutils_test_singleton1",
355 "libutils_test_singleton2",
356 ],
357
Elliott Hughes01705e42019-02-07 12:41:37 -0800358 cflags: [
359 "-Wall",
360 "-Wextra",
361 "-Werror",
362 "-Wthread-safety",
363 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800364
365 test_suites: ["device-tests"],
366}
367
Elliott Hughes01705e42019-02-07 12:41:37 -0800368cc_test_library {
369 name: "libutils_test_singleton1",
370 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800371 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800372 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800373 cflags: [
374 "-Wall",
375 "-Werror",
376 ],
Jiyong Park705abe22021-12-14 22:55:34 +0900377 header_libs: ["libutils_headers"],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700378}
Elliott Hughes01705e42019-02-07 12:41:37 -0800379
380cc_test_library {
381 name: "libutils_test_singleton2",
382 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800383 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800384 srcs: ["Singleton_test2.cpp"],
385 cflags: [
386 "-Wall",
387 "-Werror",
388 ],
389 shared_libs: ["libutils_test_singleton1"],
Jiyong Park705abe22021-12-14 22:55:34 +0900390 header_libs: ["libutils_headers"],
Elliott Hughes01705e42019-02-07 12:41:37 -0800391}