blob: 1e7cbdb77ee9838973bb270fcab655f50b595e5c [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
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080015cc_library_headers {
16 name: "libutils_headers",
Steven Moreland91527ed2017-04-11 12:43:16 -070017 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090018 product_available: true,
Jiyong Park612210c2018-04-27 21:48:43 +090019 recovery_available: true,
Yifan Hong55015ff2020-10-27 16:37:06 -070020 vendor_ramdisk_available: true,
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080021 host_supported: true,
dimitry454ba7e2019-05-16 13:48:17 +020022 native_bridge_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +090023 apex_available: [
24 "//apex_available:platform",
25 "//apex_available:anyapex",
26 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +090027 min_sdk_version: "apex_inherit",
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070028
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090029 header_libs: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070030 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090031 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080032 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000033 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090034 ],
35 export_header_lib_headers: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070036 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090037 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080038 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000039 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090040 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080041 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070042
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080043 target: {
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070044 android: {
45 header_libs: ["libbacktrace_headers"],
46 export_header_lib_headers: ["libbacktrace_headers"],
47 },
Christopher Ferris0e691602020-10-14 14:13:58 -070048 linux_glibc: {
49 header_libs: ["libbacktrace_headers"],
50 export_header_lib_headers: ["libbacktrace_headers"],
51 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070052 linux_bionic: {
Christopher Ferris0e691602020-10-14 14:13:58 -070053 header_libs: ["libbacktrace_headers"],
54 export_header_lib_headers: ["libbacktrace_headers"],
Dan Willemsene0cd1e02017-03-15 15:23:36 -070055 enabled: true,
56 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080057 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070058 enabled: true,
59 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080060 },
61}
62
David Sehrabfb9f32018-01-17 17:07:09 -080063cc_defaults {
64 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070065 vendor_available: true,
Justin Yunfeef4d32020-11-11 19:17:40 +090066 product_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090067 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090068 vndk: {
69 enabled: true,
70 support_system_process: true,
71 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070072 host_supported: true,
73
Elliott Hughesdc699a22018-02-16 17:58:14 -080074 cflags: [
75 "-Wall",
76 "-Werror",
77 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070078 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070079 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070080 "libutils_headers",
81 ],
82 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070083 "libutils_headers",
84 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070085
Steven Moreland1f642412017-06-26 13:52:06 -070086 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070087 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070088 "liblog",
89 ],
Steven Moreland9c832022020-07-07 22:37:07 +000090 sanitize: {
91 misc_undefined: ["integer"],
92 },
Steven Moreland1f642412017-06-26 13:52:06 -070093
Dan Willemsen2e1591b2016-07-12 17:20:18 -070094 target: {
95 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070096 cflags: ["-fvisibility=protected"],
97
98 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +000099 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700100 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +0900101 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700102 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -0700103
104 sanitize: {
105 misc_undefined: ["integer"],
106 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700107 },
108
Jiyong Park011ee122018-05-29 16:41:30 +0900109 recovery: {
110 exclude_shared_libs: ["libvndksupport"],
111 },
112
Dan Willemsenab34b472016-11-29 13:32:55 -0800113 linux_bionic: {
114 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800115 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700116
117 darwin: {
118 cflags: ["-Wno-unused-parameter"],
119 },
120
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700121 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800122 cflags: [
123 // Under MinGW, ctype.h doesn't need multi-byte support
124 "-DMB_CUR_MAX=1",
125 "-Wno-unused-private-field",
126 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700127
128 enabled: true,
129 },
130 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700131}
132
David Sehrabfb9f32018-01-17 17:07:09 -0800133cc_library {
134 name: "libutils",
135 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200136 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800137
138 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800139 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800140 "FileMap.cpp",
141 "JenkinsHash.cpp",
142 "NativeHandle.cpp",
143 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800144 "RefBase.cpp",
145 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800146 "StopWatch.cpp",
147 "String8.cpp",
148 "String16.cpp",
149 "StrongPointer.cpp",
150 "SystemClock.cpp",
151 "Threads.cpp",
152 "Timers.cpp",
153 "Tokenizer.cpp",
154 "Unicode.cpp",
155 "VectorImpl.cpp",
156 "misc.cpp",
157 ],
158
159 target: {
160 android: {
161 srcs: [
162 "Trace.cpp",
163 ],
164 },
165 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800166 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800167 srcs: [
168 "Looper.cpp",
169 ],
170 },
171 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800172
173 apex_available: [
174 "//apex_available:anyapex",
175 "//apex_available:platform",
176 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900177 min_sdk_version: "apex_inherit",
David Sehrabfb9f32018-01-17 17:07:09 -0800178}
179
180cc_library {
181 name: "libutilscallstack",
182 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200183 // TODO(b/153609531): remove when no longer needed.
184 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800185
186 srcs: [
187 "CallStack.cpp",
188 ],
189
Steven Morelande6132be2019-03-25 20:38:56 -0700190 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700191 "libutils",
192 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700193 ],
194
David Sehrabfb9f32018-01-17 17:07:09 -0800195 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800196 linux: {
197 srcs: [
198 "ProcessCallStack.cpp",
199 ],
200 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700201 darwin: {
202 enabled: false,
203 },
Steven Morelande6132be2019-03-25 20:38:56 -0700204 windows: {
205 enabled: false,
206 },
David Sehrabfb9f32018-01-17 17:07:09 -0800207 },
208}
209
Dylan Katz9d5845b2020-05-11 15:44:01 -0700210cc_defaults {
211 name: "libutils_fuzz_defaults",
212 host_supported: true,
213 shared_libs: [
214 "libutils",
215 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700216 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700217 ],
218}
219
220cc_fuzz {
221 name: "libutils_fuzz_bitset",
222 defaults: ["libutils_fuzz_defaults"],
223 srcs: ["BitSet_fuzz.cpp"],
224}
225
226cc_fuzz {
227 name: "libutils_fuzz_filemap",
228 defaults: ["libutils_fuzz_defaults"],
229 srcs: ["FileMap_fuzz.cpp"],
230}
231
232cc_fuzz {
233 name: "libutils_fuzz_string8",
234 defaults: ["libutils_fuzz_defaults"],
235 srcs: ["String8_fuzz.cpp"],
236}
237
238cc_fuzz {
239 name: "libutils_fuzz_string16",
240 defaults: ["libutils_fuzz_defaults"],
241 srcs: ["String16_fuzz.cpp"],
242}
243
244cc_fuzz {
245 name: "libutils_fuzz_vector",
246 defaults: ["libutils_fuzz_defaults"],
247 srcs: ["Vector_fuzz.cpp"],
248}
249
Dylan Katz7168f272020-07-02 11:51:44 -0700250cc_fuzz {
251 name: "libutils_fuzz_printer",
252 defaults: ["libutils_fuzz_defaults"],
253 srcs: ["Printer_fuzz.cpp"],
254}
255
256cc_fuzz {
257 name: "libutils_fuzz_callstack",
258 defaults: ["libutils_fuzz_defaults"],
259 srcs: ["CallStack_fuzz.cpp"],
260 shared_libs: [
261 "libutilscallstack",
262 ],
263}
264
265cc_fuzz {
266 name: "libutils_fuzz_process_callstack",
267 defaults: ["libutils_fuzz_defaults"],
268 srcs: ["ProcessCallStack_fuzz.cpp"],
269 shared_libs: [
270 "libutilscallstack",
271 ],
272}
273
274cc_fuzz {
275 name: "libutils_fuzz_stopwatch",
276 defaults: ["libutils_fuzz_defaults"],
277 srcs: ["StopWatch_fuzz.cpp"],
278}
279
280cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700281 name: "libutils_fuzz_refbase",
282 defaults: ["libutils_fuzz_defaults"],
283 srcs: ["RefBase_fuzz.cpp"],
284}
285
286cc_fuzz {
287 name: "libutils_fuzz_lrucache",
288 defaults: ["libutils_fuzz_defaults"],
289 srcs: ["LruCache_fuzz.cpp"],
290}
291
292cc_fuzz {
293 name: "libutils_fuzz_looper",
294 defaults: ["libutils_fuzz_defaults"],
295 srcs: ["Looper_fuzz.cpp"],
296}
297
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700298cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800299 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700300 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800301
302 srcs: [
303 "BitSet_test.cpp",
304 "FileMap_test.cpp",
305 "LruCache_test.cpp",
306 "Mutex_test.cpp",
307 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800308 "Singleton_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800309 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700310 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800311 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700312 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800313 "Unicode_test.cpp",
314 "Vector_test.cpp",
315 ],
316
317 target: {
318 android: {
319 srcs: [
320 "SystemClock_test.cpp",
321 ],
322 shared_libs: [
323 "libz",
324 "liblog",
325 "libcutils",
326 "libutils",
327 "libbase",
328 ],
329 },
330 linux: {
331 srcs: [
332 "Looper_test.cpp",
333 "RefBase_test.cpp",
334 ],
335 },
336 host: {
337 static_libs: [
338 "libutils",
339 "liblog",
340 "libbase",
341 ],
342 },
343 },
344
Yo Chiang5b028ba2020-07-10 19:34:53 +0800345 data_libs: [
346 "libutils_test_singleton1",
347 "libutils_test_singleton2",
348 ],
349
Elliott Hughes01705e42019-02-07 12:41:37 -0800350 cflags: [
351 "-Wall",
352 "-Wextra",
353 "-Werror",
354 "-Wthread-safety",
355 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800356
357 test_suites: ["device-tests"],
358}
359
Elliott Hughes01705e42019-02-07 12:41:37 -0800360cc_test_library {
361 name: "libutils_test_singleton1",
362 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800363 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800364 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800365 cflags: [
366 "-Wall",
367 "-Werror",
368 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700369}
Elliott Hughes01705e42019-02-07 12:41:37 -0800370
371cc_test_library {
372 name: "libutils_test_singleton2",
373 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800374 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800375 srcs: ["Singleton_test2.cpp"],
376 cflags: [
377 "-Wall",
378 "-Werror",
379 ],
380 shared_libs: ["libutils_test_singleton1"],
381}
Steven Morelandc732c032019-09-03 18:04:50 -0700382
383cc_benchmark {
384 name: "libutils_benchmark",
385 srcs: ["Vector_benchmark.cpp"],
386 shared_libs: ["libutils"],
387}