blob: e53e89bd53cf043701deaa95d35c849b458bd600 [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,
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080019 host_supported: true,
dimitry454ba7e2019-05-16 13:48:17 +020020 native_bridge_supported: true,
Jiyong Park8bf9b162020-03-07 16:36:09 +090021 apex_available: [
22 "//apex_available:platform",
23 "//apex_available:anyapex",
24 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +090025 min_sdk_version: "apex_inherit",
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070026
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090027 header_libs: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070028 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090029 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080030 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000031 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090032 ],
33 export_header_lib_headers: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070034 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090035 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080036 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000037 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090038 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080039 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070040
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080041 target: {
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070042 android: {
43 header_libs: ["libbacktrace_headers"],
44 export_header_lib_headers: ["libbacktrace_headers"],
45 },
Christopher Ferris0e691602020-10-14 14:13:58 -070046 linux_glibc: {
47 header_libs: ["libbacktrace_headers"],
48 export_header_lib_headers: ["libbacktrace_headers"],
49 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070050 linux_bionic: {
Christopher Ferris0e691602020-10-14 14:13:58 -070051 header_libs: ["libbacktrace_headers"],
52 export_header_lib_headers: ["libbacktrace_headers"],
Dan Willemsene0cd1e02017-03-15 15:23:36 -070053 enabled: true,
54 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080055 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070056 enabled: true,
57 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080058 },
59}
60
David Sehrabfb9f32018-01-17 17:07:09 -080061cc_defaults {
62 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070063 vendor_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090064 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090065 vndk: {
66 enabled: true,
67 support_system_process: true,
68 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070069 host_supported: true,
70
Elliott Hughesdc699a22018-02-16 17:58:14 -080071 cflags: [
72 "-Wall",
73 "-Werror",
74 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070075 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070076 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070077 "libutils_headers",
78 ],
79 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070080 "libutils_headers",
81 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070082
Steven Moreland1f642412017-06-26 13:52:06 -070083 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070084 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070085 "liblog",
86 ],
Steven Moreland9c832022020-07-07 22:37:07 +000087 sanitize: {
88 misc_undefined: ["integer"],
89 },
Steven Moreland1f642412017-06-26 13:52:06 -070090
Dan Willemsen2e1591b2016-07-12 17:20:18 -070091 target: {
92 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070093 cflags: ["-fvisibility=protected"],
94
95 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +000096 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070097 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +090098 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070099 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -0700100
101 sanitize: {
102 misc_undefined: ["integer"],
103 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700104 },
105
Jiyong Park011ee122018-05-29 16:41:30 +0900106 recovery: {
107 exclude_shared_libs: ["libvndksupport"],
108 },
109
Dan Willemsenab34b472016-11-29 13:32:55 -0800110 linux_bionic: {
111 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800112 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700113
114 darwin: {
115 cflags: ["-Wno-unused-parameter"],
116 },
117
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700118 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800119 cflags: [
120 // Under MinGW, ctype.h doesn't need multi-byte support
121 "-DMB_CUR_MAX=1",
122 "-Wno-unused-private-field",
123 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700124
125 enabled: true,
126 },
127 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700128}
129
David Sehrabfb9f32018-01-17 17:07:09 -0800130cc_library {
131 name: "libutils",
132 defaults: ["libutils_defaults"],
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",
139 "NativeHandle.cpp",
140 "Printer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800141 "RefBase.cpp",
142 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800143 "StopWatch.cpp",
144 "String8.cpp",
145 "String16.cpp",
146 "StrongPointer.cpp",
147 "SystemClock.cpp",
148 "Threads.cpp",
149 "Timers.cpp",
150 "Tokenizer.cpp",
151 "Unicode.cpp",
152 "VectorImpl.cpp",
153 "misc.cpp",
154 ],
155
156 target: {
157 android: {
158 srcs: [
159 "Trace.cpp",
160 ],
161 },
162 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800163 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800164 srcs: [
165 "Looper.cpp",
166 ],
167 },
168 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800169
170 apex_available: [
171 "//apex_available:anyapex",
172 "//apex_available:platform",
173 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900174 min_sdk_version: "apex_inherit",
David Sehrabfb9f32018-01-17 17:07:09 -0800175}
176
177cc_library {
178 name: "libutilscallstack",
179 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200180 // TODO(b/153609531): remove when no longer needed.
181 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800182
183 srcs: [
184 "CallStack.cpp",
185 ],
186
Steven Morelande6132be2019-03-25 20:38:56 -0700187 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700188 "libutils",
189 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700190 ],
191
David Sehrabfb9f32018-01-17 17:07:09 -0800192 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800193 linux: {
194 srcs: [
195 "ProcessCallStack.cpp",
196 ],
197 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700198 darwin: {
199 enabled: false,
200 },
Steven Morelande6132be2019-03-25 20:38:56 -0700201 windows: {
202 enabled: false,
203 },
David Sehrabfb9f32018-01-17 17:07:09 -0800204 },
205}
206
Dylan Katz9d5845b2020-05-11 15:44:01 -0700207cc_defaults {
208 name: "libutils_fuzz_defaults",
209 host_supported: true,
210 shared_libs: [
211 "libutils",
212 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700213 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700214 ],
215}
216
217cc_fuzz {
218 name: "libutils_fuzz_bitset",
219 defaults: ["libutils_fuzz_defaults"],
220 srcs: ["BitSet_fuzz.cpp"],
221}
222
223cc_fuzz {
224 name: "libutils_fuzz_filemap",
225 defaults: ["libutils_fuzz_defaults"],
226 srcs: ["FileMap_fuzz.cpp"],
227}
228
229cc_fuzz {
230 name: "libutils_fuzz_string8",
231 defaults: ["libutils_fuzz_defaults"],
232 srcs: ["String8_fuzz.cpp"],
233}
234
235cc_fuzz {
236 name: "libutils_fuzz_string16",
237 defaults: ["libutils_fuzz_defaults"],
238 srcs: ["String16_fuzz.cpp"],
239}
240
241cc_fuzz {
242 name: "libutils_fuzz_vector",
243 defaults: ["libutils_fuzz_defaults"],
244 srcs: ["Vector_fuzz.cpp"],
245}
246
Dylan Katz7168f272020-07-02 11:51:44 -0700247cc_fuzz {
248 name: "libutils_fuzz_printer",
249 defaults: ["libutils_fuzz_defaults"],
250 srcs: ["Printer_fuzz.cpp"],
251}
252
253cc_fuzz {
254 name: "libutils_fuzz_callstack",
255 defaults: ["libutils_fuzz_defaults"],
256 srcs: ["CallStack_fuzz.cpp"],
257 shared_libs: [
258 "libutilscallstack",
259 ],
260}
261
262cc_fuzz {
263 name: "libutils_fuzz_process_callstack",
264 defaults: ["libutils_fuzz_defaults"],
265 srcs: ["ProcessCallStack_fuzz.cpp"],
266 shared_libs: [
267 "libutilscallstack",
268 ],
269}
270
271cc_fuzz {
272 name: "libutils_fuzz_stopwatch",
273 defaults: ["libutils_fuzz_defaults"],
274 srcs: ["StopWatch_fuzz.cpp"],
275}
276
277cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700278 name: "libutils_fuzz_refbase",
279 defaults: ["libutils_fuzz_defaults"],
280 srcs: ["RefBase_fuzz.cpp"],
281}
282
283cc_fuzz {
284 name: "libutils_fuzz_lrucache",
285 defaults: ["libutils_fuzz_defaults"],
286 srcs: ["LruCache_fuzz.cpp"],
287}
288
289cc_fuzz {
290 name: "libutils_fuzz_looper",
291 defaults: ["libutils_fuzz_defaults"],
292 srcs: ["Looper_fuzz.cpp"],
293}
294
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700295cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800296 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700297 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800298
299 srcs: [
300 "BitSet_test.cpp",
301 "FileMap_test.cpp",
302 "LruCache_test.cpp",
303 "Mutex_test.cpp",
304 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800305 "Singleton_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800306 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700307 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800308 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700309 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800310 "Unicode_test.cpp",
311 "Vector_test.cpp",
312 ],
313
314 target: {
315 android: {
316 srcs: [
317 "SystemClock_test.cpp",
318 ],
319 shared_libs: [
320 "libz",
321 "liblog",
322 "libcutils",
323 "libutils",
324 "libbase",
325 ],
326 },
327 linux: {
328 srcs: [
329 "Looper_test.cpp",
330 "RefBase_test.cpp",
331 ],
332 },
333 host: {
334 static_libs: [
335 "libutils",
336 "liblog",
337 "libbase",
338 ],
339 },
340 },
341
Yo Chiang5b028ba2020-07-10 19:34:53 +0800342 data_libs: [
343 "libutils_test_singleton1",
344 "libutils_test_singleton2",
345 ],
346
Elliott Hughes01705e42019-02-07 12:41:37 -0800347 cflags: [
348 "-Wall",
349 "-Wextra",
350 "-Werror",
351 "-Wthread-safety",
352 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800353
354 test_suites: ["device-tests"],
355}
356
Elliott Hughes01705e42019-02-07 12:41:37 -0800357cc_test_library {
358 name: "libutils_test_singleton1",
359 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800360 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800361 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800362 cflags: [
363 "-Wall",
364 "-Werror",
365 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700366}
Elliott Hughes01705e42019-02-07 12:41:37 -0800367
368cc_test_library {
369 name: "libutils_test_singleton2",
370 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800371 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800372 srcs: ["Singleton_test2.cpp"],
373 cflags: [
374 "-Wall",
375 "-Werror",
376 ],
377 shared_libs: ["libutils_test_singleton1"],
378}
Steven Morelandc732c032019-09-03 18:04:50 -0700379
380cc_benchmark {
381 name: "libutils_benchmark",
382 srcs: ["Vector_benchmark.cpp"],
383 shared_libs: ["libutils"],
384}