blob: c9ecfa9beb13409dda93ac9764af49a1c2ca9bab [file] [log] [blame]
Dan Willemsen2e1591b2016-07-12 17:20:18 -07001// Copyright (C) 2008 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Bob Badourd69ad692021-02-16 19:02:14 -080015package {
16 default_applicable_licenses: ["system_core_libutils_license"],
17}
18
19// Added automatically by a large-scale-change
20// See: http://go/android-license-faq
21license {
22 name: "system_core_libutils_license",
23 visibility: [":__subpackages__"],
24 license_kinds: [
25 "SPDX-license-identifier-Apache-2.0",
26 ],
27 license_text: [
28 "NOTICE",
29 ],
30}
31
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080032cc_library_headers {
33 name: "libutils_headers",
Steven Moreland91527ed2017-04-11 12:43:16 -070034 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090035 product_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090036 recovery_available: true,
Yifan Hong55015ff2020-10-27 16:37:06 -070037 vendor_ramdisk_available: true,
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080038 host_supported: true,
dimitry454ba7e2019-05-16 13:48:17 +020039 native_bridge_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +090040 apex_available: [
41 "//apex_available:platform",
42 "//apex_available:anyapex",
43 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +090044 min_sdk_version: "apex_inherit",
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070045
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090046 header_libs: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070047 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090048 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080049 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000050 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090051 ],
52 export_header_lib_headers: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070053 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090054 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080055 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000056 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090057 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080058 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070059
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080060 target: {
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070061 android: {
62 header_libs: ["libbacktrace_headers"],
63 export_header_lib_headers: ["libbacktrace_headers"],
64 },
Christopher Ferris0e691602020-10-14 14:13:58 -070065 linux_glibc: {
66 header_libs: ["libbacktrace_headers"],
67 export_header_lib_headers: ["libbacktrace_headers"],
68 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070069 linux_bionic: {
Christopher Ferris0e691602020-10-14 14:13:58 -070070 header_libs: ["libbacktrace_headers"],
71 export_header_lib_headers: ["libbacktrace_headers"],
Dan Willemsene0cd1e02017-03-15 15:23:36 -070072 enabled: true,
73 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080074 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070075 enabled: true,
76 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080077 },
78}
79
David Sehrabfb9f32018-01-17 17:07:09 -080080cc_defaults {
81 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070082 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090083 product_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090084 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090085 vndk: {
86 enabled: true,
87 support_system_process: true,
88 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070089 host_supported: true,
90
Elliott Hughesdc699a22018-02-16 17:58:14 -080091 cflags: [
92 "-Wall",
93 "-Werror",
94 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070095 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070096 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070097 "libutils_headers",
98 ],
99 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -0700100 "libutils_headers",
101 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700102
Steven Moreland1f642412017-06-26 13:52:06 -0700103 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -0700104 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -0700105 "liblog",
106 ],
Steven Moreland9c832022020-07-07 22:37:07 +0000107 sanitize: {
108 misc_undefined: ["integer"],
109 },
Steven Moreland1f642412017-06-26 13:52:06 -0700110
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700111 target: {
112 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700113 cflags: ["-fvisibility=protected"],
114
115 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +0000116 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700117 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +0900118 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700119 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -0700120
121 sanitize: {
122 misc_undefined: ["integer"],
123 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700124 },
125
Jiyong Park011ee122018-05-29 16:41:30 +0900126 recovery: {
127 exclude_shared_libs: ["libvndksupport"],
128 },
129
Dan Willemsenab34b472016-11-29 13:32:55 -0800130 linux_bionic: {
131 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800132 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700133
134 darwin: {
135 cflags: ["-Wno-unused-parameter"],
136 },
137
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700138 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800139 cflags: [
140 // Under MinGW, ctype.h doesn't need multi-byte support
141 "-DMB_CUR_MAX=1",
142 "-Wno-unused-private-field",
143 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700144
145 enabled: true,
146 },
147 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700148}
149
David Sehrabfb9f32018-01-17 17:07:09 -0800150cc_library {
151 name: "libutils",
152 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200153 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800154
155 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800156 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800157 "FileMap.cpp",
158 "JenkinsHash.cpp",
159 "NativeHandle.cpp",
160 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800161 "RefBase.cpp",
162 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800163 "StopWatch.cpp",
164 "String8.cpp",
165 "String16.cpp",
166 "StrongPointer.cpp",
167 "SystemClock.cpp",
168 "Threads.cpp",
169 "Timers.cpp",
170 "Tokenizer.cpp",
171 "Unicode.cpp",
172 "VectorImpl.cpp",
173 "misc.cpp",
174 ],
175
176 target: {
177 android: {
178 srcs: [
179 "Trace.cpp",
180 ],
181 },
182 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800183 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800184 srcs: [
185 "Looper.cpp",
186 ],
187 },
188 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800189
190 apex_available: [
191 "//apex_available:anyapex",
192 "//apex_available:platform",
193 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900194 min_sdk_version: "apex_inherit",
David Sehrabfb9f32018-01-17 17:07:09 -0800195}
196
197cc_library {
198 name: "libutilscallstack",
199 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200200 // TODO(b/153609531): remove when no longer needed.
201 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800202
203 srcs: [
204 "CallStack.cpp",
205 ],
206
Steven Morelande6132be2019-03-25 20:38:56 -0700207 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700208 "libutils",
209 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700210 ],
211
David Sehrabfb9f32018-01-17 17:07:09 -0800212 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800213 linux: {
214 srcs: [
215 "ProcessCallStack.cpp",
216 ],
217 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700218 darwin: {
219 enabled: false,
220 },
Steven Morelande6132be2019-03-25 20:38:56 -0700221 windows: {
222 enabled: false,
223 },
David Sehrabfb9f32018-01-17 17:07:09 -0800224 },
225}
226
Dylan Katz9d5845b2020-05-11 15:44:01 -0700227cc_defaults {
228 name: "libutils_fuzz_defaults",
229 host_supported: true,
230 shared_libs: [
231 "libutils",
232 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700233 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700234 ],
235}
236
237cc_fuzz {
238 name: "libutils_fuzz_bitset",
239 defaults: ["libutils_fuzz_defaults"],
240 srcs: ["BitSet_fuzz.cpp"],
241}
242
243cc_fuzz {
244 name: "libutils_fuzz_filemap",
245 defaults: ["libutils_fuzz_defaults"],
246 srcs: ["FileMap_fuzz.cpp"],
247}
248
249cc_fuzz {
250 name: "libutils_fuzz_string8",
251 defaults: ["libutils_fuzz_defaults"],
252 srcs: ["String8_fuzz.cpp"],
253}
254
255cc_fuzz {
256 name: "libutils_fuzz_string16",
257 defaults: ["libutils_fuzz_defaults"],
258 srcs: ["String16_fuzz.cpp"],
259}
260
261cc_fuzz {
262 name: "libutils_fuzz_vector",
263 defaults: ["libutils_fuzz_defaults"],
264 srcs: ["Vector_fuzz.cpp"],
265}
266
Dylan Katz7168f272020-07-02 11:51:44 -0700267cc_fuzz {
268 name: "libutils_fuzz_printer",
269 defaults: ["libutils_fuzz_defaults"],
270 srcs: ["Printer_fuzz.cpp"],
271}
272
273cc_fuzz {
274 name: "libutils_fuzz_callstack",
275 defaults: ["libutils_fuzz_defaults"],
276 srcs: ["CallStack_fuzz.cpp"],
277 shared_libs: [
278 "libutilscallstack",
279 ],
280}
281
282cc_fuzz {
283 name: "libutils_fuzz_process_callstack",
284 defaults: ["libutils_fuzz_defaults"],
285 srcs: ["ProcessCallStack_fuzz.cpp"],
286 shared_libs: [
287 "libutilscallstack",
288 ],
289}
290
291cc_fuzz {
292 name: "libutils_fuzz_stopwatch",
293 defaults: ["libutils_fuzz_defaults"],
294 srcs: ["StopWatch_fuzz.cpp"],
295}
296
297cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700298 name: "libutils_fuzz_refbase",
299 defaults: ["libutils_fuzz_defaults"],
300 srcs: ["RefBase_fuzz.cpp"],
301}
302
303cc_fuzz {
304 name: "libutils_fuzz_lrucache",
305 defaults: ["libutils_fuzz_defaults"],
306 srcs: ["LruCache_fuzz.cpp"],
307}
308
309cc_fuzz {
310 name: "libutils_fuzz_looper",
311 defaults: ["libutils_fuzz_defaults"],
312 srcs: ["Looper_fuzz.cpp"],
313}
314
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700315cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800316 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700317 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800318
319 srcs: [
320 "BitSet_test.cpp",
321 "FileMap_test.cpp",
322 "LruCache_test.cpp",
323 "Mutex_test.cpp",
324 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800325 "Singleton_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800326 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700327 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800328 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700329 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800330 "Unicode_test.cpp",
331 "Vector_test.cpp",
332 ],
333
334 target: {
335 android: {
336 srcs: [
337 "SystemClock_test.cpp",
338 ],
339 shared_libs: [
340 "libz",
341 "liblog",
342 "libcutils",
343 "libutils",
344 "libbase",
345 ],
346 },
347 linux: {
348 srcs: [
349 "Looper_test.cpp",
350 "RefBase_test.cpp",
351 ],
352 },
353 host: {
354 static_libs: [
355 "libutils",
356 "liblog",
357 "libbase",
358 ],
359 },
360 },
361
Yo Chiang5b028ba2020-07-10 19:34:53 +0800362 data_libs: [
363 "libutils_test_singleton1",
364 "libutils_test_singleton2",
365 ],
366
Elliott Hughes01705e42019-02-07 12:41:37 -0800367 cflags: [
368 "-Wall",
369 "-Wextra",
370 "-Werror",
371 "-Wthread-safety",
372 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800373
374 test_suites: ["device-tests"],
375}
376
Elliott Hughes01705e42019-02-07 12:41:37 -0800377cc_test_library {
378 name: "libutils_test_singleton1",
379 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800380 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800381 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800382 cflags: [
383 "-Wall",
384 "-Werror",
385 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700386}
Elliott Hughes01705e42019-02-07 12:41:37 -0800387
388cc_test_library {
389 name: "libutils_test_singleton2",
390 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800391 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800392 srcs: ["Singleton_test2.cpp"],
393 cflags: [
394 "-Wall",
395 "-Werror",
396 ],
397 shared_libs: ["libutils_test_singleton1"],
398}
Steven Morelandc732c032019-09-03 18:04:50 -0700399
400cc_benchmark {
401 name: "libutils_benchmark",
402 srcs: ["Vector_benchmark.cpp"],
403 shared_libs: ["libutils"],
404}