blob: 85f428067867ae7c2abd451f533d38e9beac6ae2 [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 Parka206b8c2020-03-07 16:36:09 +090021 apex_available: [
22 "//apex_available:platform",
23 "//apex_available:anyapex",
24 ],
Jooyung Han7937f292020-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 arch: {
83 mips: {
84 cflags: ["-DALIGN_DOUBLE"],
85 },
86 },
87
88 target: {
89 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070090 cflags: ["-fvisibility=protected"],
91
92 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +000093 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070094 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +090095 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070096 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070097
98 sanitize: {
99 misc_undefined: ["integer"],
100 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700101 },
102
Jiyong Park011ee122018-05-29 16:41:30 +0900103 recovery: {
104 exclude_shared_libs: ["libvndksupport"],
105 },
106
Dan Willemsenab34b472016-11-29 13:32:55 -0800107 linux_bionic: {
108 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800109 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700110
111 darwin: {
112 cflags: ["-Wno-unused-parameter"],
113 },
114
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700115 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800116 cflags: [
117 // Under MinGW, ctype.h doesn't need multi-byte support
118 "-DMB_CUR_MAX=1",
119 "-Wno-unused-private-field",
120 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700121
122 enabled: true,
123 },
124 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700125}
126
David Sehrabfb9f32018-01-17 17:07:09 -0800127cc_library {
128 name: "libutils",
129 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200130 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800131
132 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800133 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800134 "FileMap.cpp",
135 "JenkinsHash.cpp",
136 "NativeHandle.cpp",
137 "Printer.cpp",
138 "PropertyMap.cpp",
139 "RefBase.cpp",
140 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800141 "StopWatch.cpp",
142 "String8.cpp",
143 "String16.cpp",
144 "StrongPointer.cpp",
145 "SystemClock.cpp",
146 "Threads.cpp",
147 "Timers.cpp",
148 "Tokenizer.cpp",
149 "Unicode.cpp",
150 "VectorImpl.cpp",
151 "misc.cpp",
152 ],
153
154 target: {
155 android: {
156 srcs: [
157 "Trace.cpp",
158 ],
159 },
160 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800161 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800162 srcs: [
163 "Looper.cpp",
164 ],
165 },
166 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800167
168 apex_available: [
169 "//apex_available:anyapex",
170 "//apex_available:platform",
171 ],
Jooyung Han7937f292020-04-16 18:48:33 +0900172 min_sdk_version: "apex_inherit",
David Sehrabfb9f32018-01-17 17:07:09 -0800173}
174
175cc_library {
176 name: "libutilscallstack",
177 defaults: ["libutils_defaults"],
Victor Khimenkofb60e6c2020-06-18 22:01:13 +0200178 // TODO(b/153609531): remove when no longer needed.
179 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800180
181 srcs: [
182 "CallStack.cpp",
183 ],
184
185 arch: {
186 mips: {
187 cflags: ["-DALIGN_DOUBLE"],
188 },
189 },
190
Steven Morelande6132be2019-03-25 20:38:56 -0700191 shared_libs: [
192 "libutils",
193 "libbacktrace",
194 ],
195
David Sehrabfb9f32018-01-17 17:07:09 -0800196 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800197 linux: {
198 srcs: [
199 "ProcessCallStack.cpp",
200 ],
201 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700202 darwin: {
203 enabled: false,
204 },
Steven Morelande6132be2019-03-25 20:38:56 -0700205 windows: {
206 enabled: false,
207 },
David Sehrabfb9f32018-01-17 17:07:09 -0800208 },
209}
210
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700211cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800212 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700213 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800214
215 srcs: [
216 "BitSet_test.cpp",
217 "FileMap_test.cpp",
218 "LruCache_test.cpp",
219 "Mutex_test.cpp",
220 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800221 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700222 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800223 "StrongPointer_test.cpp",
224 "Unicode_test.cpp",
225 "Vector_test.cpp",
226 ],
227
228 target: {
229 android: {
230 srcs: [
231 "SystemClock_test.cpp",
232 ],
233 shared_libs: [
234 "libz",
235 "liblog",
236 "libcutils",
237 "libutils",
238 "libbase",
239 ],
240 },
241 linux: {
242 srcs: [
243 "Looper_test.cpp",
244 "RefBase_test.cpp",
245 ],
246 },
247 host: {
248 static_libs: [
249 "libutils",
250 "liblog",
251 "libbase",
252 ],
253 },
254 },
255
Elliott Hughes01705e42019-02-07 12:41:37 -0800256 cflags: [
257 "-Wall",
258 "-Wextra",
259 "-Werror",
260 "-Wthread-safety",
261 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800262
263 test_suites: ["device-tests"],
264}
265
266// TODO: the test infrastructure isn't yet capable of running this,
267// so it's broken out into its own test so that the main libutils_tests
268// can be in presubmit even if this can't.
269
270cc_test {
271 name: "libutils_singleton_test",
272 srcs: ["Singleton_test.cpp"],
273 cflags: [
274 "-Wall",
275 "-Werror",
276 ],
277 shared_libs: ["libbase"],
278
279 required: [
280 ":libutils_test_singleton1",
281 ":libutils_test_singleton2",
282 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800283}
284
285cc_test_library {
286 name: "libutils_test_singleton1",
287 host_supported: true,
288 relative_install_path: "libutils_test",
289 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800290 cflags: [
291 "-Wall",
292 "-Werror",
293 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700294}
Elliott Hughes01705e42019-02-07 12:41:37 -0800295
296cc_test_library {
297 name: "libutils_test_singleton2",
298 host_supported: true,
299 relative_install_path: "libutils_test",
300 srcs: ["Singleton_test2.cpp"],
301 cflags: [
302 "-Wall",
303 "-Werror",
304 ],
305 shared_libs: ["libutils_test_singleton1"],
306}
Steven Morelandc732c032019-09-03 18:04:50 -0700307
308cc_benchmark {
309 name: "libutils_benchmark",
310 srcs: ["Vector_benchmark.cpp"],
311 shared_libs: ["libutils"],
312}