blob: 8ee16f3861147f4814c065bb34cab7ae1791c988 [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,
Jiyong Park612210c2018-04-27 21:48:43 +090018 recovery_available: true,
Yifan Hong55015ff2020-10-27 16:37:06 -070019 vendor_ramdisk_available: true,
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080020 host_supported: true,
dimitry454ba7e2019-05-16 13:48:17 +020021 native_bridge_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +090022 apex_available: [
23 "//apex_available:platform",
24 "//apex_available:anyapex",
25 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +090026 min_sdk_version: "apex_inherit",
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070027
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090028 header_libs: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070029 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090030 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080031 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000032 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090033 ],
34 export_header_lib_headers: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070035 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090036 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080037 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000038 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090039 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080040 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070041
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080042 target: {
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070043 android: {
44 header_libs: ["libbacktrace_headers"],
45 export_header_lib_headers: ["libbacktrace_headers"],
46 },
Christopher Ferris0e691602020-10-14 14:13:58 -070047 linux_glibc: {
48 header_libs: ["libbacktrace_headers"],
49 export_header_lib_headers: ["libbacktrace_headers"],
50 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070051 linux_bionic: {
Christopher Ferris0e691602020-10-14 14:13:58 -070052 header_libs: ["libbacktrace_headers"],
53 export_header_lib_headers: ["libbacktrace_headers"],
Dan Willemsene0cd1e02017-03-15 15:23:36 -070054 enabled: true,
55 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080056 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070057 enabled: true,
58 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080059 },
60}
61
David Sehrabfb9f32018-01-17 17:07:09 -080062cc_defaults {
63 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070064 vendor_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090065 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090066 vndk: {
67 enabled: true,
68 support_system_process: true,
69 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070070 host_supported: true,
71
Elliott Hughesdc699a22018-02-16 17:58:14 -080072 cflags: [
73 "-Wall",
74 "-Werror",
75 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070076 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070077 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070078 "libutils_headers",
79 ],
80 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070081 "libutils_headers",
82 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070083
Steven Moreland1f642412017-06-26 13:52:06 -070084 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070085 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070086 "liblog",
87 ],
Steven Moreland9c832022020-07-07 22:37:07 +000088 sanitize: {
89 misc_undefined: ["integer"],
90 },
Steven Moreland1f642412017-06-26 13:52:06 -070091
Dan Willemsen2e1591b2016-07-12 17:20:18 -070092 target: {
93 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070094 cflags: ["-fvisibility=protected"],
95
96 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +000097 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070098 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +090099 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700100 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -0700101
102 sanitize: {
103 misc_undefined: ["integer"],
104 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700105 },
106
Jiyong Park011ee122018-05-29 16:41:30 +0900107 recovery: {
108 exclude_shared_libs: ["libvndksupport"],
109 },
110
Dan Willemsenab34b472016-11-29 13:32:55 -0800111 linux_bionic: {
112 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800113 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700114
115 darwin: {
116 cflags: ["-Wno-unused-parameter"],
117 },
118
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700119 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800120 cflags: [
121 // Under MinGW, ctype.h doesn't need multi-byte support
122 "-DMB_CUR_MAX=1",
123 "-Wno-unused-private-field",
124 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700125
126 enabled: true,
127 },
128 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700129}
130
David Sehrabfb9f32018-01-17 17:07:09 -0800131cc_library {
132 name: "libutils",
133 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200134 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800135
136 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800137 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800138 "FileMap.cpp",
139 "JenkinsHash.cpp",
140 "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 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900175 min_sdk_version: "apex_inherit",
David Sehrabfb9f32018-01-17 17:07:09 -0800176}
177
178cc_library {
179 name: "libutilscallstack",
180 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200181 // TODO(b/153609531): remove when no longer needed.
182 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800183
184 srcs: [
185 "CallStack.cpp",
186 ],
187
Steven Morelande6132be2019-03-25 20:38:56 -0700188 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700189 "libutils",
190 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700191 ],
192
David Sehrabfb9f32018-01-17 17:07:09 -0800193 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800194 linux: {
195 srcs: [
196 "ProcessCallStack.cpp",
197 ],
198 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700199 darwin: {
200 enabled: false,
201 },
Steven Morelande6132be2019-03-25 20:38:56 -0700202 windows: {
203 enabled: false,
204 },
David Sehrabfb9f32018-01-17 17:07:09 -0800205 },
206}
207
Dylan Katz9d5845b2020-05-11 15:44:01 -0700208cc_defaults {
209 name: "libutils_fuzz_defaults",
210 host_supported: true,
211 shared_libs: [
212 "libutils",
213 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700214 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700215 ],
216}
217
218cc_fuzz {
219 name: "libutils_fuzz_bitset",
220 defaults: ["libutils_fuzz_defaults"],
221 srcs: ["BitSet_fuzz.cpp"],
222}
223
224cc_fuzz {
225 name: "libutils_fuzz_filemap",
226 defaults: ["libutils_fuzz_defaults"],
227 srcs: ["FileMap_fuzz.cpp"],
228}
229
230cc_fuzz {
231 name: "libutils_fuzz_string8",
232 defaults: ["libutils_fuzz_defaults"],
233 srcs: ["String8_fuzz.cpp"],
234}
235
236cc_fuzz {
237 name: "libutils_fuzz_string16",
238 defaults: ["libutils_fuzz_defaults"],
239 srcs: ["String16_fuzz.cpp"],
240}
241
242cc_fuzz {
243 name: "libutils_fuzz_vector",
244 defaults: ["libutils_fuzz_defaults"],
245 srcs: ["Vector_fuzz.cpp"],
246}
247
Dylan Katz7168f272020-07-02 11:51:44 -0700248cc_fuzz {
249 name: "libutils_fuzz_printer",
250 defaults: ["libutils_fuzz_defaults"],
251 srcs: ["Printer_fuzz.cpp"],
252}
253
254cc_fuzz {
255 name: "libutils_fuzz_callstack",
256 defaults: ["libutils_fuzz_defaults"],
257 srcs: ["CallStack_fuzz.cpp"],
258 shared_libs: [
259 "libutilscallstack",
260 ],
261}
262
263cc_fuzz {
264 name: "libutils_fuzz_process_callstack",
265 defaults: ["libutils_fuzz_defaults"],
266 srcs: ["ProcessCallStack_fuzz.cpp"],
267 shared_libs: [
268 "libutilscallstack",
269 ],
270}
271
272cc_fuzz {
273 name: "libutils_fuzz_stopwatch",
274 defaults: ["libutils_fuzz_defaults"],
275 srcs: ["StopWatch_fuzz.cpp"],
276}
277
278cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700279 name: "libutils_fuzz_refbase",
280 defaults: ["libutils_fuzz_defaults"],
281 srcs: ["RefBase_fuzz.cpp"],
282}
283
284cc_fuzz {
285 name: "libutils_fuzz_lrucache",
286 defaults: ["libutils_fuzz_defaults"],
287 srcs: ["LruCache_fuzz.cpp"],
288}
289
290cc_fuzz {
291 name: "libutils_fuzz_looper",
292 defaults: ["libutils_fuzz_defaults"],
293 srcs: ["Looper_fuzz.cpp"],
294}
295
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700296cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800297 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700298 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800299
300 srcs: [
301 "BitSet_test.cpp",
302 "FileMap_test.cpp",
303 "LruCache_test.cpp",
304 "Mutex_test.cpp",
305 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800306 "Singleton_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800307 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700308 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800309 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700310 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800311 "Unicode_test.cpp",
312 "Vector_test.cpp",
313 ],
314
315 target: {
316 android: {
317 srcs: [
318 "SystemClock_test.cpp",
319 ],
320 shared_libs: [
321 "libz",
322 "liblog",
323 "libcutils",
324 "libutils",
325 "libbase",
326 ],
327 },
328 linux: {
329 srcs: [
330 "Looper_test.cpp",
331 "RefBase_test.cpp",
332 ],
333 },
334 host: {
335 static_libs: [
336 "libutils",
337 "liblog",
338 "libbase",
339 ],
340 },
341 },
342
Yo Chiang5b028ba2020-07-10 19:34:53 +0800343 data_libs: [
344 "libutils_test_singleton1",
345 "libutils_test_singleton2",
346 ],
347
Elliott Hughes01705e42019-02-07 12:41:37 -0800348 cflags: [
349 "-Wall",
350 "-Wextra",
351 "-Werror",
352 "-Wthread-safety",
353 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800354
355 test_suites: ["device-tests"],
356}
357
Elliott Hughes01705e42019-02-07 12:41:37 -0800358cc_test_library {
359 name: "libutils_test_singleton1",
360 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800361 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800362 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800363 cflags: [
364 "-Wall",
365 "-Werror",
366 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700367}
Elliott Hughes01705e42019-02-07 12:41:37 -0800368
369cc_test_library {
370 name: "libutils_test_singleton2",
371 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800372 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800373 srcs: ["Singleton_test2.cpp"],
374 cflags: [
375 "-Wall",
376 "-Werror",
377 ],
378 shared_libs: ["libutils_test_singleton1"],
379}
Steven Morelandc732c032019-09-03 18:04:50 -0700380
381cc_benchmark {
382 name: "libutils_benchmark",
383 srcs: ["Vector_benchmark.cpp"],
384 shared_libs: ["libutils"],
385}