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, |
Steven Moreland | d3b4b2c | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 21 | |
Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 22 | header_libs: [ |
Steven Moreland | 95d7cbb | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 23 | "liblog_headers", |
Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 24 | "libsystem_headers", |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 25 | "libcutils_headers", |
Suren Baghdasaryan | 9491078 | 2019-01-25 05:32:52 +0000 | [diff] [blame] | 26 | "libprocessgroup_headers", |
Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 27 | ], |
| 28 | export_header_lib_headers: [ |
Steven Moreland | 95d7cbb | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 29 | "liblog_headers", |
Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 30 | "libsystem_headers", |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 31 | "libcutils_headers", |
Suren Baghdasaryan | 9491078 | 2019-01-25 05:32:52 +0000 | [diff] [blame] | 32 | "libprocessgroup_headers", |
Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 33 | ], |
Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 34 | export_include_dirs: ["include"], |
Steven Moreland | d3b4b2c | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 35 | |
Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 36 | target: { |
Steven Moreland | d3b4b2c | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 37 | android: { |
| 38 | header_libs: ["libbacktrace_headers"], |
| 39 | export_header_lib_headers: ["libbacktrace_headers"], |
| 40 | }, |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 41 | linux_bionic: { |
| 42 | enabled: true, |
| 43 | }, |
Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 44 | windows: { |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 45 | enabled: true, |
| 46 | }, |
Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 47 | }, |
| 48 | } |
| 49 | |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 50 | cc_defaults { |
| 51 | name: "libutils_defaults", |
Steven Moreland | 91527ed | 2017-04-11 12:43:16 -0700 | [diff] [blame] | 52 | vendor_available: true, |
Jiyong Park | 011ee12 | 2018-05-29 16:41:30 +0900 | [diff] [blame] | 53 | recovery_available: true, |
Justin Yun | 9ca9245 | 2017-07-31 15:41:10 +0900 | [diff] [blame] | 54 | vndk: { |
| 55 | enabled: true, |
| 56 | support_system_process: true, |
| 57 | }, |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 58 | host_supported: true, |
| 59 | |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 60 | cflags: [ |
| 61 | "-Wall", |
| 62 | "-Werror", |
| 63 | ], |
Steven Moreland | b084bc3 | 2017-04-12 18:57:57 -0700 | [diff] [blame] | 64 | header_libs: [ |
Chih-Hung Hsieh | 502f486 | 2018-09-13 11:08:41 -0700 | [diff] [blame] | 65 | "libbase_headers", |
Steven Moreland | b084bc3 | 2017-04-12 18:57:57 -0700 | [diff] [blame] | 66 | "libutils_headers", |
| 67 | ], |
| 68 | export_header_lib_headers: [ |
Steven Moreland | b084bc3 | 2017-04-12 18:57:57 -0700 | [diff] [blame] | 69 | "libutils_headers", |
| 70 | ], |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 71 | |
Steven Moreland | 1f64241 | 2017-06-26 13:52:06 -0700 | [diff] [blame] | 72 | shared_libs: [ |
Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame] | 73 | "libcutils", |
Steven Moreland | 1f64241 | 2017-06-26 13:52:06 -0700 | [diff] [blame] | 74 | "liblog", |
| 75 | ], |
Steven Moreland | 1f64241 | 2017-06-26 13:52:06 -0700 | [diff] [blame] | 76 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 77 | target: { |
| 78 | android: { |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 79 | cflags: ["-fvisibility=protected"], |
| 80 | |
| 81 | shared_libs: [ |
Suren Baghdasaryan | 9491078 | 2019-01-25 05:32:52 +0000 | [diff] [blame] | 82 | "libprocessgroup", |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 83 | "libdl", |
Jiyong Park | 0b3c24b | 2017-05-26 17:57:18 +0900 | [diff] [blame] | 84 | "libvndksupport", |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 85 | ], |
Dan Willemsen | e16bdb1 | 2016-07-13 00:20:20 -0700 | [diff] [blame] | 86 | |
| 87 | sanitize: { |
| 88 | misc_undefined: ["integer"], |
| 89 | }, |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 90 | }, |
| 91 | |
Jiyong Park | 011ee12 | 2018-05-29 16:41:30 +0900 | [diff] [blame] | 92 | recovery: { |
| 93 | exclude_shared_libs: ["libvndksupport"], |
| 94 | }, |
| 95 | |
Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 96 | linux_bionic: { |
| 97 | enabled: true, |
Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 98 | }, |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 99 | |
| 100 | darwin: { |
| 101 | cflags: ["-Wno-unused-parameter"], |
| 102 | }, |
| 103 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 104 | windows: { |
Dan Willemsen | 528f144 | 2017-11-29 18:06:11 -0800 | [diff] [blame] | 105 | cflags: [ |
| 106 | // Under MinGW, ctype.h doesn't need multi-byte support |
| 107 | "-DMB_CUR_MAX=1", |
| 108 | "-Wno-unused-private-field", |
| 109 | ], |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 110 | |
| 111 | enabled: true, |
| 112 | }, |
| 113 | }, |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 114 | } |
| 115 | |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 116 | cc_library { |
| 117 | name: "libutils", |
| 118 | defaults: ["libutils_defaults"], |
dimitry | 454ba7e | 2019-05-16 13:48:17 +0200 | [diff] [blame] | 119 | native_bridge_supported: true, |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 120 | |
| 121 | srcs: [ |
Steven Moreland | 591cab8 | 2019-11-15 00:07:32 -0800 | [diff] [blame] | 122 | "Errors.cpp", |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 123 | "FileMap.cpp", |
| 124 | "JenkinsHash.cpp", |
| 125 | "NativeHandle.cpp", |
| 126 | "Printer.cpp", |
| 127 | "PropertyMap.cpp", |
| 128 | "RefBase.cpp", |
| 129 | "SharedBuffer.cpp", |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 130 | "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 Gao | f0ea1e6 | 2019-01-02 14:31:26 -0800 | [diff] [blame] | 150 | header_libs: ["libbase_headers"], |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 151 | srcs: [ |
| 152 | "Looper.cpp", |
| 153 | ], |
| 154 | }, |
| 155 | }, |
Jeffrey Huang | 18986cb | 2020-02-12 17:06:05 -0800 | [diff] [blame] | 156 | |
| 157 | apex_available: [ |
| 158 | "//apex_available:anyapex", |
| 159 | "//apex_available:platform", |
| 160 | ], |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | cc_library { |
| 164 | name: "libutilscallstack", |
| 165 | defaults: ["libutils_defaults"], |
| 166 | |
| 167 | srcs: [ |
| 168 | "CallStack.cpp", |
| 169 | ], |
| 170 | |
Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame] | 171 | shared_libs: [ |
| 172 | "libutils", |
| 173 | "libbacktrace", |
| 174 | ], |
| 175 | |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 176 | target: { |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 177 | linux: { |
| 178 | srcs: [ |
| 179 | "ProcessCallStack.cpp", |
| 180 | ], |
| 181 | }, |
Steven Moreland | d33a2ee | 2019-04-01 15:01:53 -0700 | [diff] [blame] | 182 | darwin: { |
| 183 | enabled: false, |
| 184 | }, |
Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame] | 185 | windows: { |
| 186 | enabled: false, |
| 187 | }, |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 188 | }, |
| 189 | } |
| 190 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 191 | cc_test { |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 192 | name: "libutils_test", |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 193 | host_supported: true, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 194 | |
| 195 | srcs: [ |
| 196 | "BitSet_test.cpp", |
| 197 | "FileMap_test.cpp", |
| 198 | "LruCache_test.cpp", |
| 199 | "Mutex_test.cpp", |
| 200 | "SharedBuffer_test.cpp", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 201 | "String8_test.cpp", |
Vic Yang | 9fb93ed | 2019-09-05 13:18:27 -0700 | [diff] [blame] | 202 | "String16_test.cpp", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 203 | "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 Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 236 | cflags: [ |
| 237 | "-Wall", |
| 238 | "-Wextra", |
| 239 | "-Werror", |
| 240 | "-Wthread-safety", |
| 241 | ], |
Elliott Hughes | cb65c35 | 2019-02-20 15:23:34 -0800 | [diff] [blame] | 242 | |
| 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 | |
| 250 | cc_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 Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | cc_test_library { |
| 266 | name: "libutils_test_singleton1", |
| 267 | host_supported: true, |
| 268 | relative_install_path: "libutils_test", |
| 269 | srcs: ["Singleton_test1.cpp"], |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 270 | cflags: [ |
| 271 | "-Wall", |
| 272 | "-Werror", |
| 273 | ], |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 274 | } |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 275 | |
| 276 | cc_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 Moreland | c732c03 | 2019-09-03 18:04:50 -0700 | [diff] [blame] | 287 | |
| 288 | cc_benchmark { |
| 289 | name: "libutils_benchmark", |
| 290 | srcs: ["Vector_benchmark.cpp"], |
| 291 | shared_libs: ["libutils"], |
| 292 | } |