blob: dd9fea0415da00b8ac7836bf8291b3f8a6553376 [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",
David Sehrabfb9f32018-01-17 17:07:09 -0800135 "RefBase.cpp",
136 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800137 "StopWatch.cpp",
138 "String8.cpp",
139 "String16.cpp",
140 "StrongPointer.cpp",
141 "SystemClock.cpp",
142 "Threads.cpp",
143 "Timers.cpp",
144 "Tokenizer.cpp",
145 "Unicode.cpp",
146 "VectorImpl.cpp",
147 "misc.cpp",
148 ],
149
150 target: {
151 android: {
152 srcs: [
153 "Trace.cpp",
154 ],
155 },
156 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800157 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800158 srcs: [
159 "Looper.cpp",
160 ],
161 },
162 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800163
164 apex_available: [
165 "//apex_available:anyapex",
166 "//apex_available:platform",
167 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900168 min_sdk_version: "apex_inherit",
David Sehrabfb9f32018-01-17 17:07:09 -0800169}
170
171cc_library {
172 name: "libutilscallstack",
173 defaults: ["libutils_defaults"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200174 // TODO(b/153609531): remove when no longer needed.
175 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800176
177 srcs: [
178 "CallStack.cpp",
179 ],
180
Steven Morelande6132be2019-03-25 20:38:56 -0700181 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700182 "libutils",
183 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700184 ],
185
David Sehrabfb9f32018-01-17 17:07:09 -0800186 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800187 linux: {
188 srcs: [
189 "ProcessCallStack.cpp",
190 ],
191 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700192 darwin: {
193 enabled: false,
194 },
Steven Morelande6132be2019-03-25 20:38:56 -0700195 windows: {
196 enabled: false,
197 },
David Sehrabfb9f32018-01-17 17:07:09 -0800198 },
199}
200
Dylan Katz9d5845b2020-05-11 15:44:01 -0700201cc_defaults {
202 name: "libutils_fuzz_defaults",
203 host_supported: true,
204 shared_libs: [
205 "libutils",
206 "libbase",
Dylan Katz7168f272020-07-02 11:51:44 -0700207 "liblog",
Dylan Katz9d5845b2020-05-11 15:44:01 -0700208 ],
209}
210
211cc_fuzz {
212 name: "libutils_fuzz_bitset",
213 defaults: ["libutils_fuzz_defaults"],
214 srcs: ["BitSet_fuzz.cpp"],
215}
216
217cc_fuzz {
218 name: "libutils_fuzz_filemap",
219 defaults: ["libutils_fuzz_defaults"],
220 srcs: ["FileMap_fuzz.cpp"],
221}
222
223cc_fuzz {
224 name: "libutils_fuzz_string8",
225 defaults: ["libutils_fuzz_defaults"],
226 srcs: ["String8_fuzz.cpp"],
227}
228
229cc_fuzz {
230 name: "libutils_fuzz_string16",
231 defaults: ["libutils_fuzz_defaults"],
232 srcs: ["String16_fuzz.cpp"],
233}
234
235cc_fuzz {
236 name: "libutils_fuzz_vector",
237 defaults: ["libutils_fuzz_defaults"],
238 srcs: ["Vector_fuzz.cpp"],
239}
240
Dylan Katz7168f272020-07-02 11:51:44 -0700241cc_fuzz {
242 name: "libutils_fuzz_printer",
243 defaults: ["libutils_fuzz_defaults"],
244 srcs: ["Printer_fuzz.cpp"],
245}
246
247cc_fuzz {
248 name: "libutils_fuzz_callstack",
249 defaults: ["libutils_fuzz_defaults"],
250 srcs: ["CallStack_fuzz.cpp"],
251 shared_libs: [
252 "libutilscallstack",
253 ],
254}
255
256cc_fuzz {
257 name: "libutils_fuzz_process_callstack",
258 defaults: ["libutils_fuzz_defaults"],
259 srcs: ["ProcessCallStack_fuzz.cpp"],
260 shared_libs: [
261 "libutilscallstack",
262 ],
263}
264
265cc_fuzz {
266 name: "libutils_fuzz_stopwatch",
267 defaults: ["libutils_fuzz_defaults"],
268 srcs: ["StopWatch_fuzz.cpp"],
269}
270
271cc_fuzz {
Dylan Katz7168f272020-07-02 11:51:44 -0700272 name: "libutils_fuzz_refbase",
273 defaults: ["libutils_fuzz_defaults"],
274 srcs: ["RefBase_fuzz.cpp"],
275}
276
277cc_fuzz {
278 name: "libutils_fuzz_lrucache",
279 defaults: ["libutils_fuzz_defaults"],
280 srcs: ["LruCache_fuzz.cpp"],
281}
282
283cc_fuzz {
284 name: "libutils_fuzz_looper",
285 defaults: ["libutils_fuzz_defaults"],
286 srcs: ["Looper_fuzz.cpp"],
287}
288
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700289cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800290 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700291 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800292
293 srcs: [
294 "BitSet_test.cpp",
295 "FileMap_test.cpp",
296 "LruCache_test.cpp",
297 "Mutex_test.cpp",
298 "SharedBuffer_test.cpp",
Yo Chiang5b028ba2020-07-10 19:34:53 +0800299 "Singleton_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800300 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700301 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800302 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700303 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800304 "Unicode_test.cpp",
305 "Vector_test.cpp",
306 ],
307
308 target: {
309 android: {
310 srcs: [
311 "SystemClock_test.cpp",
312 ],
313 shared_libs: [
314 "libz",
315 "liblog",
316 "libcutils",
317 "libutils",
318 "libbase",
319 ],
320 },
321 linux: {
322 srcs: [
323 "Looper_test.cpp",
324 "RefBase_test.cpp",
325 ],
326 },
327 host: {
328 static_libs: [
329 "libutils",
330 "liblog",
331 "libbase",
332 ],
333 },
334 },
335
Yo Chiang5b028ba2020-07-10 19:34:53 +0800336 data_libs: [
337 "libutils_test_singleton1",
338 "libutils_test_singleton2",
339 ],
340
Elliott Hughes01705e42019-02-07 12:41:37 -0800341 cflags: [
342 "-Wall",
343 "-Wextra",
344 "-Werror",
345 "-Wthread-safety",
346 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800347
348 test_suites: ["device-tests"],
349}
350
Elliott Hughes01705e42019-02-07 12:41:37 -0800351cc_test_library {
352 name: "libutils_test_singleton1",
353 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800354 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800355 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800356 cflags: [
357 "-Wall",
358 "-Werror",
359 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700360}
Elliott Hughes01705e42019-02-07 12:41:37 -0800361
362cc_test_library {
363 name: "libutils_test_singleton2",
364 host_supported: true,
Yo Chiang5b028ba2020-07-10 19:34:53 +0800365 installable: false,
Elliott Hughes01705e42019-02-07 12:41:37 -0800366 srcs: ["Singleton_test2.cpp"],
367 cflags: [
368 "-Wall",
369 "-Werror",
370 ],
371 shared_libs: ["libutils_test_singleton1"],
372}
Steven Morelandc732c032019-09-03 18:04:50 -0700373
374cc_benchmark {
375 name: "libutils_benchmark",
376 srcs: ["Vector_benchmark.cpp"],
377 shared_libs: ["libutils"],
378}