blob: ea39d344929df252b289d75cf1af6c060efafa32 [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 Moreland1f642412017-06-26 13:52:06 -070081
Dan Willemsen2e1591b2016-07-12 17:20:18 -070082 target: {
83 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070084 cflags: ["-fvisibility=protected"],
85
86 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +000087 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070088 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +090089 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070090 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070091
92 sanitize: {
93 misc_undefined: ["integer"],
94 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070095 },
96
Jiyong Park011ee122018-05-29 16:41:30 +090097 recovery: {
98 exclude_shared_libs: ["libvndksupport"],
99 },
100
Dan Willemsenab34b472016-11-29 13:32:55 -0800101 linux_bionic: {
102 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800103 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700104
105 darwin: {
106 cflags: ["-Wno-unused-parameter"],
107 },
108
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700109 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800110 cflags: [
111 // Under MinGW, ctype.h doesn't need multi-byte support
112 "-DMB_CUR_MAX=1",
113 "-Wno-unused-private-field",
114 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700115
116 enabled: true,
117 },
118 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700119}
120
David Sehrabfb9f32018-01-17 17:07:09 -0800121cc_library {
122 name: "libutils",
123 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200124 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800125
126 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800127 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800128 "FileMap.cpp",
129 "JenkinsHash.cpp",
130 "NativeHandle.cpp",
131 "Printer.cpp",
132 "PropertyMap.cpp",
133 "RefBase.cpp",
134 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800135 "StopWatch.cpp",
136 "String8.cpp",
137 "String16.cpp",
138 "StrongPointer.cpp",
139 "SystemClock.cpp",
140 "Threads.cpp",
141 "Timers.cpp",
142 "Tokenizer.cpp",
143 "Unicode.cpp",
144 "VectorImpl.cpp",
145 "misc.cpp",
146 ],
147
148 target: {
149 android: {
150 srcs: [
151 "Trace.cpp",
152 ],
153 },
154 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800155 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800156 srcs: [
157 "Looper.cpp",
158 ],
159 },
160 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800161
162 apex_available: [
163 "//apex_available:anyapex",
164 "//apex_available:platform",
165 ],
Jooyung Han7ea0d742020-04-16 18:48:33 +0900166 min_sdk_version: "apex_inherit",
David Sehrabfb9f32018-01-17 17:07:09 -0800167}
168
169cc_library {
170 name: "libutilscallstack",
171 defaults: ["libutils_defaults"],
172
173 srcs: [
174 "CallStack.cpp",
175 ],
176
Steven Morelande6132be2019-03-25 20:38:56 -0700177 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700178 "libutils",
179 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700180 ],
181
David Sehrabfb9f32018-01-17 17:07:09 -0800182 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800183 linux: {
184 srcs: [
185 "ProcessCallStack.cpp",
186 ],
187 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700188 darwin: {
189 enabled: false,
190 },
Steven Morelande6132be2019-03-25 20:38:56 -0700191 windows: {
192 enabled: false,
193 },
David Sehrabfb9f32018-01-17 17:07:09 -0800194 },
195}
196
Dylan Katz9d5845b2020-05-11 15:44:01 -0700197cc_defaults {
198 name: "libutils_fuzz_defaults",
199 host_supported: true,
200 shared_libs: [
201 "libutils",
202 "libbase",
203 ],
204}
205
206cc_fuzz {
207 name: "libutils_fuzz_bitset",
208 defaults: ["libutils_fuzz_defaults"],
209 srcs: ["BitSet_fuzz.cpp"],
210}
211
212cc_fuzz {
213 name: "libutils_fuzz_filemap",
214 defaults: ["libutils_fuzz_defaults"],
215 srcs: ["FileMap_fuzz.cpp"],
216}
217
218cc_fuzz {
219 name: "libutils_fuzz_string8",
220 defaults: ["libutils_fuzz_defaults"],
221 srcs: ["String8_fuzz.cpp"],
222}
223
224cc_fuzz {
225 name: "libutils_fuzz_string16",
226 defaults: ["libutils_fuzz_defaults"],
227 srcs: ["String16_fuzz.cpp"],
228}
229
230cc_fuzz {
231 name: "libutils_fuzz_vector",
232 defaults: ["libutils_fuzz_defaults"],
233 srcs: ["Vector_fuzz.cpp"],
234}
235
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700236cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800237 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700238 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800239
240 srcs: [
241 "BitSet_test.cpp",
242 "FileMap_test.cpp",
243 "LruCache_test.cpp",
244 "Mutex_test.cpp",
245 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800246 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700247 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800248 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700249 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800250 "Unicode_test.cpp",
251 "Vector_test.cpp",
252 ],
253
254 target: {
255 android: {
256 srcs: [
257 "SystemClock_test.cpp",
258 ],
259 shared_libs: [
260 "libz",
261 "liblog",
262 "libcutils",
263 "libutils",
264 "libbase",
265 ],
266 },
267 linux: {
268 srcs: [
269 "Looper_test.cpp",
270 "RefBase_test.cpp",
271 ],
272 },
273 host: {
274 static_libs: [
275 "libutils",
276 "liblog",
277 "libbase",
278 ],
279 },
280 },
281
Elliott Hughes01705e42019-02-07 12:41:37 -0800282 cflags: [
283 "-Wall",
284 "-Wextra",
285 "-Werror",
286 "-Wthread-safety",
287 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800288
289 test_suites: ["device-tests"],
290}
291
292// TODO: the test infrastructure isn't yet capable of running this,
293// so it's broken out into its own test so that the main libutils_tests
294// can be in presubmit even if this can't.
295
296cc_test {
297 name: "libutils_singleton_test",
298 srcs: ["Singleton_test.cpp"],
299 cflags: [
300 "-Wall",
301 "-Werror",
302 ],
303 shared_libs: ["libbase"],
304
305 required: [
306 ":libutils_test_singleton1",
307 ":libutils_test_singleton2",
308 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800309}
310
311cc_test_library {
312 name: "libutils_test_singleton1",
313 host_supported: true,
314 relative_install_path: "libutils_test",
315 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800316 cflags: [
317 "-Wall",
318 "-Werror",
319 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700320}
Elliott Hughes01705e42019-02-07 12:41:37 -0800321
322cc_test_library {
323 name: "libutils_test_singleton2",
324 host_supported: true,
325 relative_install_path: "libutils_test",
326 srcs: ["Singleton_test2.cpp"],
327 cflags: [
328 "-Wall",
329 "-Werror",
330 ],
331 shared_libs: ["libutils_test_singleton1"],
332}
Steven Morelandc732c032019-09-03 18:04:50 -0700333
334cc_benchmark {
335 name: "libutils_benchmark",
336 srcs: ["Vector_benchmark.cpp"],
337 shared_libs: ["libutils"],
338}