blob: 5f45cb2f07c641fd84b116e8ba6f7b12ef0f9d7c [file] [log] [blame]
Steven Moreland2e87adc2018-08-20 19:47:00 -07001/*
2 * Copyright (C) 2018 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
Steven Morelande8a434d2019-09-20 18:42:35 +000017// TODO(b/31559095): bionic on host should define this
Bob Badour3c538232021-02-12 21:26:48 -080018package {
19 default_applicable_licenses: ["frameworks_native_libs_binder_ndk_license"],
20}
21
22// Added automatically by a large-scale-change
23// See: http://go/android-license-faq
24license {
25 name: "frameworks_native_libs_binder_ndk_license",
26 visibility: [":__subpackages__"],
27 license_kinds: [
28 "SPDX-license-identifier-Apache-2.0",
29 ],
30 license_text: [
31 "NOTICE",
32 ],
33}
34
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -070035cc_defaults {
36 name: "libbinder_ndk_common_defaults",
Steven Morelande8a434d2019-09-20 18:42:35 +000037 host_supported: true,
Yifan Hong70786532021-10-20 21:41:18 -070038 recovery_available: true,
Steven Morelande8a434d2019-09-20 18:42:35 +000039
Steven Moreland2e87adc2018-08-20 19:47:00 -070040 export_include_dirs: [
Steven Moreland34aac102020-07-07 23:24:45 +000041 "include_cpp",
Steven Moreland2e87adc2018-08-20 19:47:00 -070042 "include_ndk",
Steven Moreland6b7ea2a2019-08-08 16:19:21 -070043 "include_platform",
Steven Moreland2e87adc2018-08-20 19:47:00 -070044 ],
45
Steven Morelandb8cfad52019-01-09 13:07:00 -080046 cflags: [
47 "-Wall",
48 "-Wextra",
Andrei Homescu40dbf252024-03-28 21:19:42 +000049 "-Wextra-semi",
Steven Morelandb8cfad52019-01-09 13:07:00 -080050 "-Werror",
51 ],
Steven Moreland763dc4c2018-12-12 11:30:06 -080052
Steven Moreland2e87adc2018-08-20 19:47:00 -070053 srcs: [
Steven Moreland4d5ad492018-09-13 12:49:16 -070054 "ibinder.cpp",
Steven Moreland39fdec92022-08-27 00:27:37 +000055 "libbinder.cpp",
Steven Moreland4d5ad492018-09-13 12:49:16 -070056 "parcel.cpp",
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -070057 "stability.cpp",
58 "status.cpp",
59 ],
60}
61
62cc_library_host_shared {
63 name: "libbinder_ndk_sdk",
64
65 defaults: [
66 "libbinder_ndk_common_defaults",
67 "binder_sdk_defaults",
68 ],
69 cmake_snapshot_supported: true,
70
71 shared_libs: [
72 "libbinder_sdk",
73 "libutils_binder_sdk",
74 ],
75}
76
77cc_library {
78 name: "libbinder_ndk",
79
80 defaults: ["libbinder_ndk_common_defaults"],
81 cmake_snapshot_supported: false,
82
83 llndk: {
84 symbol_file: "libbinder_ndk.map.txt",
85 export_llndk_headers: ["libvendorsupport_llndk_headers"],
86 },
87
88 cflags: [
89 "-DBINDER_WITH_KERNEL_IPC",
90 ],
91
92 srcs: [
93 "ibinder_jni.cpp",
Steven Moreland7c615582020-01-06 16:34:39 -080094 "parcel_jni.cpp",
Devin Moore33ce3302023-10-20 16:53:08 +000095 "persistable_bundle.cpp",
Steven Moreland4d5ad492018-09-13 12:49:16 -070096 "process.cpp",
97 "service_manager.cpp",
Steven Moreland2e87adc2018-08-20 19:47:00 -070098 ],
99
Steven Morelandff325422022-12-22 22:25:47 +0000100 static_libs: [
Jooyung Han1f65e772019-03-07 16:55:04 +0900101 "libandroid_runtime_lazy",
Steven Moreland2e87adc2018-08-20 19:47:00 -0700102 "libbase",
Steven Morelandff325422022-12-22 22:25:47 +0000103 ],
104
105 shared_libs: [
Steven Moreland2e87adc2018-08-20 19:47:00 -0700106 "libbinder",
Steven Morelandff325422022-12-22 22:25:47 +0000107 "liblog",
Steven Moreland2e87adc2018-08-20 19:47:00 -0700108 "libutils",
109 ],
dimitryb2cf95d2018-10-31 14:56:29 +0100110
Steven Morelandf01f7442019-02-11 15:04:13 -0800111 header_libs: [
Devin Mooreeb653ee2024-03-09 00:45:39 +0000112 "libvendorsupport_llndk_headers",
Steven Morelandf01f7442019-02-11 15:04:13 -0800113 "jni_headers",
114 ],
115 export_header_lib_headers: [
Devin Mooreeb653ee2024-03-09 00:45:39 +0000116 "libvendorsupport_llndk_headers",
Steven Morelandf01f7442019-02-11 15:04:13 -0800117 "jni_headers",
118 ],
119
Steven Morelande8a434d2019-09-20 18:42:35 +0000120 target: {
Steven Moreland28f81422019-10-03 10:40:59 -0700121 android: {
122 // Only one copy of this library on an Android device
123 static: {
124 enabled: false,
125 },
126 },
Steven Morelande8a434d2019-09-20 18:42:35 +0000127 linux: {
128 version_script: "libbinder_ndk.map.txt",
129 },
Yifan Hongf856a982020-10-30 14:51:17 -0700130 darwin: {
131 enabled: false,
132 },
Steven Morelande8a434d2019-09-20 18:42:35 +0000133 },
Dongwon Kangc45ac092018-12-11 21:59:02 +0000134 stubs: {
135 symbol_file: "libbinder_ndk.map.txt",
Steven Morelande8a434d2019-09-20 18:42:35 +0000136 versions: [
137 "29",
138 "30",
139 ],
Dongwon Kangc45ac092018-12-11 21:59:02 +0000140 },
Steven Morelanda7f076e2021-09-08 16:06:18 -0700141 sanitize: {
142 misc_undefined: ["integer"],
143 },
Jiyong Park4f97a8c2020-11-16 18:11:14 +0900144 tidy: true,
145 tidy_flags: [
146 // Only check our headers
147 "--header-filter=^.*frameworks/native/libs/binder/.*.h$",
148 ],
149 tidy_checks_as_errors: [
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800150 // Explicitly list the checks that should not occur in this module.
151 "abseil-*",
152 "android-*",
153 "bugprone-*",
Chih-Hung Hsieh41366b42022-06-09 23:12:22 -0700154 "-bugprone-branch-clone", // b/155034972
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800155 "cert-*",
156 "clang-analyzer-*",
Jiyong Park7ad197b2020-12-16 10:14:10 +0900157 "-clang-analyzer-core.CallAndMessage",
158 "-clang-analyzer-core.uninitialized.Assign",
Jiyong Park21a7de52021-01-12 17:54:27 +0900159 "-clang-analyzer-unix.Malloc",
Jiyong Park7ad197b2020-12-16 10:14:10 +0900160 "-clang-analyzer-deadcode.DeadStores",
161 "-clang-analyzer-optin.cplusplus.UninitializedObject",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800162 "google-*",
163 "-google-readability-*",
164 "-google-runtime-references",
165 "misc-*",
Jiyong Park7ad197b2020-12-16 10:14:10 +0900166 "-misc-no-recursion",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800167 "-misc-non-private-member-variables-in-classes",
Jiyong Park7ad197b2020-12-16 10:14:10 +0900168 "-misc-redundant-expression",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800169 "-misc-unused-parameters",
Jiyong Park7ad197b2020-12-16 10:14:10 +0900170 "-misc-unused-using-decls",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800171 "performance*",
172 "portability*",
Jiyong Park4f97a8c2020-11-16 18:11:14 +0900173 ],
Yi Kong223f81b2023-12-01 00:34:23 +0900174 afdo: true,
Steven Moreland2e87adc2018-08-20 19:47:00 -0700175}
Steven Morelandeb0e9cc2018-08-29 01:52:09 -0700176
Andrei Homescu40dbf252024-03-28 21:19:42 +0000177cc_library {
178 name: "libbinder_ndk_on_trusty_mock",
179 defaults: [
180 "trusty_mock_defaults",
181 ],
182
183 export_include_dirs: [
184 "include_cpp",
185 "include_ndk",
186 "include_platform",
187 ],
188
189 srcs: [
190 "ibinder.cpp",
191 "libbinder.cpp",
192 "parcel.cpp",
193 "stability.cpp",
194 "status.cpp",
195 ],
196
197 shared_libs: [
198 "libbinder_on_trusty_mock",
199 ],
200
201 header_libs: [
202 "libbinder_trusty_ndk_headers",
203 ],
204 export_header_lib_headers: [
205 "libbinder_trusty_ndk_headers",
206 ],
207
208 cflags: [
209 "-Wall",
210 "-Wextra",
211 "-Werror",
212 ],
213
214 visibility: ["//frameworks/native/libs/binder:__subpackages__"],
215}
216
Jooyung Hancaede592021-02-04 10:18:37 +0900217cc_library_headers {
218 name: "libbinder_headers_platform_shared",
219 export_include_dirs: ["include_cpp"],
220 vendor_available: true,
Yifan Hong70786532021-10-20 21:41:18 -0700221 recovery_available: true,
Jooyung Hancaede592021-02-04 10:18:37 +0900222 host_supported: true,
223 // TODO(b/153609531): remove when no longer needed.
224 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700225 cmake_snapshot_supported: true,
Jooyung Hancaede592021-02-04 10:18:37 +0900226 target: {
227 darwin: {
228 enabled: false,
229 },
230 },
Jooyung Hancaede592021-02-04 10:18:37 +0900231 apex_available: [
232 "//apex_available:platform",
Steven Moreland5a410512024-08-28 22:21:40 +0000233 "//apex_available:anyapex",
Jooyung Hancaede592021-02-04 10:18:37 +0900234 "com.android.media",
235 "com.android.media.swcodec",
Jooyung Hancaede592021-02-04 10:18:37 +0900236 ],
Jooyung Han5f6a89a2021-02-05 15:28:58 +0900237 min_sdk_version: "29",
Jooyung Hancaede592021-02-04 10:18:37 +0900238}
239
Steven Moreland5a410512024-08-28 22:21:40 +0000240// TODO: if you try to export libbinder_headers_platform_shared from libbinder_ndk.ndk, it will
241// not select the NDK variant of libbinder_headers_platform_shared and instead, it will error
242// that the NDK can't depend on glibc C++.
243cc_library_headers {
244 name: "libbinder_headers_platform_shared_ndk",
245 export_include_dirs: ["include_cpp"],
246 sdk_version: "29",
247 min_sdk_version: "29",
248 visibility: [":__subpackages__"],
249}
250
Steven Morelandeb0e9cc2018-08-29 01:52:09 -0700251ndk_headers {
252 name: "libbinder_ndk_headers",
253 from: "include_ndk/android",
254 to: "android",
255 srcs: [
256 "include_ndk/android/*.h",
257 ],
258 license: "NOTICE",
259}
260
Steven Moreland5a410512024-08-28 22:21:40 +0000261// include_cpp are packaged in development/build/sdk.atree with the AIDL compiler
Luxin Yange1bbdf42022-02-16 06:40:53 +0000262
Steven Morelandeb0e9cc2018-08-29 01:52:09 -0700263ndk_library {
264 name: "libbinder_ndk",
265 symbol_file: "libbinder_ndk.map.txt",
266 first_version: "29",
Spandan Dase4344ee2022-09-08 21:41:29 +0000267 export_header_libs: [
Steven Moreland5a410512024-08-28 22:21:40 +0000268 // used to be part of the NDK, platform things depend on it
269 "libbinder_headers_platform_shared_ndk",
Spandan Dase4344ee2022-09-08 21:41:29 +0000270 ],
Steven Morelandeb0e9cc2018-08-29 01:52:09 -0700271}