blob: 05be220db48ee4f665082ee15cfb5c377e6cdced [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",
Elliott Hughes01705e42019-02-07 12:41:37 -0800312 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700313 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800314 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700315 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800316 "Unicode_test.cpp",
317 "Vector_test.cpp",
318 ],
319
320 target: {
321 android: {
322 srcs: [
323 "SystemClock_test.cpp",
324 ],
325 shared_libs: [
326 "libz",
327 "liblog",
328 "libcutils",
329 "libutils",
330 "libbase",
331 ],
332 },
333 linux: {
334 srcs: [
335 "Looper_test.cpp",
336 "RefBase_test.cpp",
337 ],
338 },
339 host: {
340 static_libs: [
341 "libutils",
342 "liblog",
343 "libbase",
344 ],
345 },
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
358// TODO: the test infrastructure isn't yet capable of running this,
359// so it's broken out into its own test so that the main libutils_tests
360// can be in presubmit even if this can't.
361
362cc_test {
363 name: "libutils_singleton_test",
364 srcs: ["Singleton_test.cpp"],
365 cflags: [
366 "-Wall",
367 "-Werror",
368 ],
369 shared_libs: ["libbase"],
370
371 required: [
372 ":libutils_test_singleton1",
373 ":libutils_test_singleton2",
374 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800375}
376
377cc_test_library {
378 name: "libutils_test_singleton1",
379 host_supported: true,
380 relative_install_path: "libutils_test",
381 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,
391 relative_install_path: "libutils_test",
392 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}