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
15cc_library_headers {
16    name: "jni_headers",
17    host_supported: true,
18    export_include_dirs: ["include_jni"],
19    vendor_available: true,
20    target: {
21        windows: {
22            enabled: true,
23        },
24    },
25    // The minimum sdk version required by users of this module.
26    sdk_version: "minimum",
27    // As part of mainline modules(APEX), it should support at least 29(Q)
28    min_sdk_version: "29",
29}
30
31cc_library_headers {
32    name: "libnativehelper_header_only",
33    host_supported: true,
34    export_include_dirs: ["header_only_include"],
35    target: {
36        windows: {
37            enabled: true,
38        },
39    },
40    sdk_version: "current",
41    // As part of mainline modules(APEX), it should support at least 29(Q)
42    min_sdk_version: "29",
43
44    apex_available: [
45        "//apex_available:platform",
46        "//apex_available:anyapex",
47    ],
48}
49
50cc_library_headers {
51    name: "jni_platform_headers",
52    host_supported: true,
53    export_include_dirs: ["platform_include"],
54    target: {
55        windows: {
56            enabled: true,
57        },
58    },
59
60    apex_available: [
61        "//apex_available:platform",
62        "com.android.art.debug",
63        "com.android.art.release",
64    ],
65}
66
67cc_library {
68    name: "libnativehelper",
69    host_supported: true,
70    srcs: [
71        "JNIHelp.cpp",
72        "JniConstants.cpp",
73        "JniInvocation.cpp",
74        "toStringArray.cpp",
75    ],
76    shared_libs: ["liblog"],
77    cflags: [
78        "-Werror",
79        "-fvisibility=protected",
80    ],
81    export_include_dirs: [
82        "include",
83        "header_only_include",
84        "platform_include",
85    ],
86    stubs: {
87        symbol_file: "libnativehelper.map.txt",
88        versions: ["1"],
89    },
90    target: {
91        windows: {
92            shared_libs: ["libbase"],
93            enabled: true,
94        },
95    },
96    // Please avoid adding APEX dependencies on this for R (b/157711673).
97    apex_available: [
98        "com.android.art.release",
99        "com.android.art.debug",
100        // b/133140750 Clean this up. This is due to the dependency from libplatform_library_jni,
101        // librs_jni, libjni_legacymosaic, etc.
102        "//apex_available:platform",
103        // b/133140750 Clean this up, or allow this library to everywhere
104        "com.android.bluetooth.updatable",
105    ],
106}
107
108//
109// NDK-only build for the target (device), using libc++.
110// - Relies only on NDK exposed functionality.
111// - This doesn't include JniInvocation.
112//
113
114cc_library_shared {
115    name: "libnativehelper_compat_libc++",
116    export_include_dirs: [
117        "header_only_include",
118        "include",
119    ],
120    cflags: ["-Werror"],
121    local_include_dirs: [
122        "header_only_include",
123        "platform_include",
124    ],
125    srcs: [
126        "JNIHelp.cpp",
127        "JniConstants.cpp",
128        "toStringArray.cpp",
129    ],
130    shared_libs: [
131        "liblog",
132    ],
133    sdk_version: "19",
134    stl: "c++_static",
135}
136
137ndk_headers {
138    name: "ndk_jni.h",
139    from: "include_jni",
140    to: "",
141    srcs: ["include_jni/jni.h"],
142    license: "NOTICE",
143}
144
145//
146// Tests.
147//
148
149subdirs = ["tests"]
150