blob: 9bd15c68e68559e0f3d2c31537a3ddb256f72fc4 [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",
208 ],
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
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700241cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800242 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700243 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800244
245 srcs: [
246 "BitSet_test.cpp",
247 "FileMap_test.cpp",
248 "LruCache_test.cpp",
249 "Mutex_test.cpp",
250 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800251 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700252 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800253 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700254 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800255 "Unicode_test.cpp",
256 "Vector_test.cpp",
257 ],
258
259 target: {
260 android: {
261 srcs: [
262 "SystemClock_test.cpp",
263 ],
264 shared_libs: [
265 "libz",
266 "liblog",
267 "libcutils",
268 "libutils",
269 "libbase",
270 ],
271 },
272 linux: {
273 srcs: [
274 "Looper_test.cpp",
275 "RefBase_test.cpp",
276 ],
277 },
278 host: {
279 static_libs: [
280 "libutils",
281 "liblog",
282 "libbase",
283 ],
284 },
285 },
286
Elliott Hughes01705e42019-02-07 12:41:37 -0800287 cflags: [
288 "-Wall",
289 "-Wextra",
290 "-Werror",
291 "-Wthread-safety",
292 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800293
294 test_suites: ["device-tests"],
295}
296
297// TODO: the test infrastructure isn't yet capable of running this,
298// so it's broken out into its own test so that the main libutils_tests
299// can be in presubmit even if this can't.
300
301cc_test {
302 name: "libutils_singleton_test",
303 srcs: ["Singleton_test.cpp"],
304 cflags: [
305 "-Wall",
306 "-Werror",
307 ],
308 shared_libs: ["libbase"],
309
310 required: [
311 ":libutils_test_singleton1",
312 ":libutils_test_singleton2",
313 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800314}
315
316cc_test_library {
317 name: "libutils_test_singleton1",
318 host_supported: true,
319 relative_install_path: "libutils_test",
320 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800321 cflags: [
322 "-Wall",
323 "-Werror",
324 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700325}
Elliott Hughes01705e42019-02-07 12:41:37 -0800326
327cc_test_library {
328 name: "libutils_test_singleton2",
329 host_supported: true,
330 relative_install_path: "libutils_test",
331 srcs: ["Singleton_test2.cpp"],
332 cflags: [
333 "-Wall",
334 "-Werror",
335 ],
336 shared_libs: ["libutils_test_singleton1"],
337}
Steven Morelandc732c032019-09-03 18:04:50 -0700338
339cc_benchmark {
340 name: "libutils_benchmark",
341 srcs: ["Vector_benchmark.cpp"],
342 shared_libs: ["libutils"],
343}