• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2009 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_applicable_licenses: ["libnativehelper_license"],
17}
18
19// Added automatically by a large-scale-change
20// http://go/android-license-faq
21license {
22    name: "libnativehelper_license",
23    visibility: [":__subpackages__"],
24    license_kinds: [
25        "SPDX-license-identifier-Apache-2.0",
26    ],
27    license_text: [
28        "NOTICE",
29    ],
30}
31
32cc_defaults {
33    name: "libnativehelper_defaults",
34    cflags: [
35        "-fvisibility=protected",
36        "-std=c11",
37    ],
38    shared_libs: ["liblog"],
39}
40
41cc_library_headers {
42    name: "jni_headers",
43    host_supported: true,
44    export_include_dirs: ["include_jni"],
45    native_bridge_supported: true,
46    vendor_available: true,
47    target: {
48        windows: {
49            enabled: true,
50        },
51    },
52    apex_available: [
53        "//apex_available:platform",
54        "//apex_available:anyapex",
55    ],
56    // recovery_available currently required for libchrome (https://r.android.com/799940).
57    recovery_available: true,
58    visibility: ["//visibility:public"],
59    stl: "none",
60    system_shared_libs: [],
61    // The minimum sdk version required by users of this module.
62    sdk_version: "minimum",
63    // As part of mainline modules(APEX), it should support at least 29(Q)
64    min_sdk_version: "29",
65}
66
67cc_library_headers {
68    name: "libnativehelper_header_only",
69    host_supported: true,
70    export_include_dirs: [
71        "header_only_include",
72    ],
73    header_libs: ["jni_headers"],
74    export_header_lib_headers: ["jni_headers"],
75    // As part of mainline modules(APEX), it should support at least 29(Q)
76    min_sdk_version: "29",
77    sdk_version: "minimum",
78    apex_available: [
79        "//apex_available:platform",
80        "//apex_available:anyapex",
81    ],
82}
83
84cc_library_headers {
85    name: "jni_platform_headers",
86    host_supported: true,
87    export_include_dirs: [
88        "include_platform_header_only",
89    ],
90    header_libs: ["jni_headers"],
91    export_header_lib_headers: ["jni_headers"],
92    sdk_version: "minimum",
93    apex_available: [
94        "//apex_available:platform",
95        "com.android.art",
96        "com.android.art.debug",
97    ],
98    min_sdk_version: "S",
99}
100
101cc_library_shared {
102    name: "libnativehelper",
103    defaults: ["libnativehelper_defaults"],
104    bootstrap: false,
105    host_supported: true,
106    srcs: [
107        "DlHelp.c",
108        "ExpandableString.c",
109        "JNIHelp.c",
110        "JNIPlatformHelp.c",
111        "JniConstants.c",
112        "JniInvocation.c",
113        "file_descriptor_jni.c",
114    ],
115    export_include_dirs: [
116        "header_only_include",
117        "include",
118        "include_jni",
119        "include_platform",
120        "include_platform_header_only",
121    ],
122    stl: "none",
123    stubs: {
124        symbol_file: "libnativehelper.map.txt",
125        versions: ["S"],
126    },
127    // Only distributed in the ART Module.
128    apex_available: [
129        "com.android.art",
130        "com.android.art.debug",
131    ],
132    min_sdk_version: "S",
133}
134
135// Lazy loading version of libnativehelper that can be used by code
136// that is running before the ART APEX is mounted and
137// libnativehelper.so is available.
138cc_library_static {
139    name: "libnativehelper_lazy",
140    defaults: ["libnativehelper_defaults"],
141    bootstrap: true,
142    host_supported: true,
143    export_include_dirs: [
144        "header_only_include",
145        "include",
146        "include_jni",
147        "include_platform",
148        "include_platform_header_only",
149    ],
150    apex_available: ["//apex_available:platform"],
151    srcs: ["libnativehelper_lazy.c"],
152    target: {
153        linux: {
154            version_script: "libnativehelper.map.txt",
155        },
156    },
157}
158
159//
160// NDK-only build for the target (device), using libc++.
161// - Relies only on NDK exposed functionality.
162// - This doesn't include JniInvocation.
163//
164
165cc_library {
166    name: "libnativehelper_compat_libc++",
167    defaults: ["libnativehelper_defaults"],
168    header_libs: ["jni_headers"],
169    cflags: ["-Werror"],
170    export_header_lib_headers: ["jni_headers"],
171    export_include_dirs: [
172        "header_only_include",
173        "include",
174    ],
175    host_supported: true,
176    local_include_dirs: [
177        "header_only_include",
178        "include_platform_header_only",
179    ],
180    srcs: [
181        "ExpandableString.c",
182        "JNIHelp.c",
183    ],
184    min_sdk_version: "29",
185    sdk_version: "19",
186    stl: "none",
187    apex_available: [
188        "//apex_available:platform",
189        "com.android.art",
190        "com.android.art.debug",
191        "com.android.extservices",
192        "com.android.tethering",
193    ],
194    visibility: [
195        "//art:__subpackages__",
196        "//cts:__subpackages__",
197        "//external/perfetto:__subpackages__",
198        "//frameworks/base/packages/Connectivity/tests/integration:__pkg__",
199        "//frameworks/base/packages/Tethering:__subpackages__",
200        "//libcore:__subpackages__",
201        "//packages/modules/Connectivity/tests:__subpackages__",
202        "//packages/modules/Connectivity/Tethering:__subpackages__",
203        "//packages/modules/ExtServices:__subpackages__",
204        "//packages/modules/NetworkStack:__subpackages__",
205        ":__subpackages__",
206    ],
207}
208
209// The NDK module definitions reside in
210// system/extras/module_ndk_libs/libnativehelper in platform, with copies of
211// these headers and map.txt. Any changes here should be synced there and vice
212// versa.
213//
214// TODO(b/170644498): Improve tooling to remove this duplication.
215//
216// ndk_headers {
217//     name: "ndk_jni.h",
218//     from: "include_jni",
219//     to: "",
220//     srcs: ["include_jni/jni.h"],
221//     license: "NOTICE",
222// }
223//
224// ndk_headers {
225//     name: "libnativehelper_ndk_headers",
226//     from: "include",
227//     to: "",
228//     srcs: ["include/android/*.h"],
229//     license: "NOTICE",
230// }
231//
232// ndk_library {
233//     name: "libnativehelper",
234//     symbol_file: "libnativehelper.map.txt",
235//     first_version: "S",
236// }
237
238//
239// Tests.
240//
241
242subdirs = [
243    "tests",
244    "tests_mts",
245]
246