blob: 73928060701f09ce0e32c22de8af3ec003c23332 [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"],
Victor Khimenko7428c522020-06-18 22:01:13 +0200172 // TODO(b/153609531): remove when no longer needed.
173 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800174
175 srcs: [
176 "CallStack.cpp",
177 ],
178
Steven Morelande6132be2019-03-25 20:38:56 -0700179 shared_libs: [
Dylan Katz9d5845b2020-05-11 15:44:01 -0700180 "libutils",
181 "libbacktrace",
Steven Morelande6132be2019-03-25 20:38:56 -0700182 ],
183
David Sehrabfb9f32018-01-17 17:07:09 -0800184 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800185 linux: {
186 srcs: [
187 "ProcessCallStack.cpp",
188 ],
189 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700190 darwin: {
191 enabled: false,
192 },
Steven Morelande6132be2019-03-25 20:38:56 -0700193 windows: {
194 enabled: false,
195 },
David Sehrabfb9f32018-01-17 17:07:09 -0800196 },
197}
198
Dylan Katz9d5845b2020-05-11 15:44:01 -0700199cc_defaults {
200 name: "libutils_fuzz_defaults",
201 host_supported: true,
202 shared_libs: [
203 "libutils",
204 "libbase",
205 ],
206}
207
208cc_fuzz {
209 name: "libutils_fuzz_bitset",
210 defaults: ["libutils_fuzz_defaults"],
211 srcs: ["BitSet_fuzz.cpp"],
212}
213
214cc_fuzz {
215 name: "libutils_fuzz_filemap",
216 defaults: ["libutils_fuzz_defaults"],
217 srcs: ["FileMap_fuzz.cpp"],
218}
219
220cc_fuzz {
221 name: "libutils_fuzz_string8",
222 defaults: ["libutils_fuzz_defaults"],
223 srcs: ["String8_fuzz.cpp"],
224}
225
226cc_fuzz {
227 name: "libutils_fuzz_string16",
228 defaults: ["libutils_fuzz_defaults"],
229 srcs: ["String16_fuzz.cpp"],
230}
231
232cc_fuzz {
233 name: "libutils_fuzz_vector",
234 defaults: ["libutils_fuzz_defaults"],
235 srcs: ["Vector_fuzz.cpp"],
236}
237
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700238cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800239 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700240 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800241
242 srcs: [
243 "BitSet_test.cpp",
244 "FileMap_test.cpp",
245 "LruCache_test.cpp",
246 "Mutex_test.cpp",
247 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800248 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700249 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800250 "StrongPointer_test.cpp",
Elliott Hughes842e1cc2020-05-27 12:24:30 -0700251 "Timers_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800252 "Unicode_test.cpp",
253 "Vector_test.cpp",
254 ],
255
256 target: {
257 android: {
258 srcs: [
259 "SystemClock_test.cpp",
260 ],
261 shared_libs: [
262 "libz",
263 "liblog",
264 "libcutils",
265 "libutils",
266 "libbase",
267 ],
268 },
269 linux: {
270 srcs: [
271 "Looper_test.cpp",
272 "RefBase_test.cpp",
273 ],
274 },
275 host: {
276 static_libs: [
277 "libutils",
278 "liblog",
279 "libbase",
280 ],
281 },
282 },
283
Elliott Hughes01705e42019-02-07 12:41:37 -0800284 cflags: [
285 "-Wall",
286 "-Wextra",
287 "-Werror",
288 "-Wthread-safety",
289 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800290
291 test_suites: ["device-tests"],
292}
293
294// TODO: the test infrastructure isn't yet capable of running this,
295// so it's broken out into its own test so that the main libutils_tests
296// can be in presubmit even if this can't.
297
298cc_test {
299 name: "libutils_singleton_test",
300 srcs: ["Singleton_test.cpp"],
301 cflags: [
302 "-Wall",
303 "-Werror",
304 ],
305 shared_libs: ["libbase"],
306
307 required: [
308 ":libutils_test_singleton1",
309 ":libutils_test_singleton2",
310 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800311}
312
313cc_test_library {
314 name: "libutils_test_singleton1",
315 host_supported: true,
316 relative_install_path: "libutils_test",
317 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800318 cflags: [
319 "-Wall",
320 "-Werror",
321 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700322}
Elliott Hughes01705e42019-02-07 12:41:37 -0800323
324cc_test_library {
325 name: "libutils_test_singleton2",
326 host_supported: true,
327 relative_install_path: "libutils_test",
328 srcs: ["Singleton_test2.cpp"],
329 cflags: [
330 "-Wall",
331 "-Werror",
332 ],
333 shared_libs: ["libutils_test_singleton1"],
334}
Steven Morelandc732c032019-09-03 18:04:50 -0700335
336cc_benchmark {
337 name: "libutils_benchmark",
338 srcs: ["Vector_benchmark.cpp"],
339 shared_libs: ["libutils"],
340}