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 product_available: true, 47 vendor_available: true, 48 target: { 49 windows: { 50 enabled: true, 51 }, 52 }, 53 apex_available: [ 54 "//apex_available:platform", 55 "//apex_available:anyapex", 56 ], 57 ramdisk_available: true, 58 // recovery_available currently required for libchrome (https://r.android.com/799940). 59 recovery_available: true, 60 visibility: ["//visibility:public"], 61 stl: "none", 62 system_shared_libs: [], 63 // The minimum sdk version required by users of this module. 64 sdk_version: "minimum", 65 // As part of mainline modules(APEX), it should support at least 29(Q) 66 min_sdk_version: "29", 67} 68 69cc_library_headers { 70 name: "libnativehelper_header_only", 71 host_supported: true, 72 export_include_dirs: [ 73 "header_only_include", 74 ], 75 header_libs: ["jni_headers"], 76 export_header_lib_headers: ["jni_headers"], 77 // As part of mainline modules(APEX), it should support at least 29(Q) 78 min_sdk_version: "29", 79 sdk_version: "minimum", 80 apex_available: [ 81 "//apex_available:platform", 82 "//apex_available:anyapex", 83 ], 84} 85 86cc_library_headers { 87 name: "jni_platform_headers", 88 host_supported: true, 89 export_include_dirs: [ 90 "include_platform_header_only", 91 ], 92 header_libs: ["jni_headers"], 93 export_header_lib_headers: ["jni_headers"], 94 sdk_version: "minimum", 95 apex_available: [ 96 "//apex_available:platform", 97 "com.android.art", 98 "com.android.art.debug", 99 ], 100 min_sdk_version: "S", 101} 102 103cc_library_shared { 104 name: "libnativehelper", 105 defaults: ["libnativehelper_defaults"], 106 bootstrap: false, 107 host_supported: true, 108 srcs: [ 109 "DlHelp.c", 110 "ExpandableString.c", 111 "JNIHelp.c", 112 "JNIPlatformHelp.c", 113 "JniConstants.c", 114 "JniInvocation.c", 115 "file_descriptor_jni.c", 116 ], 117 export_include_dirs: [ 118 "header_only_include", 119 "include", 120 "include_jni", 121 "include_platform", 122 "include_platform_header_only", 123 ], 124 stl: "none", 125 stubs: { 126 symbol_file: "libnativehelper.map.txt", 127 versions: ["S"], 128 }, 129 // Only distributed in the ART Module. 130 apex_available: [ 131 "com.android.art", 132 "com.android.art.debug", 133 ], 134 min_sdk_version: "S", 135} 136 137// Lazy loading version of libnativehelper that can be used by code 138// that is running before the ART APEX is mounted and 139// libnativehelper.so is available. 140cc_library_static { 141 name: "libnativehelper_lazy", 142 defaults: ["libnativehelper_defaults"], 143 bootstrap: true, 144 host_supported: true, 145 export_include_dirs: [ 146 "header_only_include", 147 "include", 148 "include_jni", 149 "include_platform", 150 "include_platform_header_only", 151 ], 152 apex_available: ["//apex_available:platform"], 153 srcs: ["libnativehelper_lazy.c"], 154 target: { 155 linux: { 156 version_script: "libnativehelper.map.txt", 157 }, 158 }, 159} 160 161// 162// NDK-only build for the target (device), using libc++. 163// - Relies only on NDK exposed functionality. 164// - This doesn't include JniInvocation. 165// 166 167cc_library { 168 name: "libnativehelper_compat_libc++", 169 defaults: ["libnativehelper_defaults"], 170 header_libs: ["jni_headers"], 171 cflags: ["-Werror"], 172 export_header_lib_headers: ["jni_headers"], 173 export_include_dirs: [ 174 "header_only_include", 175 "include", 176 ], 177 host_supported: true, 178 local_include_dirs: [ 179 "header_only_include", 180 "include_platform_header_only", 181 ], 182 srcs: [ 183 "ExpandableString.c", 184 "JNIHelp.c", 185 ], 186 min_sdk_version: "29", 187 sdk_version: "19", 188 stl: "none", 189 apex_available: [ 190 "//apex_available:platform", 191 "com.android.art", 192 "com.android.art.debug", 193 "com.android.extservices", 194 "com.android.tethering", 195 ], 196 visibility: [ 197 "//art:__subpackages__", 198 "//cts:__subpackages__", 199 "//external/perfetto:__subpackages__", 200 "//frameworks/base/packages/Connectivity/tests/integration:__pkg__", 201 "//frameworks/base/packages/ConnectivityT:__subpackages__", // TODO: remove after code move 202 "//frameworks/base/packages/Tethering:__subpackages__", 203 "//frameworks/libs/net/common/native/bpfmapjni", 204 "//frameworks/libs/net/common/native/bpfutiljni", 205 "//libcore:__subpackages__", 206 "//packages/modules/Connectivity:__subpackages__", 207 "//packages/modules/ExtServices:__subpackages__", 208 "//packages/modules/NetworkStack:__subpackages__", 209 ":__subpackages__", 210 ], 211} 212 213// The NDK module definitions reside in 214// system/extras/module_ndk_libs/libnativehelper in platform, with copies of 215// these headers and map.txt. Any changes here should be synced there and vice 216// versa. 217// 218// TODO(b/170644498): Improve tooling to remove this duplication. 219// 220// ndk_headers { 221// name: "ndk_jni.h", 222// from: "include_jni", 223// to: "", 224// srcs: ["include_jni/jni.h"], 225// license: "NOTICE", 226// } 227// 228// ndk_headers { 229// name: "libnativehelper_ndk_headers", 230// from: "include", 231// to: "", 232// srcs: ["include/android/*.h"], 233// license: "NOTICE", 234// } 235// 236// ndk_library { 237// name: "libnativehelper", 238// symbol_file: "libnativehelper.map.txt", 239// first_version: "S", 240// } 241 242// 243// Tests. 244// 245 246subdirs = [ 247 "tests", 248 "tests_mts", 249] 250