• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17package {
18    default_team: "trendy_team_native_tools_libraries",
19    default_applicable_licenses: ["system_libbase_license"],
20}
21
22license {
23    name: "system_libbase_license",
24    visibility: [":__subpackages__"],
25    license_kinds: [
26        "SPDX-license-identifier-Apache-2.0",
27        "SPDX-license-identifier-BSD",
28    ],
29    license_text: [
30        "NOTICE",
31    ],
32}
33
34cc_defaults {
35    name: "libbase_cflags_defaults",
36    cflags: [
37        "-Wall",
38        "-Werror",
39        "-Wextra",
40    ],
41    target: {
42        android: {
43            cflags: [
44                "-D_FILE_OFFSET_BITS=64",
45            ],
46        },
47        windows: {
48            cflags: [
49                "-D_POSIX_THREAD_SAFE_FUNCTIONS",
50            ],
51        },
52    },
53}
54
55cc_library_headers {
56    name: "libbase_headers",
57    vendor_available: true,
58    product_available: true,
59    ramdisk_available: true,
60    vendor_ramdisk_available: true,
61    recovery_available: true,
62    host_supported: true,
63    native_bridge_supported: true,
64    export_include_dirs: ["include"],
65
66    header_libs: ["fmtlib_headers"],
67    export_header_lib_headers: ["fmtlib_headers"],
68
69    target: {
70        linux_bionic: {
71            enabled: true,
72        },
73        windows: {
74            enabled: true,
75        },
76    },
77    apex_available: [
78        "//apex_available:anyapex",
79        "//apex_available:platform",
80    ],
81    min_sdk_version: "29",
82    sdk_version: "current",
83}
84
85cc_defaults {
86    name: "libbase_defaults",
87    defaults: ["libbase_cflags_defaults"],
88    srcs: [
89        "abi_compatibility.cpp",
90        "chrono_utils.cpp",
91        "cmsg.cpp",
92        "file.cpp",
93        "hex.cpp",
94        "logging.cpp",
95        "mapped_file.cpp",
96        "parsebool.cpp",
97        "parsenetaddress.cpp",
98        "posix_strerror_r.cpp",
99        "process.cpp",
100        "properties.cpp",
101        "result.cpp",
102        "stringprintf.cpp",
103        "strings.cpp",
104        "threads.cpp",
105        "test_utils.cpp",
106    ],
107
108    cppflags: ["-Wexit-time-destructors"],
109    shared_libs: ["liblog"],
110    target: {
111        android: {
112            sanitize: {
113                misc_undefined: ["integer"],
114            },
115
116        },
117        linux: {
118            srcs: [
119                "errors_unix.cpp",
120            ],
121        },
122        darwin: {
123            srcs: [
124                "errors_unix.cpp",
125            ],
126        },
127        linux_bionic: {
128            enabled: true,
129        },
130        windows: {
131            srcs: [
132                "errors_windows.cpp",
133                "utf8.cpp",
134            ],
135            exclude_srcs: [
136                "cmsg.cpp",
137            ],
138            enabled: true,
139        },
140    },
141    min_sdk_version: "29",
142}
143
144cc_library {
145    name: "libbase",
146    defaults: ["libbase_defaults"],
147    vendor_available: true,
148    product_available: true,
149    ramdisk_available: true,
150    vendor_ramdisk_available: true,
151    recovery_available: true,
152    host_supported: true,
153    native_bridge_supported: true,
154    double_loadable: true,
155    header_libs: [
156        "libbase_headers",
157    ],
158    export_header_lib_headers: ["libbase_headers"],
159    whole_static_libs: ["fmtlib"],
160    export_static_lib_headers: ["fmtlib"],
161    apex_available: [
162        "//apex_available:anyapex",
163        "//apex_available:platform",
164    ],
165}
166
167cc_library_static {
168    name: "libbase_ndk",
169    defaults: ["libbase_defaults"],
170    sdk_version: "current",
171    stl: "c++_static",
172    export_include_dirs: ["include"],
173    whole_static_libs: ["fmtlib_ndk"],
174    apex_available: [
175        "//apex_available:platform",
176        "com.android.media",
177        "com.android.mediaprovider",
178    ],
179}
180
181// Tests
182// ------------------------------------------------------------------------------
183cc_test {
184    name: "libbase_test",
185    defaults: ["libbase_cflags_defaults"],
186    host_supported: true,
187    require_root: true,
188    srcs: [
189        "cmsg_test.cpp",
190        "endian_test.cpp",
191        "errors_test.cpp",
192        "expected_test.cpp",
193        "file_test.cpp",
194        "function_ref_test.cpp",
195        "hex_test.cpp",
196        "logging_splitters_test.cpp",
197        "logging_test.cpp",
198        "macros_test.cpp",
199        "mapped_file_test.cpp",
200        "no_destructor_test.cpp",
201        "parsedouble_test.cpp",
202        "parsebool_test.cpp",
203        "parseint_test.cpp",
204        "parsenetaddress_test.cpp",
205        "process_test.cpp",
206        "properties_test.cpp",
207        "result_test.cpp",
208        "scopeguard_test.cpp",
209        "stringprintf_test.cpp",
210        "strings_test.cpp",
211        "test_main.cpp",
212        "test_utils_test.cpp",
213    ],
214    target: {
215        android: {
216            sanitize: {
217                misc_undefined: ["integer"],
218            },
219        },
220        linux: {
221            srcs: ["chrono_utils_test.cpp"],
222        },
223        windows: {
224            srcs: ["utf8_test.cpp"],
225            cflags: ["-Wno-unused-parameter"],
226            enabled: true,
227        },
228    },
229    local_include_dirs: ["."],
230    shared_libs: ["libbase"],
231    static_libs: ["libgmock"],
232    compile_multilib: "both",
233    multilib: {
234        lib32: {
235            suffix: "32",
236        },
237        lib64: {
238            suffix: "64",
239        },
240    },
241    test_suites: ["device-tests"],
242}
243
244cc_test {
245    name: "libbase_tidy_test",
246    defaults: ["libbase_cflags_defaults"],
247    host_supported: true,
248
249    tidy: true,
250    tidy_checks_as_errors: ["bugprone-use-after-move"],
251
252    srcs: [
253        "tidy/unique_fd_test.cpp",
254        "tidy/unique_fd_test2.cpp",
255    ],
256
257    shared_libs: ["libbase"],
258    test_suites: ["device_tests"],
259}
260
261cc_benchmark {
262    name: "libbase_benchmark",
263    defaults: ["libbase_cflags_defaults"],
264    host_supported: true,
265
266    srcs: [
267        "file_benchmark.cpp",
268        "format_benchmark.cpp",
269        "function_ref_benchmark.cpp",
270    ],
271    shared_libs: ["libbase"],
272
273    compile_multilib: "both",
274    multilib: {
275        lib32: {
276            suffix: "32",
277        },
278        lib64: {
279            suffix: "64",
280        },
281    },
282}
283
284cc_fuzz {
285    name: "libbase_parsenetaddress_fuzzer",
286    shared_libs: ["libbase"],
287    host_supported: true,
288    srcs: ["parsenetaddress_fuzzer.cpp"],
289    dictionary: "parsenetaddress_fuzzer.dict",
290
291    fuzz_config: {
292        cc: [
293            "android-bionic@google.com",
294        ],
295        componentid: 128577,
296    },
297}
298
299dirgroup {
300    name: "trusty_dirgroup_system_libbase",
301    dirs: ["."],
302    visibility: ["//trusty/vendor/google/aosp/scripts"],
303}
304