1/*
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
17// TODO(b/31559095): bionic on host should define this
18package {
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
35cc_defaults {
36    name: "libbinder_ndk_host_user",
37    target: {
38        host: {
39            cflags: [
40                "-D__INTRODUCED_IN(n)=",
41                "-D__assert(a,b,c)=",
42                // We want all the APIs to be available on the host.
43                "-D__ANDROID_API__=10000",
44            ],
45        },
46        darwin: {
47            enabled: false,
48        },
49    },
50}
51
52cc_library {
53    name: "libbinder_ndk",
54
55    defaults: ["libbinder_ndk_host_user"],
56    host_supported: true,
57
58    llndk: {
59        symbol_file: "libbinder_ndk.map.txt",
60    },
61
62    export_include_dirs: [
63        "include_cpp",
64        "include_ndk",
65        "include_platform",
66    ],
67
68    cflags: [
69        "-Wall",
70        "-Wextra",
71        "-Werror",
72    ],
73
74    srcs: [
75        "ibinder.cpp",
76        "ibinder_jni.cpp",
77        "parcel.cpp",
78        "parcel_jni.cpp",
79        "process.cpp",
80        "stability.cpp",
81        "status.cpp",
82        "service_manager.cpp",
83    ],
84
85    shared_libs: [
86        "libandroid_runtime_lazy",
87        "libbase",
88        "libbinder",
89        "libutils",
90    ],
91
92    header_libs: [
93        "jni_headers",
94    ],
95    export_header_lib_headers: [
96        "jni_headers",
97    ],
98
99    target: {
100        android: {
101            // Only one copy of this library on an Android device
102            static: {
103                enabled: false,
104            },
105        },
106        linux: {
107            version_script: "libbinder_ndk.map.txt",
108        },
109        darwin: {
110            enabled: false,
111        },
112    },
113    stubs: {
114        symbol_file: "libbinder_ndk.map.txt",
115        versions: [
116            "29",
117            "30",
118        ],
119    },
120    tidy: true,
121    tidy_flags: [
122        // Only check our headers
123        "--header-filter=^.*frameworks/native/libs/binder/.*.h$",
124    ],
125    tidy_checks_as_errors: [
126        // Explicitly list the checks that should not occur in this module.
127        "abseil-*",
128        "android-*",
129        "bugprone-*",
130        "cert-*",
131        "clang-analyzer-*",
132        "-clang-analyzer-core.CallAndMessage",
133        "-clang-analyzer-core.uninitialized.Assign",
134        "-clang-analyzer-unix.Malloc",
135        "-clang-analyzer-deadcode.DeadStores",
136        "-clang-analyzer-optin.cplusplus.UninitializedObject",
137        "google-*",
138        "-google-readability-*",
139        "-google-runtime-references",
140        "misc-*",
141        "-misc-no-recursion",
142        "-misc-non-private-member-variables-in-classes",
143        "-misc-redundant-expression",
144        "-misc-unused-parameters",
145        "-misc-unused-using-decls",
146        "performance*",
147        "portability*",
148    ],
149}
150
151cc_library_headers {
152    name: "libbinder_headers_platform_shared",
153    export_include_dirs: ["include_cpp"],
154    vendor_available: true,
155    host_supported: true,
156    // TODO(b/153609531): remove when no longer needed.
157    native_bridge_supported: true,
158    target: {
159        darwin: {
160            enabled: false,
161        },
162    },
163    apex_available: [
164        "//apex_available:platform",
165        "com.android.media",
166        "com.android.media.swcodec",
167    ],
168    min_sdk_version: "29",
169}
170
171ndk_headers {
172    name: "libbinder_ndk_headers",
173    from: "include_ndk/android",
174    to: "android",
175    srcs: [
176        "include_ndk/android/*.h",
177    ],
178    license: "NOTICE",
179}
180
181// TODO(b/160624671): package with the aidl compiler
182ndk_headers {
183    name: "libbinder_ndk_helper_headers",
184    from: "include_cpp/android",
185    to: "android",
186    srcs: [
187        "include_cpp/android/*.h",
188    ],
189    license: "NOTICE",
190}
191
192ndk_library {
193    name: "libbinder_ndk",
194    symbol_file: "libbinder_ndk.map.txt",
195    first_version: "29",
196}
197