Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2015 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
| 16 | |
Bob Badour | 13ec36b | 2021-02-03 20:08:34 -0800 | [diff] [blame] | 17 | package { |
| 18 | default_applicable_licenses: ["system_libbase_license"], |
| 19 | } |
| 20 | |
| 21 | license { |
| 22 | name: "system_libbase_license", |
| 23 | visibility: [":__subpackages__"], |
| 24 | license_kinds: [ |
| 25 | "SPDX-license-identifier-Apache-2.0", |
| 26 | "SPDX-license-identifier-BSD", |
| 27 | ], |
| 28 | license_text: [ |
| 29 | "NOTICE", |
| 30 | ], |
| 31 | } |
| 32 | |
Chih-Hung Hsieh | 6f36fb0 | 2017-10-02 15:20:07 -0700 | [diff] [blame] | 33 | cc_defaults { |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 34 | name: "libbase_cflags_defaults", |
Elliott Hughes | a72e3f6 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 35 | cflags: [ |
| 36 | "-Wall", |
| 37 | "-Werror", |
| 38 | "-Wextra", |
| 39 | ], |
Paul Crowley | d47a8d7 | 2019-09-11 15:31:55 -0700 | [diff] [blame] | 40 | target: { |
| 41 | android: { |
| 42 | cflags: [ |
| 43 | "-D_FILE_OFFSET_BITS=64", |
| 44 | ], |
| 45 | }, |
| 46 | }, |
Chih-Hung Hsieh | 6f36fb0 | 2017-10-02 15:20:07 -0700 | [diff] [blame] | 47 | } |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 48 | |
Steven Moreland | a347b77 | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 49 | cc_library_headers { |
| 50 | name: "libbase_headers", |
| 51 | vendor_available: true, |
Justin Yun | 43e2354 | 2020-11-11 19:21:37 +0900 | [diff] [blame] | 52 | product_available: true, |
Yifan Hong | 5afe8b7 | 2020-01-21 18:17:19 -0800 | [diff] [blame] | 53 | ramdisk_available: true, |
Yifan Hong | 9091f31 | 2020-10-21 18:22:17 -0700 | [diff] [blame] | 54 | vendor_ramdisk_available: true, |
Jiyong Park | b51bddd | 2018-04-27 21:48:43 +0900 | [diff] [blame] | 55 | recovery_available: true, |
Steven Moreland | a347b77 | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 56 | host_supported: true, |
dimitry | 3b9b11e | 2019-05-06 14:01:58 +0200 | [diff] [blame] | 57 | native_bridge_supported: true, |
Steven Moreland | a347b77 | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 58 | export_include_dirs: ["include"], |
| 59 | |
Jiyong Park | 7706f49 | 2021-12-14 22:33:38 +0900 | [diff] [blame] | 60 | header_libs: ["fmtlib_headers"], |
| 61 | export_header_lib_headers: ["fmtlib_headers"], |
| 62 | |
Steven Moreland | a347b77 | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 63 | target: { |
| 64 | linux_bionic: { |
| 65 | enabled: true, |
| 66 | }, |
| 67 | windows: { |
| 68 | enabled: true, |
| 69 | }, |
| 70 | }, |
Jiyong Park | 2c7409d | 2020-03-07 16:36:09 +0900 | [diff] [blame] | 71 | apex_available: [ |
| 72 | "//apex_available:anyapex", |
| 73 | "//apex_available:platform", |
| 74 | ], |
Jooyung Han | ce65996 | 2020-04-16 18:48:33 +0900 | [diff] [blame] | 75 | min_sdk_version: "29", |
Steven Moreland | a347b77 | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 76 | } |
| 77 | |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 78 | cc_defaults { |
| 79 | name: "libbase_defaults", |
| 80 | defaults: ["libbase_cflags_defaults"], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 81 | srcs: [ |
Josh Gao | e440199 | 2019-04-25 14:04:57 -0700 | [diff] [blame] | 82 | "abi_compatibility.cpp", |
Mark Salyzyn | 764a9c7 | 2018-02-05 07:41:31 -0800 | [diff] [blame] | 83 | "chrono_utils.cpp", |
Josh Gao | c50f38f | 2019-01-07 19:16:21 -0800 | [diff] [blame] | 84 | "cmsg.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 85 | "file.cpp", |
Steven Moreland | a7ec8ba | 2021-07-23 18:10:35 -0700 | [diff] [blame] | 86 | "hex.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 87 | "logging.cpp", |
Elliott Hughes | 5114008 | 2018-10-19 16:09:39 -0700 | [diff] [blame] | 88 | "mapped_file.cpp", |
Daniel Colascione | 57fceb9 | 2019-11-14 00:48:36 -0800 | [diff] [blame] | 89 | "parsebool.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 90 | "parsenetaddress.cpp", |
Colin Cross | 4bea655 | 2021-12-21 13:54:40 -0800 | [diff] [blame] | 91 | "posix_strerror_r.cpp", |
Tom Cherry | 3f82dfb | 2019-06-28 11:09:33 -0700 | [diff] [blame] | 92 | "process.cpp", |
Elliott Hughes | 083c2fe | 2018-05-24 18:00:39 -0700 | [diff] [blame] | 93 | "properties.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 94 | "stringprintf.cpp", |
| 95 | "strings.cpp", |
Josh Gao | ef102be | 2018-03-16 14:25:42 -0700 | [diff] [blame] | 96 | "threads.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 97 | "test_utils.cpp", |
| 98 | ], |
Steven Moreland | a347b77 | 2017-04-14 00:54:46 -0700 | [diff] [blame] | 99 | |
Pirama Arumuga Nainar | 00b10a8 | 2018-09-26 23:31:00 -0700 | [diff] [blame] | 100 | cppflags: ["-Wexit-time-destructors"], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 101 | shared_libs: ["liblog"], |
| 102 | target: { |
| 103 | android: { |
Elliott Hughes | 83b0097 | 2017-02-14 15:46:33 -0800 | [diff] [blame] | 104 | sanitize: { |
| 105 | misc_undefined: ["integer"], |
| 106 | }, |
James Hawkins | 9957497 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 107 | |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 108 | }, |
Dan Willemsen | 2cb672f | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 109 | linux: { |
| 110 | srcs: [ |
Dan Willemsen | 2cb672f | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 111 | "errors_unix.cpp", |
| 112 | ], |
Dan Willemsen | 2cb672f | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 113 | }, |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 114 | darwin: { |
James Hawkins | 9957497 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 115 | srcs: [ |
James Hawkins | 9957497 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 116 | "errors_unix.cpp", |
| 117 | ], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 118 | }, |
Dan Willemsen | 15acb59 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 119 | linux_bionic: { |
Dan Willemsen | 15acb59 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 120 | enabled: true, |
| 121 | }, |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 122 | windows: { |
| 123 | srcs: [ |
| 124 | "errors_windows.cpp", |
| 125 | "utf8.cpp", |
| 126 | ], |
Josh Gao | c50f38f | 2019-01-07 19:16:21 -0800 | [diff] [blame] | 127 | exclude_srcs: [ |
| 128 | "cmsg.cpp", |
| 129 | ], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 130 | enabled: true, |
| 131 | }, |
| 132 | }, |
Nikita Ioffe | 9ac27c7 | 2020-10-28 00:44:53 +0000 | [diff] [blame] | 133 | min_sdk_version: "29", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 134 | } |
| 135 | |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 136 | cc_library { |
| 137 | name: "libbase", |
| 138 | defaults: ["libbase_defaults"], |
| 139 | vendor_available: true, |
Justin Yun | 43e2354 | 2020-11-11 19:21:37 +0900 | [diff] [blame] | 140 | product_available: true, |
Yifan Hong | 5afe8b7 | 2020-01-21 18:17:19 -0800 | [diff] [blame] | 141 | ramdisk_available: true, |
Yifan Hong | 9091f31 | 2020-10-21 18:22:17 -0700 | [diff] [blame] | 142 | vendor_ramdisk_available: true, |
Jiyong Park | 9670f16 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 143 | recovery_available: true, |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 144 | host_supported: true, |
dimitry | 3b9b11e | 2019-05-06 14:01:58 +0200 | [diff] [blame] | 145 | native_bridge_supported: true, |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 146 | vndk: { |
| 147 | enabled: true, |
| 148 | support_system_process: true, |
| 149 | }, |
| 150 | header_libs: [ |
| 151 | "libbase_headers", |
| 152 | ], |
| 153 | export_header_lib_headers: ["libbase_headers"], |
Jiyong Park | 4e223e6 | 2019-06-12 16:25:04 +0900 | [diff] [blame] | 154 | whole_static_libs: ["fmtlib"], |
Jiyong Park | 7706f49 | 2021-12-14 22:33:38 +0900 | [diff] [blame] | 155 | export_static_lib_headers: ["fmtlib"], |
Jeffrey Huang | 728e33b | 2020-02-14 10:27:17 -0800 | [diff] [blame] | 156 | apex_available: [ |
| 157 | "//apex_available:anyapex", |
| 158 | "//apex_available:platform", |
| 159 | ], |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | cc_library_static { |
| 163 | name: "libbase_ndk", |
| 164 | defaults: ["libbase_defaults"], |
| 165 | sdk_version: "current", |
| 166 | stl: "c++_static", |
| 167 | export_include_dirs: ["include"], |
Jiyong Park | 4e223e6 | 2019-06-12 16:25:04 +0900 | [diff] [blame] | 168 | whole_static_libs: ["fmtlib_ndk"], |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 169 | } |
| 170 | |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 171 | // Tests |
| 172 | // ------------------------------------------------------------------------------ |
| 173 | cc_test { |
| 174 | name: "libbase_test", |
Andreas Gampe | ed91707 | 2018-02-15 11:40:30 -0800 | [diff] [blame] | 175 | defaults: ["libbase_cflags_defaults"], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 176 | host_supported: true, |
Tom Cherry | aa81761 | 2020-07-14 11:23:39 -0700 | [diff] [blame] | 177 | require_root: true, |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 178 | srcs: [ |
Josh Gao | c50f38f | 2019-01-07 19:16:21 -0800 | [diff] [blame] | 179 | "cmsg_test.cpp", |
Elliott Hughes | 08baa86 | 2017-02-24 14:02:05 -0800 | [diff] [blame] | 180 | "endian_test.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 181 | "errors_test.cpp", |
Jiyong Park | de84d4a | 2019-05-15 19:17:48 +0900 | [diff] [blame] | 182 | "expected_test.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 183 | "file_test.cpp", |
Yurii Zubrytskyi | 68ce05e | 2021-02-19 00:07:31 -0800 | [diff] [blame] | 184 | "function_ref_test.cpp", |
Steven Moreland | a7ec8ba | 2021-07-23 18:10:35 -0700 | [diff] [blame] | 185 | "hex_test.cpp", |
Tom Cherry | a687242 | 2020-04-17 13:05:11 -0700 | [diff] [blame] | 186 | "logging_splitters_test.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 187 | "logging_test.cpp", |
Elliott Hughes | da37d81 | 2018-04-06 17:45:22 -0700 | [diff] [blame] | 188 | "macros_test.cpp", |
Elliott Hughes | 5114008 | 2018-10-19 16:09:39 -0700 | [diff] [blame] | 189 | "mapped_file_test.cpp", |
Josh Gao | 916ea5e | 2019-11-14 17:59:57 -0800 | [diff] [blame] | 190 | "no_destructor_test.cpp", |
Yabin Cui | ebe8eef | 2016-10-05 10:54:35 -0700 | [diff] [blame] | 191 | "parsedouble_test.cpp", |
Daniel Colascione | 57fceb9 | 2019-11-14 00:48:36 -0800 | [diff] [blame] | 192 | "parsebool_test.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 193 | "parseint_test.cpp", |
| 194 | "parsenetaddress_test.cpp", |
Tom Cherry | 3f82dfb | 2019-06-28 11:09:33 -0700 | [diff] [blame] | 195 | "process_test.cpp", |
Elliott Hughes | 083c2fe | 2018-05-24 18:00:39 -0700 | [diff] [blame] | 196 | "properties_test.cpp", |
Jiyong Park | ab7dc5a | 2019-05-31 03:43:34 +0900 | [diff] [blame] | 197 | "result_test.cpp", |
Tom Cherry | 1d27306 | 2017-04-05 14:15:31 -0700 | [diff] [blame] | 198 | "scopeguard_test.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 199 | "stringprintf_test.cpp", |
| 200 | "strings_test.cpp", |
| 201 | "test_main.cpp", |
Josh Gao | 8f1fa00 | 2017-04-27 19:48:44 -0700 | [diff] [blame] | 202 | "test_utils_test.cpp", |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 203 | ], |
| 204 | target: { |
Elliott Hughes | 5a7788c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 205 | android: { |
Elliott Hughes | 83b0097 | 2017-02-14 15:46:33 -0800 | [diff] [blame] | 206 | sanitize: { |
| 207 | misc_undefined: ["integer"], |
| 208 | }, |
Elliott Hughes | 5a7788c | 2016-09-21 16:53:15 -0700 | [diff] [blame] | 209 | }, |
Dan Willemsen | 2cb672f | 2017-10-03 14:17:31 -0700 | [diff] [blame] | 210 | linux: { |
James Hawkins | 9957497 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 211 | srcs: ["chrono_utils_test.cpp"], |
James Hawkins | 9957497 | 2017-03-24 11:43:02 -0700 | [diff] [blame] | 212 | }, |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 213 | windows: { |
| 214 | srcs: ["utf8_test.cpp"], |
Dan Willemsen | b80b3d5 | 2017-11-29 18:06:11 -0800 | [diff] [blame] | 215 | cflags: ["-Wno-unused-parameter"], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 216 | enabled: true, |
| 217 | }, |
| 218 | }, |
| 219 | local_include_dirs: ["."], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 220 | shared_libs: ["libbase"], |
Yifan Hong | f21c546 | 2021-05-21 18:43:16 -0700 | [diff] [blame] | 221 | static_libs: ["libgmock"], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 222 | compile_multilib: "both", |
| 223 | multilib: { |
| 224 | lib32: { |
| 225 | suffix: "32", |
| 226 | }, |
| 227 | lib64: { |
| 228 | suffix: "64", |
| 229 | }, |
| 230 | }, |
Elliott Hughes | efdeefd | 2018-04-27 16:12:06 -0700 | [diff] [blame] | 231 | test_suites: ["device-tests"], |
Colin Cross | caaeb28 | 2016-07-11 14:15:31 -0700 | [diff] [blame] | 232 | } |
Tom Cherry | 377d1ad | 2019-06-14 14:34:54 -0700 | [diff] [blame] | 233 | |
Josh Gao | 89e5018 | 2020-03-09 12:05:32 -0700 | [diff] [blame] | 234 | cc_test { |
| 235 | name: "libbase_tidy_test", |
| 236 | defaults: ["libbase_cflags_defaults"], |
| 237 | host_supported: true, |
| 238 | |
| 239 | tidy: true, |
| 240 | tidy_checks_as_errors: ["bugprone-use-after-move"], |
| 241 | |
| 242 | srcs: [ |
| 243 | "tidy/unique_fd_test.cpp", |
| 244 | "tidy/unique_fd_test2.cpp", |
| 245 | ], |
| 246 | |
| 247 | shared_libs: ["libbase"], |
| 248 | test_suites: ["device_tests"], |
| 249 | } |
| 250 | |
Tom Cherry | 377d1ad | 2019-06-14 14:34:54 -0700 | [diff] [blame] | 251 | cc_benchmark { |
| 252 | name: "libbase_benchmark", |
| 253 | defaults: ["libbase_cflags_defaults"], |
| 254 | |
| 255 | srcs: ["format_benchmark.cpp"], |
| 256 | shared_libs: ["libbase"], |
| 257 | |
| 258 | compile_multilib: "both", |
| 259 | multilib: { |
| 260 | lib32: { |
| 261 | suffix: "32", |
| 262 | }, |
| 263 | lib64: { |
| 264 | suffix: "64", |
| 265 | }, |
| 266 | }, |
| 267 | } |
Branden Archer | 200349f | 2020-10-14 10:20:15 -0700 | [diff] [blame] | 268 | |
| 269 | cc_fuzz { |
| 270 | name: "libbase_parsenetaddress_fuzzer", |
| 271 | shared_libs: ["libbase"], |
| 272 | host_supported: true, |
| 273 | srcs: ["parsenetaddress_fuzzer.cpp"], |
| 274 | dictionary: "parsenetaddress_fuzzer.dict", |
| 275 | |
| 276 | fuzz_config: { |
| 277 | cc: [ |
| 278 | "android-bionic@google.com", |
| 279 | ], |
| 280 | componentid: 128577 |
| 281 | } |
| 282 | } |