blob: 3ab619b318e91bc0bf34a8a5baca133c73729de8 [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 ],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070025
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090026 header_libs: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070027 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090028 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080029 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000030 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090031 ],
32 export_header_lib_headers: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070033 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090034 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080035 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000036 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090037 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080038 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070039
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080040 target: {
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070041 android: {
42 header_libs: ["libbacktrace_headers"],
43 export_header_lib_headers: ["libbacktrace_headers"],
44 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070045 linux_bionic: {
46 enabled: true,
47 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080048 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070049 enabled: true,
50 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080051 },
52}
53
David Sehrabfb9f32018-01-17 17:07:09 -080054cc_defaults {
55 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070056 vendor_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090057 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090058 vndk: {
59 enabled: true,
60 support_system_process: true,
61 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070062 host_supported: true,
63
Elliott Hughesdc699a22018-02-16 17:58:14 -080064 cflags: [
65 "-Wall",
66 "-Werror",
67 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070068 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070069 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070070 "libutils_headers",
71 ],
72 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070073 "libutils_headers",
74 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070075
Steven Moreland1f642412017-06-26 13:52:06 -070076 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070077 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070078 "liblog",
79 ],
Steven Moreland1f642412017-06-26 13:52:06 -070080
Dan Willemsen2e1591b2016-07-12 17:20:18 -070081 target: {
82 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070083 cflags: ["-fvisibility=protected"],
84
85 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +000086 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070087 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +090088 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070089 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070090
91 sanitize: {
92 misc_undefined: ["integer"],
93 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070094 },
95
Jiyong Park011ee122018-05-29 16:41:30 +090096 recovery: {
97 exclude_shared_libs: ["libvndksupport"],
98 },
99
Dan Willemsenab34b472016-11-29 13:32:55 -0800100 linux_bionic: {
101 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -0800102 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700103
104 darwin: {
105 cflags: ["-Wno-unused-parameter"],
106 },
107
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700108 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800109 cflags: [
110 // Under MinGW, ctype.h doesn't need multi-byte support
111 "-DMB_CUR_MAX=1",
112 "-Wno-unused-private-field",
113 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700114
115 enabled: true,
116 },
117 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700118}
119
David Sehrabfb9f32018-01-17 17:07:09 -0800120cc_library {
121 name: "libutils",
122 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200123 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800124
125 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800126 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800127 "FileMap.cpp",
128 "JenkinsHash.cpp",
129 "NativeHandle.cpp",
130 "Printer.cpp",
131 "PropertyMap.cpp",
132 "RefBase.cpp",
133 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800134 "StopWatch.cpp",
135 "String8.cpp",
136 "String16.cpp",
137 "StrongPointer.cpp",
138 "SystemClock.cpp",
139 "Threads.cpp",
140 "Timers.cpp",
141 "Tokenizer.cpp",
142 "Unicode.cpp",
143 "VectorImpl.cpp",
144 "misc.cpp",
145 ],
146
147 target: {
148 android: {
149 srcs: [
150 "Trace.cpp",
151 ],
152 },
153 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800154 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800155 srcs: [
156 "Looper.cpp",
157 ],
158 },
159 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800160
161 apex_available: [
162 "//apex_available:anyapex",
163 "//apex_available:platform",
164 ],
David Sehrabfb9f32018-01-17 17:07:09 -0800165}
166
167cc_library {
168 name: "libutilscallstack",
169 defaults: ["libutils_defaults"],
170
171 srcs: [
172 "CallStack.cpp",
173 ],
174
Steven Morelande6132be2019-03-25 20:38:56 -0700175 shared_libs: [
176 "libutils",
177 "libbacktrace",
178 ],
179
David Sehrabfb9f32018-01-17 17:07:09 -0800180 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800181 linux: {
182 srcs: [
183 "ProcessCallStack.cpp",
184 ],
185 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700186 darwin: {
187 enabled: false,
188 },
Steven Morelande6132be2019-03-25 20:38:56 -0700189 windows: {
190 enabled: false,
191 },
David Sehrabfb9f32018-01-17 17:07:09 -0800192 },
193}
194
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700195cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800196 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700197 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800198
199 srcs: [
200 "BitSet_test.cpp",
201 "FileMap_test.cpp",
202 "LruCache_test.cpp",
203 "Mutex_test.cpp",
204 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800205 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700206 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800207 "StrongPointer_test.cpp",
208 "Unicode_test.cpp",
209 "Vector_test.cpp",
210 ],
211
212 target: {
213 android: {
214 srcs: [
215 "SystemClock_test.cpp",
216 ],
217 shared_libs: [
218 "libz",
219 "liblog",
220 "libcutils",
221 "libutils",
222 "libbase",
223 ],
224 },
225 linux: {
226 srcs: [
227 "Looper_test.cpp",
228 "RefBase_test.cpp",
229 ],
230 },
231 host: {
232 static_libs: [
233 "libutils",
234 "liblog",
235 "libbase",
236 ],
237 },
238 },
239
Elliott Hughes01705e42019-02-07 12:41:37 -0800240 cflags: [
241 "-Wall",
242 "-Wextra",
243 "-Werror",
244 "-Wthread-safety",
245 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800246
247 test_suites: ["device-tests"],
248}
249
250// TODO: the test infrastructure isn't yet capable of running this,
251// so it's broken out into its own test so that the main libutils_tests
252// can be in presubmit even if this can't.
253
254cc_test {
255 name: "libutils_singleton_test",
256 srcs: ["Singleton_test.cpp"],
257 cflags: [
258 "-Wall",
259 "-Werror",
260 ],
261 shared_libs: ["libbase"],
262
263 required: [
264 ":libutils_test_singleton1",
265 ":libutils_test_singleton2",
266 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800267}
268
269cc_test_library {
270 name: "libutils_test_singleton1",
271 host_supported: true,
272 relative_install_path: "libutils_test",
273 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800274 cflags: [
275 "-Wall",
276 "-Werror",
277 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700278}
Elliott Hughes01705e42019-02-07 12:41:37 -0800279
280cc_test_library {
281 name: "libutils_test_singleton2",
282 host_supported: true,
283 relative_install_path: "libutils_test",
284 srcs: ["Singleton_test2.cpp"],
285 cflags: [
286 "-Wall",
287 "-Werror",
288 ],
289 shared_libs: ["libutils_test_singleton1"],
290}
Steven Morelandc732c032019-09-03 18:04:50 -0700291
292cc_benchmark {
293 name: "libutils_benchmark",
294 srcs: ["Vector_benchmark.cpp"],
295 shared_libs: ["libutils"],
296}