blob: 9c012a983d2dfeace04d7d9833a6469d53ed0c16 [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 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070046 linux_bionic: {
47 enabled: true,
48 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080049 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070050 enabled: true,
51 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080052 },
53}
54
David Sehrabfb9f32018-01-17 17:07:09 -080055cc_defaults {
56 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070057 vendor_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090058 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090059 vndk: {
60 enabled: true,
61 support_system_process: true,
62 },
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",
68 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070069 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070070 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070071 "libutils_headers",
72 ],
73 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070074 "libutils_headers",
75 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070076
Steven Moreland1f642412017-06-26 13:52:06 -070077 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070078 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070079 "liblog",
80 ],
Steven Moreland9c832022020-07-07 22:37:07 +000081 sanitize: {
82 misc_undefined: ["integer"],
83 },
Steven Moreland1f642412017-06-26 13:52:06 -070084
Dan Willemsen2e1591b2016-07-12 17:20:18 -070085 target: {
86 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070087 cflags: ["-fvisibility=protected"],
88
89 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +000090 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070091 "libdl",
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 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700122}
123
David Sehrabfb9f32018-01-17 17:07:09 -0800124cc_library {
125 name: "libutils",
126 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200127 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800128
129 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800130 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800131 "FileMap.cpp",
132 "JenkinsHash.cpp",
133 "NativeHandle.cpp",
134 "Printer.cpp",
135 "PropertyMap.cpp",
136 "RefBase.cpp",
137 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800138 "StopWatch.cpp",
139 "String8.cpp",
140 "String16.cpp",
141 "StrongPointer.cpp",
142 "SystemClock.cpp",
143 "Threads.cpp",
144 "Timers.cpp",
145 "Tokenizer.cpp",
146 "Unicode.cpp",
147 "VectorImpl.cpp",
148 "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 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900169 min_sdk_version: "apex_inherit",
David Sehrabfb9f32018-01-17 17:07:09 -0800170}
171
172cc_library {
173 name: "libutilscallstack",
174 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200175 // TODO(b/153609531): remove when no longer needed.
176 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800177
178 srcs: [
179 "CallStack.cpp",
180 ],
181
Steven Morelande6132be2019-03-25 20:38:56 -0700182 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700183 "libutils",
184 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700185 ],
186
David Sehrabfb9f32018-01-17 17:07:09 -0800187 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800188 linux: {
189 srcs: [
190 "ProcessCallStack.cpp",
191 ],
192 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700193 darwin: {
194 enabled: false,
195 },
Steven Morelande6132be2019-03-25 20:38:56 -0700196 windows: {
197 enabled: false,
198 },
David Sehrabfb9f32018-01-17 17:07:09 -0800199 },
200}
201
Dylan Katz9d5845b2020-05-11 15:44:01 -0700202cc_defaults {
203 name: "libutils_fuzz_defaults",
204 host_supported: true,
205 shared_libs: [
206 "libutils",
207 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700208 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700209 ],
210}
211
212cc_fuzz {
213 name: "libutils_fuzz_bitset",
214 defaults: ["libutils_fuzz_defaults"],
215 srcs: ["BitSet_fuzz.cpp"],
216}
217
218cc_fuzz {
219 name: "libutils_fuzz_filemap",
220 defaults: ["libutils_fuzz_defaults"],
221 srcs: ["FileMap_fuzz.cpp"],
222}
223
224cc_fuzz {
225 name: "libutils_fuzz_string8",
226 defaults: ["libutils_fuzz_defaults"],
227 srcs: ["String8_fuzz.cpp"],
228}
229
230cc_fuzz {
231 name: "libutils_fuzz_string16",
232 defaults: ["libutils_fuzz_defaults"],
233 srcs: ["String16_fuzz.cpp"],
234}
235
236cc_fuzz {
237 name: "libutils_fuzz_vector",
238 defaults: ["libutils_fuzz_defaults"],
239 srcs: ["Vector_fuzz.cpp"],
240}
241
Dylan Katz7168f272020-07-02 11:51:44 -0700242cc_fuzz {
243 name: "libutils_fuzz_printer",
244 defaults: ["libutils_fuzz_defaults"],
245 srcs: ["Printer_fuzz.cpp"],
246}
247
248cc_fuzz {
249 name: "libutils_fuzz_callstack",
250 defaults: ["libutils_fuzz_defaults"],
251 srcs: ["CallStack_fuzz.cpp"],
252 shared_libs: [
253 "libutilscallstack",
254 ],
255}
256
257cc_fuzz {
258 name: "libutils_fuzz_process_callstack",
259 defaults: ["libutils_fuzz_defaults"],
260 srcs: ["ProcessCallStack_fuzz.cpp"],
261 shared_libs: [
262 "libutilscallstack",
263 ],
264}
265
266cc_fuzz {
267 name: "libutils_fuzz_stopwatch",
268 defaults: ["libutils_fuzz_defaults"],
269 srcs: ["StopWatch_fuzz.cpp"],
270}
271
272cc_fuzz {
273 name: "libutils_fuzz_propertymap",
274 defaults: ["libutils_fuzz_defaults"],
275 srcs: ["PropertyMap_fuzz.cpp"],
276}
277
278cc_fuzz {
279 name: "libutils_fuzz_rwlock",
280 defaults: ["libutils_fuzz_defaults"],
281 srcs: ["RWLock_fuzz.cpp"],
282}
283
284cc_fuzz {
285 name: "libutils_fuzz_refbase",
286 defaults: ["libutils_fuzz_defaults"],
287 srcs: ["RefBase_fuzz.cpp"],
288}
289
290cc_fuzz {
291 name: "libutils_fuzz_lrucache",
292 defaults: ["libutils_fuzz_defaults"],
293 srcs: ["LruCache_fuzz.cpp"],
294}
295
296cc_fuzz {
297 name: "libutils_fuzz_looper",
298 defaults: ["libutils_fuzz_defaults"],
299 srcs: ["Looper_fuzz.cpp"],
300}
301
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700302cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800303 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700304 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800305
306 srcs: [
307 "BitSet_test.cpp",
308 "FileMap_test.cpp",
309 "LruCache_test.cpp",
310 "Mutex_test.cpp",
311 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800312 "Singleton_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800313 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700314 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800315 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700316 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800317 "Unicode_test.cpp",
318 "Vector_test.cpp",
319 ],
320
321 target: {
322 android: {
323 srcs: [
324 "SystemClock_test.cpp",
325 ],
326 shared_libs: [
327 "libz",
328 "liblog",
329 "libcutils",
330 "libutils",
331 "libbase",
332 ],
333 },
334 linux: {
335 srcs: [
336 "Looper_test.cpp",
337 "RefBase_test.cpp",
338 ],
339 },
340 host: {
341 static_libs: [
342 "libutils",
343 "liblog",
344 "libbase",
345 ],
346 },
347 },
348
Yo Chiang5b028ba2020-07-10 19:34:53 +0800349 data_libs: [
350 "libutils_test_singleton1",
351 "libutils_test_singleton2",
352 ],
353
Elliott Hughes01705e42019-02-07 12:41:37 -0800354 cflags: [
355 "-Wall",
356 "-Wextra",
357 "-Werror",
358 "-Wthread-safety",
359 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800360
361 test_suites: ["device-tests"],
362}
363
Elliott Hughes01705e42019-02-07 12:41:37 -0800364cc_test_library {
365 name: "libutils_test_singleton1",
366 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800367 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800368 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800369 cflags: [
370 "-Wall",
371 "-Werror",
372 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700373}
Elliott Hughes01705e42019-02-07 12:41:37 -0800374
375cc_test_library {
376 name: "libutils_test_singleton2",
377 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800378 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800379 srcs: ["Singleton_test2.cpp"],
380 cflags: [
381 "-Wall",
382 "-Werror",
383 ],
384 shared_libs: ["libutils_test_singleton1"],
385}
Steven Morelandc732c032019-09-03 18:04:50 -0700386
387cc_benchmark {
388 name: "libutils_benchmark",
389 srcs: ["Vector_benchmark.cpp"],
390 shared_libs: ["libutils"],
391}