blob: 524ff651698b9b96b7cb64c1ad83c335cc81672a [file] [log] [blame]
Colin Crosscaaeb282016-07-11 14:15:31 -07001//
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
Chih-Hung Hsieh6f36fb02017-10-02 15:20:07 -070017cc_defaults {
Andreas Gampeed917072018-02-15 11:40:30 -080018 name: "libbase_cflags_defaults",
Elliott Hughesa72e3f62018-02-16 17:58:14 -080019 cflags: [
20 "-Wall",
21 "-Werror",
22 "-Wextra",
23 ],
Paul Crowleyd47a8d72019-09-11 15:31:55 -070024 target: {
25 android: {
26 cflags: [
27 "-D_FILE_OFFSET_BITS=64",
28 ],
29 },
30 },
Chih-Hung Hsieh6f36fb02017-10-02 15:20:07 -070031}
Colin Crosscaaeb282016-07-11 14:15:31 -070032
Steven Morelanda347b772017-04-14 00:54:46 -070033cc_library_headers {
34 name: "libbase_headers",
35 vendor_available: true,
Justin Yun43e23542020-11-11 19:21:37 +090036 product_available: true,
Yifan Hong5afe8b72020-01-21 18:17:19 -080037 ramdisk_available: true,
Yifan Hong9091f312020-10-21 18:22:17 -070038 vendor_ramdisk_available: true,
Jiyong Parkb51bddd2018-04-27 21:48:43 +090039 recovery_available: true,
Steven Morelanda347b772017-04-14 00:54:46 -070040 host_supported: true,
dimitry3b9b11e2019-05-06 14:01:58 +020041 native_bridge_supported: true,
Steven Morelanda347b772017-04-14 00:54:46 -070042 export_include_dirs: ["include"],
43
Steven Morelanda347b772017-04-14 00:54:46 -070044 target: {
45 linux_bionic: {
46 enabled: true,
47 },
48 windows: {
49 enabled: true,
50 },
51 },
Jiyong Park2c7409d2020-03-07 16:36:09 +090052 apex_available: [
53 "//apex_available:anyapex",
54 "//apex_available:platform",
55 ],
Jooyung Hance659962020-04-16 18:48:33 +090056 min_sdk_version: "29",
Steven Morelanda347b772017-04-14 00:54:46 -070057}
58
Andreas Gampeed917072018-02-15 11:40:30 -080059cc_defaults {
60 name: "libbase_defaults",
61 defaults: ["libbase_cflags_defaults"],
Colin Crosscaaeb282016-07-11 14:15:31 -070062 srcs: [
Josh Gaoe4401992019-04-25 14:04:57 -070063 "abi_compatibility.cpp",
Mark Salyzyn764a9c72018-02-05 07:41:31 -080064 "chrono_utils.cpp",
Josh Gaoc50f38f2019-01-07 19:16:21 -080065 "cmsg.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -070066 "file.cpp",
Tom Cherry1bfa8ab2020-01-08 14:47:42 -080067 "liblog_symbols.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -070068 "logging.cpp",
Elliott Hughes51140082018-10-19 16:09:39 -070069 "mapped_file.cpp",
Daniel Colascione57fceb92019-11-14 00:48:36 -080070 "parsebool.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -070071 "parsenetaddress.cpp",
Tom Cherry3f82dfb2019-06-28 11:09:33 -070072 "process.cpp",
Elliott Hughes083c2fe2018-05-24 18:00:39 -070073 "properties.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -070074 "stringprintf.cpp",
75 "strings.cpp",
Josh Gaoef102be2018-03-16 14:25:42 -070076 "threads.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -070077 "test_utils.cpp",
78 ],
Steven Morelanda347b772017-04-14 00:54:46 -070079
Pirama Arumuga Nainar00b10a82018-09-26 23:31:00 -070080 cppflags: ["-Wexit-time-destructors"],
Colin Crosscaaeb282016-07-11 14:15:31 -070081 shared_libs: ["liblog"],
82 target: {
83 android: {
Elliott Hughes83b00972017-02-14 15:46:33 -080084 sanitize: {
85 misc_undefined: ["integer"],
86 },
James Hawkins99574972017-03-24 11:43:02 -070087
Colin Crosscaaeb282016-07-11 14:15:31 -070088 },
Dan Willemsen2cb672f2017-10-03 14:17:31 -070089 linux: {
90 srcs: [
Dan Willemsen2cb672f2017-10-03 14:17:31 -070091 "errors_unix.cpp",
92 ],
Dan Willemsen2cb672f2017-10-03 14:17:31 -070093 },
Colin Crosscaaeb282016-07-11 14:15:31 -070094 darwin: {
James Hawkins99574972017-03-24 11:43:02 -070095 srcs: [
James Hawkins99574972017-03-24 11:43:02 -070096 "errors_unix.cpp",
97 ],
Colin Crosscaaeb282016-07-11 14:15:31 -070098 },
Dan Willemsen15acb592016-11-29 13:32:55 -080099 linux_bionic: {
Dan Willemsen15acb592016-11-29 13:32:55 -0800100 enabled: true,
101 },
Colin Crosscaaeb282016-07-11 14:15:31 -0700102 windows: {
103 srcs: [
104 "errors_windows.cpp",
105 "utf8.cpp",
106 ],
Josh Gaoc50f38f2019-01-07 19:16:21 -0800107 exclude_srcs: [
108 "cmsg.cpp",
109 ],
Colin Crosscaaeb282016-07-11 14:15:31 -0700110 enabled: true,
111 },
112 },
Nikita Ioffe9ac27c72020-10-28 00:44:53 +0000113 min_sdk_version: "29",
Colin Crosscaaeb282016-07-11 14:15:31 -0700114}
115
Andreas Gampeed917072018-02-15 11:40:30 -0800116cc_library {
117 name: "libbase",
118 defaults: ["libbase_defaults"],
119 vendor_available: true,
Justin Yun43e23542020-11-11 19:21:37 +0900120 product_available: true,
Yifan Hong5afe8b72020-01-21 18:17:19 -0800121 ramdisk_available: true,
Yifan Hong9091f312020-10-21 18:22:17 -0700122 vendor_ramdisk_available: true,
Jiyong Park9670f162018-05-24 14:11:00 +0900123 recovery_available: true,
Andreas Gampeed917072018-02-15 11:40:30 -0800124 host_supported: true,
dimitry3b9b11e2019-05-06 14:01:58 +0200125 native_bridge_supported: true,
Andreas Gampeed917072018-02-15 11:40:30 -0800126 vndk: {
127 enabled: true,
128 support_system_process: true,
129 },
130 header_libs: [
131 "libbase_headers",
132 ],
133 export_header_lib_headers: ["libbase_headers"],
Jiyong Park4e223e62019-06-12 16:25:04 +0900134 static_libs: ["fmtlib"],
135 whole_static_libs: ["fmtlib"],
136 export_static_lib_headers: ["fmtlib"],
Jeffrey Huang728e33b2020-02-14 10:27:17 -0800137 apex_available: [
138 "//apex_available:anyapex",
139 "//apex_available:platform",
140 ],
Andreas Gampeed917072018-02-15 11:40:30 -0800141}
142
143cc_library_static {
144 name: "libbase_ndk",
145 defaults: ["libbase_defaults"],
146 sdk_version: "current",
147 stl: "c++_static",
148 export_include_dirs: ["include"],
Jiyong Park4e223e62019-06-12 16:25:04 +0900149 static_libs: ["fmtlib_ndk"],
150 whole_static_libs: ["fmtlib_ndk"],
151 export_static_lib_headers: ["fmtlib_ndk"],
Andreas Gampeed917072018-02-15 11:40:30 -0800152}
153
Colin Crosscaaeb282016-07-11 14:15:31 -0700154// Tests
155// ------------------------------------------------------------------------------
156cc_test {
157 name: "libbase_test",
Andreas Gampeed917072018-02-15 11:40:30 -0800158 defaults: ["libbase_cflags_defaults"],
Colin Crosscaaeb282016-07-11 14:15:31 -0700159 host_supported: true,
Tom Cherryaa817612020-07-14 11:23:39 -0700160 require_root: true,
Colin Crosscaaeb282016-07-11 14:15:31 -0700161 srcs: [
Josh Gaoc50f38f2019-01-07 19:16:21 -0800162 "cmsg_test.cpp",
Elliott Hughes08baa862017-02-24 14:02:05 -0800163 "endian_test.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -0700164 "errors_test.cpp",
Jiyong Parkde84d4a2019-05-15 19:17:48 +0900165 "expected_test.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -0700166 "file_test.cpp",
Tom Cherrya6872422020-04-17 13:05:11 -0700167 "logging_splitters_test.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -0700168 "logging_test.cpp",
Elliott Hughesda37d812018-04-06 17:45:22 -0700169 "macros_test.cpp",
Elliott Hughes51140082018-10-19 16:09:39 -0700170 "mapped_file_test.cpp",
Josh Gao916ea5e2019-11-14 17:59:57 -0800171 "no_destructor_test.cpp",
Yabin Cuiebe8eef2016-10-05 10:54:35 -0700172 "parsedouble_test.cpp",
Daniel Colascione57fceb92019-11-14 00:48:36 -0800173 "parsebool_test.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -0700174 "parseint_test.cpp",
175 "parsenetaddress_test.cpp",
Tom Cherry3f82dfb2019-06-28 11:09:33 -0700176 "process_test.cpp",
Elliott Hughes083c2fe2018-05-24 18:00:39 -0700177 "properties_test.cpp",
Jiyong Parkab7dc5a2019-05-31 03:43:34 +0900178 "result_test.cpp",
Tom Cherry1d273062017-04-05 14:15:31 -0700179 "scopeguard_test.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -0700180 "stringprintf_test.cpp",
181 "strings_test.cpp",
182 "test_main.cpp",
Josh Gao8f1fa002017-04-27 19:48:44 -0700183 "test_utils_test.cpp",
Colin Crosscaaeb282016-07-11 14:15:31 -0700184 ],
185 target: {
Elliott Hughes5a7788c2016-09-21 16:53:15 -0700186 android: {
Elliott Hughes83b00972017-02-14 15:46:33 -0800187 sanitize: {
188 misc_undefined: ["integer"],
189 },
Elliott Hughes5a7788c2016-09-21 16:53:15 -0700190 },
Dan Willemsen2cb672f2017-10-03 14:17:31 -0700191 linux: {
James Hawkins99574972017-03-24 11:43:02 -0700192 srcs: ["chrono_utils_test.cpp"],
James Hawkins99574972017-03-24 11:43:02 -0700193 },
Colin Crosscaaeb282016-07-11 14:15:31 -0700194 windows: {
195 srcs: ["utf8_test.cpp"],
Dan Willemsenb80b3d52017-11-29 18:06:11 -0800196 cflags: ["-Wno-unused-parameter"],
Colin Crosscaaeb282016-07-11 14:15:31 -0700197 enabled: true,
198 },
199 },
200 local_include_dirs: ["."],
Colin Crosscaaeb282016-07-11 14:15:31 -0700201 shared_libs: ["libbase"],
202 compile_multilib: "both",
203 multilib: {
204 lib32: {
205 suffix: "32",
206 },
207 lib64: {
208 suffix: "64",
209 },
210 },
Elliott Hughesefdeefd2018-04-27 16:12:06 -0700211 test_suites: ["device-tests"],
Colin Crosscaaeb282016-07-11 14:15:31 -0700212}
Tom Cherry377d1ad2019-06-14 14:34:54 -0700213
Josh Gao89e50182020-03-09 12:05:32 -0700214cc_test {
215 name: "libbase_tidy_test",
216 defaults: ["libbase_cflags_defaults"],
217 host_supported: true,
218
219 tidy: true,
220 tidy_checks_as_errors: ["bugprone-use-after-move"],
221
222 srcs: [
223 "tidy/unique_fd_test.cpp",
224 "tidy/unique_fd_test2.cpp",
225 ],
226
227 shared_libs: ["libbase"],
228 test_suites: ["device_tests"],
229}
230
Tom Cherry377d1ad2019-06-14 14:34:54 -0700231cc_benchmark {
232 name: "libbase_benchmark",
233 defaults: ["libbase_cflags_defaults"],
234
235 srcs: ["format_benchmark.cpp"],
236 shared_libs: ["libbase"],
237
238 compile_multilib: "both",
239 multilib: {
240 lib32: {
241 suffix: "32",
242 },
243 lib64: {
244 suffix: "64",
245 },
246 },
247}
Branden Archer200349f2020-10-14 10:20:15 -0700248
249cc_fuzz {
250 name: "libbase_parsenetaddress_fuzzer",
251 shared_libs: ["libbase"],
252 host_supported: true,
253 srcs: ["parsenetaddress_fuzzer.cpp"],
254 dictionary: "parsenetaddress_fuzzer.dict",
255
256 fuzz_config: {
257 cc: [
258 "android-bionic@google.com",
259 ],
260 componentid: 128577
261 }
262}