| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 1 | // 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 Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 15 | cc_library_headers { | 
|  | 16 | name: "libutils_headers", | 
| Steven Moreland | 91527ed | 2017-04-11 12:43:16 -0700 | [diff] [blame] | 17 | vendor_available: true, | 
| Jiyong Park | 612210c | 2018-04-27 21:48:43 +0900 | [diff] [blame] | 18 | recovery_available: true, | 
| Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 19 | host_supported: true, | 
| dimitry | 454ba7e | 2019-05-16 13:48:17 +0200 | [diff] [blame] | 20 | native_bridge_supported: true, | 
| Jiyong Park | 8bf9b16 | 2020-03-07 16:36:09 +0900 | [diff] [blame] | 21 | apex_available: [ | 
|  | 22 | "//apex_available:platform", | 
|  | 23 | "//apex_available:anyapex", | 
|  | 24 | ], | 
| Jooyung Han | 7ea0d74 | 2020-04-16 18:48:33 +0900 | [diff] [blame] | 25 | min_sdk_version: "apex_inherit", | 
| Steven Moreland | d3b4b2c | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 26 |  | 
| Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 27 | header_libs: [ | 
| Steven Moreland | 95d7cbb | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 28 | "liblog_headers", | 
| Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 29 | "libsystem_headers", | 
| Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 30 | "libcutils_headers", | 
| Suren Baghdasaryan | 9491078 | 2019-01-25 05:32:52 +0000 | [diff] [blame] | 31 | "libprocessgroup_headers", | 
| Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 32 | ], | 
|  | 33 | export_header_lib_headers: [ | 
| Steven Moreland | 95d7cbb | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 34 | "liblog_headers", | 
| Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 35 | "libsystem_headers", | 
| Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 36 | "libcutils_headers", | 
| Suren Baghdasaryan | 9491078 | 2019-01-25 05:32:52 +0000 | [diff] [blame] | 37 | "libprocessgroup_headers", | 
| Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 38 | ], | 
| Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 39 | export_include_dirs: ["include"], | 
| Steven Moreland | d3b4b2c | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 40 |  | 
| Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 41 | target: { | 
| Steven Moreland | d3b4b2c | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 42 | android: { | 
|  | 43 | header_libs: ["libbacktrace_headers"], | 
|  | 44 | export_header_lib_headers: ["libbacktrace_headers"], | 
|  | 45 | }, | 
| Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 46 | linux_bionic: { | 
|  | 47 | enabled: true, | 
|  | 48 | }, | 
| Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 49 | windows: { | 
| Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 50 | enabled: true, | 
|  | 51 | }, | 
| Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 52 | }, | 
|  | 53 | } | 
|  | 54 |  | 
| David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 55 | cc_defaults { | 
|  | 56 | name: "libutils_defaults", | 
| Steven Moreland | 91527ed | 2017-04-11 12:43:16 -0700 | [diff] [blame] | 57 | vendor_available: true, | 
| Jiyong Park | 011ee12 | 2018-05-29 16:41:30 +0900 | [diff] [blame] | 58 | recovery_available: true, | 
| Justin Yun | 9ca9245 | 2017-07-31 15:41:10 +0900 | [diff] [blame] | 59 | vndk: { | 
|  | 60 | enabled: true, | 
|  | 61 | support_system_process: true, | 
|  | 62 | }, | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 63 | host_supported: true, | 
|  | 64 |  | 
| Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 65 | cflags: [ | 
|  | 66 | "-Wall", | 
|  | 67 | "-Werror", | 
|  | 68 | ], | 
| Steven Moreland | b084bc3 | 2017-04-12 18:57:57 -0700 | [diff] [blame] | 69 | header_libs: [ | 
| Chih-Hung Hsieh | 502f486 | 2018-09-13 11:08:41 -0700 | [diff] [blame] | 70 | "libbase_headers", | 
| Steven Moreland | b084bc3 | 2017-04-12 18:57:57 -0700 | [diff] [blame] | 71 | "libutils_headers", | 
|  | 72 | ], | 
|  | 73 | export_header_lib_headers: [ | 
| Steven Moreland | b084bc3 | 2017-04-12 18:57:57 -0700 | [diff] [blame] | 74 | "libutils_headers", | 
|  | 75 | ], | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 76 |  | 
| Steven Moreland | 1f64241 | 2017-06-26 13:52:06 -0700 | [diff] [blame] | 77 | shared_libs: [ | 
| Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame] | 78 | "libcutils", | 
| Steven Moreland | 1f64241 | 2017-06-26 13:52:06 -0700 | [diff] [blame] | 79 | "liblog", | 
|  | 80 | ], | 
| Steven Moreland | 1f64241 | 2017-06-26 13:52:06 -0700 | [diff] [blame] | 81 |  | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 82 | target: { | 
|  | 83 | android: { | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 84 | cflags: ["-fvisibility=protected"], | 
|  | 85 |  | 
|  | 86 | shared_libs: [ | 
| Suren Baghdasaryan | 9491078 | 2019-01-25 05:32:52 +0000 | [diff] [blame] | 87 | "libprocessgroup", | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 88 | "libdl", | 
| Jiyong Park | 0b3c24b | 2017-05-26 17:57:18 +0900 | [diff] [blame] | 89 | "libvndksupport", | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 90 | ], | 
| Dan Willemsen | e16bdb1 | 2016-07-13 00:20:20 -0700 | [diff] [blame] | 91 |  | 
|  | 92 | sanitize: { | 
|  | 93 | misc_undefined: ["integer"], | 
|  | 94 | }, | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 95 | }, | 
|  | 96 |  | 
| Jiyong Park | 011ee12 | 2018-05-29 16:41:30 +0900 | [diff] [blame] | 97 | recovery: { | 
|  | 98 | exclude_shared_libs: ["libvndksupport"], | 
|  | 99 | }, | 
|  | 100 |  | 
| Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 101 | linux_bionic: { | 
|  | 102 | enabled: true, | 
| Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 103 | }, | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 104 |  | 
|  | 105 | darwin: { | 
|  | 106 | cflags: ["-Wno-unused-parameter"], | 
|  | 107 | }, | 
|  | 108 |  | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 109 | windows: { | 
| Dan Willemsen | 528f144 | 2017-11-29 18:06:11 -0800 | [diff] [blame] | 110 | cflags: [ | 
|  | 111 | // Under MinGW, ctype.h doesn't need multi-byte support | 
|  | 112 | "-DMB_CUR_MAX=1", | 
|  | 113 | "-Wno-unused-private-field", | 
|  | 114 | ], | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 115 |  | 
|  | 116 | enabled: true, | 
|  | 117 | }, | 
|  | 118 | }, | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 119 | } | 
|  | 120 |  | 
| David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 121 | cc_library { | 
|  | 122 | name: "libutils", | 
|  | 123 | defaults: ["libutils_defaults"], | 
| dimitry | 454ba7e | 2019-05-16 13:48:17 +0200 | [diff] [blame] | 124 | native_bridge_supported: true, | 
| David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 125 |  | 
|  | 126 | srcs: [ | 
| Steven Moreland | 591cab8 | 2019-11-15 00:07:32 -0800 | [diff] [blame] | 127 | "Errors.cpp", | 
| David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 128 | "FileMap.cpp", | 
|  | 129 | "JenkinsHash.cpp", | 
|  | 130 | "NativeHandle.cpp", | 
|  | 131 | "Printer.cpp", | 
|  | 132 | "PropertyMap.cpp", | 
|  | 133 | "RefBase.cpp", | 
|  | 134 | "SharedBuffer.cpp", | 
| David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 135 | "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 Gao | f0ea1e6 | 2019-01-02 14:31:26 -0800 | [diff] [blame] | 155 | header_libs: ["libbase_headers"], | 
| David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 156 | srcs: [ | 
|  | 157 | "Looper.cpp", | 
|  | 158 | ], | 
|  | 159 | }, | 
|  | 160 | }, | 
| Jeffrey Huang | 18986cb | 2020-02-12 17:06:05 -0800 | [diff] [blame] | 161 |  | 
|  | 162 | apex_available: [ | 
|  | 163 | "//apex_available:anyapex", | 
|  | 164 | "//apex_available:platform", | 
|  | 165 | ], | 
| Jooyung Han | 7ea0d74 | 2020-04-16 18:48:33 +0900 | [diff] [blame] | 166 | min_sdk_version: "apex_inherit", | 
| David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 167 | } | 
|  | 168 |  | 
|  | 169 | cc_library { | 
|  | 170 | name: "libutilscallstack", | 
|  | 171 | defaults: ["libutils_defaults"], | 
|  | 172 |  | 
|  | 173 | srcs: [ | 
|  | 174 | "CallStack.cpp", | 
|  | 175 | ], | 
|  | 176 |  | 
| Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame] | 177 | shared_libs: [ | 
| Dylan Katz | 9d5845b | 2020-05-11 15:44:01 -0700 | [diff] [blame] | 178 | "libutils", | 
|  | 179 | "libbacktrace", | 
| Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame] | 180 | ], | 
|  | 181 |  | 
| David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 182 | target: { | 
| David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 183 | linux: { | 
|  | 184 | srcs: [ | 
|  | 185 | "ProcessCallStack.cpp", | 
|  | 186 | ], | 
|  | 187 | }, | 
| Steven Moreland | d33a2ee | 2019-04-01 15:01:53 -0700 | [diff] [blame] | 188 | darwin: { | 
|  | 189 | enabled: false, | 
|  | 190 | }, | 
| Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame] | 191 | windows: { | 
|  | 192 | enabled: false, | 
|  | 193 | }, | 
| David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 194 | }, | 
|  | 195 | } | 
|  | 196 |  | 
| Dylan Katz | 9d5845b | 2020-05-11 15:44:01 -0700 | [diff] [blame] | 197 | cc_defaults { | 
|  | 198 | name: "libutils_fuzz_defaults", | 
|  | 199 | host_supported: true, | 
|  | 200 | shared_libs: [ | 
|  | 201 | "libutils", | 
|  | 202 | "libbase", | 
|  | 203 | ], | 
|  | 204 | } | 
|  | 205 |  | 
|  | 206 | cc_fuzz { | 
|  | 207 | name: "libutils_fuzz_bitset", | 
|  | 208 | defaults: ["libutils_fuzz_defaults"], | 
|  | 209 | srcs: ["BitSet_fuzz.cpp"], | 
|  | 210 | } | 
|  | 211 |  | 
|  | 212 | cc_fuzz { | 
|  | 213 | name: "libutils_fuzz_filemap", | 
|  | 214 | defaults: ["libutils_fuzz_defaults"], | 
|  | 215 | srcs: ["FileMap_fuzz.cpp"], | 
|  | 216 | } | 
|  | 217 |  | 
|  | 218 | cc_fuzz { | 
|  | 219 | name: "libutils_fuzz_string8", | 
|  | 220 | defaults: ["libutils_fuzz_defaults"], | 
|  | 221 | srcs: ["String8_fuzz.cpp"], | 
|  | 222 | } | 
|  | 223 |  | 
|  | 224 | cc_fuzz { | 
|  | 225 | name: "libutils_fuzz_string16", | 
|  | 226 | defaults: ["libutils_fuzz_defaults"], | 
|  | 227 | srcs: ["String16_fuzz.cpp"], | 
|  | 228 | } | 
|  | 229 |  | 
|  | 230 | cc_fuzz { | 
|  | 231 | name: "libutils_fuzz_vector", | 
|  | 232 | defaults: ["libutils_fuzz_defaults"], | 
|  | 233 | srcs: ["Vector_fuzz.cpp"], | 
|  | 234 | } | 
|  | 235 |  | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 236 | cc_test { | 
| Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 237 | name: "libutils_test", | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 238 | host_supported: true, | 
| Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 239 |  | 
|  | 240 | srcs: [ | 
|  | 241 | "BitSet_test.cpp", | 
|  | 242 | "FileMap_test.cpp", | 
|  | 243 | "LruCache_test.cpp", | 
|  | 244 | "Mutex_test.cpp", | 
|  | 245 | "SharedBuffer_test.cpp", | 
| Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 246 | "String8_test.cpp", | 
| Vic Yang | 9fb93ed | 2019-09-05 13:18:27 -0700 | [diff] [blame] | 247 | "String16_test.cpp", | 
| Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 248 | "StrongPointer_test.cpp", | 
|  | 249 | "Unicode_test.cpp", | 
|  | 250 | "Vector_test.cpp", | 
|  | 251 | ], | 
|  | 252 |  | 
|  | 253 | target: { | 
|  | 254 | android: { | 
|  | 255 | srcs: [ | 
|  | 256 | "SystemClock_test.cpp", | 
|  | 257 | ], | 
|  | 258 | shared_libs: [ | 
|  | 259 | "libz", | 
|  | 260 | "liblog", | 
|  | 261 | "libcutils", | 
|  | 262 | "libutils", | 
|  | 263 | "libbase", | 
|  | 264 | ], | 
|  | 265 | }, | 
|  | 266 | linux: { | 
|  | 267 | srcs: [ | 
|  | 268 | "Looper_test.cpp", | 
|  | 269 | "RefBase_test.cpp", | 
|  | 270 | ], | 
|  | 271 | }, | 
|  | 272 | host: { | 
|  | 273 | static_libs: [ | 
|  | 274 | "libutils", | 
|  | 275 | "liblog", | 
|  | 276 | "libbase", | 
|  | 277 | ], | 
|  | 278 | }, | 
|  | 279 | }, | 
|  | 280 |  | 
| Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 281 | cflags: [ | 
|  | 282 | "-Wall", | 
|  | 283 | "-Wextra", | 
|  | 284 | "-Werror", | 
|  | 285 | "-Wthread-safety", | 
|  | 286 | ], | 
| Elliott Hughes | cb65c35 | 2019-02-20 15:23:34 -0800 | [diff] [blame] | 287 |  | 
|  | 288 | test_suites: ["device-tests"], | 
|  | 289 | } | 
|  | 290 |  | 
|  | 291 | // TODO: the test infrastructure isn't yet capable of running this, | 
|  | 292 | // so it's broken out into its own test so that the main libutils_tests | 
|  | 293 | // can be in presubmit even if this can't. | 
|  | 294 |  | 
|  | 295 | cc_test { | 
|  | 296 | name: "libutils_singleton_test", | 
|  | 297 | srcs: ["Singleton_test.cpp"], | 
|  | 298 | cflags: [ | 
|  | 299 | "-Wall", | 
|  | 300 | "-Werror", | 
|  | 301 | ], | 
|  | 302 | shared_libs: ["libbase"], | 
|  | 303 |  | 
|  | 304 | required: [ | 
|  | 305 | ":libutils_test_singleton1", | 
|  | 306 | ":libutils_test_singleton2", | 
|  | 307 | ], | 
| Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 308 | } | 
|  | 309 |  | 
|  | 310 | cc_test_library { | 
|  | 311 | name: "libutils_test_singleton1", | 
|  | 312 | host_supported: true, | 
|  | 313 | relative_install_path: "libutils_test", | 
|  | 314 | srcs: ["Singleton_test1.cpp"], | 
| Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 315 | cflags: [ | 
|  | 316 | "-Wall", | 
|  | 317 | "-Werror", | 
|  | 318 | ], | 
| Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 319 | } | 
| Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 320 |  | 
|  | 321 | cc_test_library { | 
|  | 322 | name: "libutils_test_singleton2", | 
|  | 323 | host_supported: true, | 
|  | 324 | relative_install_path: "libutils_test", | 
|  | 325 | srcs: ["Singleton_test2.cpp"], | 
|  | 326 | cflags: [ | 
|  | 327 | "-Wall", | 
|  | 328 | "-Werror", | 
|  | 329 | ], | 
|  | 330 | shared_libs: ["libutils_test_singleton1"], | 
|  | 331 | } | 
| Steven Moreland | c732c03 | 2019-09-03 18:04:50 -0700 | [diff] [blame] | 332 |  | 
|  | 333 | cc_benchmark { | 
|  | 334 | name: "libutils_benchmark", | 
|  | 335 | srcs: ["Vector_benchmark.cpp"], | 
|  | 336 | shared_libs: ["libutils"], | 
|  | 337 | } |