blob: 9ddbedfbc0274b0ffc7d980d9cbbd83ccddbc940 [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,
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070021
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090022 header_libs: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070023 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090024 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080025 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000026 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090027 ],
28 export_header_lib_headers: [
Steven Moreland95d7cbb2017-07-10 16:40:36 -070029 "liblog_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090030 "libsystem_headers",
Elliott Hughesdc699a22018-02-16 17:58:14 -080031 "libcutils_headers",
Suren Baghdasaryan94910782019-01-25 05:32:52 +000032 "libprocessgroup_headers",
Jaesoo Lee1e8ac0f2017-04-20 16:56:45 +090033 ],
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080034 export_include_dirs: ["include"],
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070035
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080036 target: {
Steven Morelandd3b4b2c2017-04-13 21:01:40 -070037 android: {
38 header_libs: ["libbacktrace_headers"],
39 export_header_lib_headers: ["libbacktrace_headers"],
40 },
Dan Willemsene0cd1e02017-03-15 15:23:36 -070041 linux_bionic: {
42 enabled: true,
43 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080044 windows: {
Dan Willemsene0cd1e02017-03-15 15:23:36 -070045 enabled: true,
46 },
Vijay Venkatraman75acc7b2017-01-05 10:39:38 -080047 },
48}
49
David Sehrabfb9f32018-01-17 17:07:09 -080050cc_defaults {
51 name: "libutils_defaults",
Steven Moreland91527ed2017-04-11 12:43:16 -070052 vendor_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090053 recovery_available: true,
Justin Yun9ca92452017-07-31 15:41:10 +090054 vndk: {
55 enabled: true,
56 support_system_process: true,
57 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070058 host_supported: true,
59
Elliott Hughesdc699a22018-02-16 17:58:14 -080060 cflags: [
61 "-Wall",
62 "-Werror",
63 ],
Steven Morelandb084bc32017-04-12 18:57:57 -070064 header_libs: [
Chih-Hung Hsieh502f4862018-09-13 11:08:41 -070065 "libbase_headers",
Steven Morelandb084bc32017-04-12 18:57:57 -070066 "libutils_headers",
67 ],
68 export_header_lib_headers: [
Steven Morelandb084bc32017-04-12 18:57:57 -070069 "libutils_headers",
70 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -070071
Steven Moreland1f642412017-06-26 13:52:06 -070072 shared_libs: [
Steven Morelande6132be2019-03-25 20:38:56 -070073 "libcutils",
Steven Moreland1f642412017-06-26 13:52:06 -070074 "liblog",
75 ],
Steven Moreland1f642412017-06-26 13:52:06 -070076
Dan Willemsen2e1591b2016-07-12 17:20:18 -070077 target: {
78 android: {
Dan Willemsen2e1591b2016-07-12 17:20:18 -070079 cflags: ["-fvisibility=protected"],
80
81 shared_libs: [
Suren Baghdasaryan94910782019-01-25 05:32:52 +000082 "libprocessgroup",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070083 "libdl",
Jiyong Park0b3c24b2017-05-26 17:57:18 +090084 "libvndksupport",
Dan Willemsen2e1591b2016-07-12 17:20:18 -070085 ],
Dan Willemsene16bdb12016-07-13 00:20:20 -070086
87 sanitize: {
88 misc_undefined: ["integer"],
89 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070090 },
91
Jiyong Park011ee122018-05-29 16:41:30 +090092 recovery: {
93 exclude_shared_libs: ["libvndksupport"],
94 },
95
Dan Willemsenab34b472016-11-29 13:32:55 -080096 linux_bionic: {
97 enabled: true,
Dan Willemsenab34b472016-11-29 13:32:55 -080098 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -070099
100 darwin: {
101 cflags: ["-Wno-unused-parameter"],
102 },
103
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700104 windows: {
Dan Willemsen528f1442017-11-29 18:06:11 -0800105 cflags: [
106 // Under MinGW, ctype.h doesn't need multi-byte support
107 "-DMB_CUR_MAX=1",
108 "-Wno-unused-private-field",
109 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700110
111 enabled: true,
112 },
113 },
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700114}
115
David Sehrabfb9f32018-01-17 17:07:09 -0800116cc_library {
117 name: "libutils",
118 defaults: ["libutils_defaults"],
dimitry454ba7e2019-05-16 13:48:17 +0200119 native_bridge_supported: true,
David Sehrabfb9f32018-01-17 17:07:09 -0800120
121 srcs: [
Steven Moreland591cab82019-11-15 00:07:32 -0800122 "Errors.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800123 "FileMap.cpp",
124 "JenkinsHash.cpp",
125 "NativeHandle.cpp",
126 "Printer.cpp",
127 "PropertyMap.cpp",
128 "RefBase.cpp",
129 "SharedBuffer.cpp",
David Sehrabfb9f32018-01-17 17:07:09 -0800130 "StopWatch.cpp",
131 "String8.cpp",
132 "String16.cpp",
133 "StrongPointer.cpp",
134 "SystemClock.cpp",
135 "Threads.cpp",
136 "Timers.cpp",
137 "Tokenizer.cpp",
138 "Unicode.cpp",
139 "VectorImpl.cpp",
140 "misc.cpp",
141 ],
142
143 target: {
144 android: {
145 srcs: [
146 "Trace.cpp",
147 ],
148 },
149 linux: {
Josh Gaof0ea1e62019-01-02 14:31:26 -0800150 header_libs: ["libbase_headers"],
David Sehrabfb9f32018-01-17 17:07:09 -0800151 srcs: [
152 "Looper.cpp",
153 ],
154 },
155 },
Jeffrey Huang18986cb2020-02-12 17:06:05 -0800156
157 apex_available: [
158 "//apex_available:anyapex",
159 "//apex_available:platform",
160 ],
David Sehrabfb9f32018-01-17 17:07:09 -0800161}
162
163cc_library {
164 name: "libutilscallstack",
165 defaults: ["libutils_defaults"],
166
167 srcs: [
168 "CallStack.cpp",
169 ],
170
Steven Morelande6132be2019-03-25 20:38:56 -0700171 shared_libs: [
172 "libutils",
173 "libbacktrace",
174 ],
175
David Sehrabfb9f32018-01-17 17:07:09 -0800176 target: {
David Sehrabfb9f32018-01-17 17:07:09 -0800177 linux: {
178 srcs: [
179 "ProcessCallStack.cpp",
180 ],
181 },
Steven Morelandd33a2ee2019-04-01 15:01:53 -0700182 darwin: {
183 enabled: false,
184 },
Steven Morelande6132be2019-03-25 20:38:56 -0700185 windows: {
186 enabled: false,
187 },
David Sehrabfb9f32018-01-17 17:07:09 -0800188 },
189}
190
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700191cc_test {
Elliott Hughes01705e42019-02-07 12:41:37 -0800192 name: "libutils_test",
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700193 host_supported: true,
Elliott Hughes01705e42019-02-07 12:41:37 -0800194
195 srcs: [
196 "BitSet_test.cpp",
197 "FileMap_test.cpp",
198 "LruCache_test.cpp",
199 "Mutex_test.cpp",
200 "SharedBuffer_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800201 "String8_test.cpp",
Vic Yang9fb93ed2019-09-05 13:18:27 -0700202 "String16_test.cpp",
Elliott Hughes01705e42019-02-07 12:41:37 -0800203 "StrongPointer_test.cpp",
204 "Unicode_test.cpp",
205 "Vector_test.cpp",
206 ],
207
208 target: {
209 android: {
210 srcs: [
211 "SystemClock_test.cpp",
212 ],
213 shared_libs: [
214 "libz",
215 "liblog",
216 "libcutils",
217 "libutils",
218 "libbase",
219 ],
220 },
221 linux: {
222 srcs: [
223 "Looper_test.cpp",
224 "RefBase_test.cpp",
225 ],
226 },
227 host: {
228 static_libs: [
229 "libutils",
230 "liblog",
231 "libbase",
232 ],
233 },
234 },
235
Elliott Hughes01705e42019-02-07 12:41:37 -0800236 cflags: [
237 "-Wall",
238 "-Wextra",
239 "-Werror",
240 "-Wthread-safety",
241 ],
Elliott Hughescb65c352019-02-20 15:23:34 -0800242
243 test_suites: ["device-tests"],
244}
245
246// TODO: the test infrastructure isn't yet capable of running this,
247// so it's broken out into its own test so that the main libutils_tests
248// can be in presubmit even if this can't.
249
250cc_test {
251 name: "libutils_singleton_test",
252 srcs: ["Singleton_test.cpp"],
253 cflags: [
254 "-Wall",
255 "-Werror",
256 ],
257 shared_libs: ["libbase"],
258
259 required: [
260 ":libutils_test_singleton1",
261 ":libutils_test_singleton2",
262 ],
Elliott Hughes01705e42019-02-07 12:41:37 -0800263}
264
265cc_test_library {
266 name: "libutils_test_singleton1",
267 host_supported: true,
268 relative_install_path: "libutils_test",
269 srcs: ["Singleton_test1.cpp"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800270 cflags: [
271 "-Wall",
272 "-Werror",
273 ],
Dan Willemsen2e1591b2016-07-12 17:20:18 -0700274}
Elliott Hughes01705e42019-02-07 12:41:37 -0800275
276cc_test_library {
277 name: "libutils_test_singleton2",
278 host_supported: true,
279 relative_install_path: "libutils_test",
280 srcs: ["Singleton_test2.cpp"],
281 cflags: [
282 "-Wall",
283 "-Werror",
284 ],
285 shared_libs: ["libutils_test_singleton1"],
286}
Steven Morelandc732c032019-09-03 18:04:50 -0700287
288cc_benchmark {
289 name: "libutils_benchmark",
290 srcs: ["Vector_benchmark.cpp"],
291 shared_libs: ["libutils"],
292}