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, |
Steven Moreland | d3b4b2c | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 20 | |
Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 21 | header_libs: [ |
Steven Moreland | 95d7cbb | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 22 | "liblog_headers", |
Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 23 | "libsystem_headers", |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 24 | "libcutils_headers", |
Suren Baghdasaryan | 9491078 | 2019-01-25 05:32:52 +0000 | [diff] [blame] | 25 | "libprocessgroup_headers", |
Jaesoo Lee | 1e8ac0f | 2017-04-20 16:56:45 +0900 | [diff] [blame] | 26 | ], |
| 27 | export_header_lib_headers: [ |
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 | ], |
Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 33 | export_include_dirs: ["include"], |
Steven Moreland | d3b4b2c | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 34 | |
Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 35 | target: { |
Steven Moreland | d3b4b2c | 2017-04-13 21:01:40 -0700 | [diff] [blame] | 36 | android: { |
| 37 | header_libs: ["libbacktrace_headers"], |
| 38 | export_header_lib_headers: ["libbacktrace_headers"], |
| 39 | }, |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 40 | linux_bionic: { |
| 41 | enabled: true, |
| 42 | }, |
Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 43 | windows: { |
Dan Willemsen | e0cd1e0 | 2017-03-15 15:23:36 -0700 | [diff] [blame] | 44 | enabled: true, |
| 45 | }, |
Vijay Venkatraman | 75acc7b | 2017-01-05 10:39:38 -0800 | [diff] [blame] | 46 | }, |
| 47 | } |
| 48 | |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 49 | cc_defaults { |
| 50 | name: "libutils_defaults", |
Steven Moreland | 91527ed | 2017-04-11 12:43:16 -0700 | [diff] [blame] | 51 | vendor_available: true, |
Jiyong Park | 011ee12 | 2018-05-29 16:41:30 +0900 | [diff] [blame] | 52 | recovery_available: true, |
Justin Yun | 9ca9245 | 2017-07-31 15:41:10 +0900 | [diff] [blame] | 53 | vndk: { |
| 54 | enabled: true, |
| 55 | support_system_process: true, |
| 56 | }, |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 57 | host_supported: true, |
| 58 | |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 59 | cflags: [ |
| 60 | "-Wall", |
| 61 | "-Werror", |
| 62 | ], |
Steven Moreland | b084bc3 | 2017-04-12 18:57:57 -0700 | [diff] [blame] | 63 | header_libs: [ |
Chih-Hung Hsieh | 502f486 | 2018-09-13 11:08:41 -0700 | [diff] [blame] | 64 | "libbase_headers", |
Steven Moreland | b084bc3 | 2017-04-12 18:57:57 -0700 | [diff] [blame] | 65 | "libutils_headers", |
| 66 | ], |
| 67 | export_header_lib_headers: [ |
Steven Moreland | b084bc3 | 2017-04-12 18:57:57 -0700 | [diff] [blame] | 68 | "libutils_headers", |
| 69 | ], |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 70 | |
Steven Moreland | 1f64241 | 2017-06-26 13:52:06 -0700 | [diff] [blame] | 71 | shared_libs: [ |
Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame^] | 72 | "libcutils", |
Steven Moreland | 1f64241 | 2017-06-26 13:52:06 -0700 | [diff] [blame] | 73 | "liblog", |
| 74 | ], |
Steven Moreland | 1f64241 | 2017-06-26 13:52:06 -0700 | [diff] [blame] | 75 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 76 | arch: { |
| 77 | mips: { |
| 78 | cflags: ["-DALIGN_DOUBLE"], |
| 79 | }, |
| 80 | }, |
| 81 | |
| 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"], |
| 124 | |
| 125 | srcs: [ |
| 126 | "FileMap.cpp", |
| 127 | "JenkinsHash.cpp", |
| 128 | "NativeHandle.cpp", |
| 129 | "Printer.cpp", |
| 130 | "PropertyMap.cpp", |
| 131 | "RefBase.cpp", |
| 132 | "SharedBuffer.cpp", |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 133 | "StopWatch.cpp", |
| 134 | "String8.cpp", |
| 135 | "String16.cpp", |
| 136 | "StrongPointer.cpp", |
| 137 | "SystemClock.cpp", |
| 138 | "Threads.cpp", |
| 139 | "Timers.cpp", |
| 140 | "Tokenizer.cpp", |
| 141 | "Unicode.cpp", |
| 142 | "VectorImpl.cpp", |
| 143 | "misc.cpp", |
| 144 | ], |
| 145 | |
| 146 | target: { |
| 147 | android: { |
| 148 | srcs: [ |
| 149 | "Trace.cpp", |
| 150 | ], |
| 151 | }, |
| 152 | linux: { |
Josh Gao | f0ea1e6 | 2019-01-02 14:31:26 -0800 | [diff] [blame] | 153 | header_libs: ["libbase_headers"], |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 154 | srcs: [ |
| 155 | "Looper.cpp", |
| 156 | ], |
| 157 | }, |
| 158 | }, |
| 159 | } |
| 160 | |
| 161 | cc_library { |
| 162 | name: "libutilscallstack", |
| 163 | defaults: ["libutils_defaults"], |
| 164 | |
| 165 | srcs: [ |
| 166 | "CallStack.cpp", |
| 167 | ], |
| 168 | |
| 169 | arch: { |
| 170 | mips: { |
| 171 | cflags: ["-DALIGN_DOUBLE"], |
| 172 | }, |
| 173 | }, |
| 174 | |
Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame^] | 175 | shared_libs: [ |
| 176 | "libutils", |
| 177 | "libbacktrace", |
| 178 | ], |
| 179 | |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 180 | target: { |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 181 | linux: { |
| 182 | srcs: [ |
| 183 | "ProcessCallStack.cpp", |
| 184 | ], |
| 185 | }, |
Steven Moreland | e6132be | 2019-03-25 20:38:56 -0700 | [diff] [blame^] | 186 | windows: { |
| 187 | enabled: false, |
| 188 | }, |
David Sehr | abfb9f3 | 2018-01-17 17:07:09 -0800 | [diff] [blame] | 189 | }, |
| 190 | } |
| 191 | |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 192 | cc_test { |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 193 | name: "libutils_test", |
Dan Willemsen | 2e1591b | 2016-07-12 17:20:18 -0700 | [diff] [blame] | 194 | host_supported: true, |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 195 | |
| 196 | srcs: [ |
| 197 | "BitSet_test.cpp", |
| 198 | "FileMap_test.cpp", |
| 199 | "LruCache_test.cpp", |
| 200 | "Mutex_test.cpp", |
| 201 | "SharedBuffer_test.cpp", |
Elliott Hughes | 01705e4 | 2019-02-07 12:41:37 -0800 | [diff] [blame] | 202 | "String8_test.cpp", |
| 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 | } |