blob: 3a30a9e77625aac37e9ed800f38093a68d2394dc [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"],
178
179 srcs: [
180 "CallStack.cpp",
181 ],
182
183 arch: {
184 mips: {
185 cflags: ["-DALIGN_DOUBLE"],
186 },
187 },
188
Steven Morelande6132be2019-03-25 20:38:56 -0700189 shared_libs: [
190 "libutils",
191 "libbacktrace",
192 ],
193
David Sehrabfb9f32018-01-17 17:07:09 -0800194 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800195 linux: {
196 srcs: [
197 "ProcessCallStack.cpp",
198 ],
199 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700200 darwin: {
201 enabled: false,
202 },
Steven Morelande6132be2019-03-25 20:38:56 -0700203 windows: {
204 enabled: false,
205 },
David Sehrabfb9f32018-01-17 17:07:09 -0800206 },
207}
208
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700209cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800210 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700211 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800212
213 srcs: [
214 "BitSet_test.cpp",
215 "FileMap_test.cpp",
216 "LruCache_test.cpp",
217 "Mutex_test.cpp",
218 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800219 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700220 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800221 "StrongPointer_test.cpp",
222 "Unicode_test.cpp",
223 "Vector_test.cpp",
224 ],
225
226 target: {
227 android: {
228 srcs: [
229 "SystemClock_test.cpp",
230 ],
231 shared_libs: [
232 "libz",
233 "liblog",
234 "libcutils",
235 "libutils",
236 "libbase",
237 ],
238 },
239 linux: {
240 srcs: [
241 "Looper_test.cpp",
242 "RefBase_test.cpp",
243 ],
244 },
245 host: {
246 static_libs: [
247 "libutils",
248 "liblog",
249 "libbase",
250 ],
251 },
252 },
253
Elliott Hughes01705e42019-02-07 12:41:37 -0800254 cflags: [
255 "-Wall",
256 "-Wextra",
257 "-Werror",
258 "-Wthread-safety",
259 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800260
261 test_suites: ["device-tests"],
262}
263
264// TODO: the test infrastructure isn't yet capable of running this,
265// so it's broken out into its own test so that the main libutils_tests
266// can be in presubmit even if this can't.
267
268cc_test {
269 name: "libutils_singleton_test",
270 srcs: ["Singleton_test.cpp"],
271 cflags: [
272 "-Wall",
273 "-Werror",
274 ],
275 shared_libs: ["libbase"],
276
277 required: [
278 ":libutils_test_singleton1",
279 ":libutils_test_singleton2",
280 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800281}
282
283cc_test_library {
284 name: "libutils_test_singleton1",
285 host_supported: true,
286 relative_install_path: "libutils_test",
287 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800288 cflags: [
289 "-Wall",
290 "-Werror",
291 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700292}
Elliott Hughes01705e42019-02-07 12:41:37 -0800293
294cc_test_library {
295 name: "libutils_test_singleton2",
296 host_supported: true,
297 relative_install_path: "libutils_test",
298 srcs: ["Singleton_test2.cpp"],
299 cflags: [
300 "-Wall",
301 "-Werror",
302 ],
303 shared_libs: ["libutils_test_singleton1"],
304}
Steven Morelandc732c032019-09-03 18:04:50 -0700305
306cc_benchmark {
307 name: "libutils_benchmark",
308 srcs: ["Vector_benchmark.cpp"],
309 shared_libs: ["libutils"],
310}