1*795d594fSAndroid Build Coastguard Worker// Shared library for target 2*795d594fSAndroid Build Coastguard Worker// ======================================================== 3*795d594fSAndroid Build Coastguard Workerpackage { 4*795d594fSAndroid Build Coastguard Worker // See: http://go/android-license-faq 5*795d594fSAndroid Build Coastguard Worker // A large-scale-change added 'default_applicable_licenses' to import 6*795d594fSAndroid Build Coastguard Worker // all of the 'license_kinds' from "art_license" 7*795d594fSAndroid Build Coastguard Worker // to get the below license kinds: 8*795d594fSAndroid Build Coastguard Worker // SPDX-license-identifier-Apache-2.0 9*795d594fSAndroid Build Coastguard Worker default_applicable_licenses: ["art_license"], 10*795d594fSAndroid Build Coastguard Worker default_team: "trendy_team_art_mainline", 11*795d594fSAndroid Build Coastguard Worker} 12*795d594fSAndroid Build Coastguard Worker 13*795d594fSAndroid Build Coastguard Workercc_library_headers { 14*795d594fSAndroid Build Coastguard Worker name: "libnativeloader-headers", 15*795d594fSAndroid Build Coastguard Worker defaults: ["art_defaults"], 16*795d594fSAndroid Build Coastguard Worker apex_available: [ 17*795d594fSAndroid Build Coastguard Worker "//apex_available:platform", 18*795d594fSAndroid Build Coastguard Worker "com.android.art", 19*795d594fSAndroid Build Coastguard Worker "com.android.art.debug", 20*795d594fSAndroid Build Coastguard Worker "com.android.media", 21*795d594fSAndroid Build Coastguard Worker ], 22*795d594fSAndroid Build Coastguard Worker visibility: [ 23*795d594fSAndroid Build Coastguard Worker "//art:__subpackages__", 24*795d594fSAndroid Build Coastguard Worker // TODO(b/133140750): Clean this up. 25*795d594fSAndroid Build Coastguard Worker "//frameworks/av/media/libstagefright", 26*795d594fSAndroid Build Coastguard Worker "//frameworks/native/libs/graphicsenv", 27*795d594fSAndroid Build Coastguard Worker "//frameworks/native/vulkan/libvulkan", 28*795d594fSAndroid Build Coastguard Worker ], 29*795d594fSAndroid Build Coastguard Worker host_supported: true, 30*795d594fSAndroid Build Coastguard Worker export_include_dirs: ["include"], 31*795d594fSAndroid Build Coastguard Worker header_libs: ["jni_headers"], 32*795d594fSAndroid Build Coastguard Worker export_header_lib_headers: ["jni_headers"], 33*795d594fSAndroid Build Coastguard Worker} 34*795d594fSAndroid Build Coastguard Worker 35*795d594fSAndroid Build Coastguard Workercc_defaults { 36*795d594fSAndroid Build Coastguard Worker name: "libnativeloader-defaults", 37*795d594fSAndroid Build Coastguard Worker defaults: ["art_defaults"], 38*795d594fSAndroid Build Coastguard Worker host_supported: true, 39*795d594fSAndroid Build Coastguard Worker srcs: [ 40*795d594fSAndroid Build Coastguard Worker "native_loader.cpp", 41*795d594fSAndroid Build Coastguard Worker ], 42*795d594fSAndroid Build Coastguard Worker header_libs: [ 43*795d594fSAndroid Build Coastguard Worker "art_libartbase_headers", 44*795d594fSAndroid Build Coastguard Worker "libnativehelper_header_only", 45*795d594fSAndroid Build Coastguard Worker "libnativeloader-headers", 46*795d594fSAndroid Build Coastguard Worker ], 47*795d594fSAndroid Build Coastguard Worker export_header_lib_headers: ["libnativeloader-headers"], 48*795d594fSAndroid Build Coastguard Worker shared_libs: [ 49*795d594fSAndroid Build Coastguard Worker "libnativebridge#impl", 50*795d594fSAndroid Build Coastguard Worker ], 51*795d594fSAndroid Build Coastguard Worker target: { 52*795d594fSAndroid Build Coastguard Worker android: { 53*795d594fSAndroid Build Coastguard Worker srcs: [ 54*795d594fSAndroid Build Coastguard Worker "library_namespaces.cpp", 55*795d594fSAndroid Build Coastguard Worker "native_loader_namespace.cpp", 56*795d594fSAndroid Build Coastguard Worker "public_libraries.cpp", 57*795d594fSAndroid Build Coastguard Worker ], 58*795d594fSAndroid Build Coastguard Worker shared_libs: [ 59*795d594fSAndroid Build Coastguard Worker "libdl_android", 60*795d594fSAndroid Build Coastguard Worker ], 61*795d594fSAndroid Build Coastguard Worker static_libs: [ 62*795d594fSAndroid Build Coastguard Worker "libPlatformProperties", 63*795d594fSAndroid Build Coastguard Worker "libmodules-utils-build", 64*795d594fSAndroid Build Coastguard Worker ], 65*795d594fSAndroid Build Coastguard Worker }, 66*795d594fSAndroid Build Coastguard Worker }, 67*795d594fSAndroid Build Coastguard Worker} 68*795d594fSAndroid Build Coastguard Worker 69*795d594fSAndroid Build Coastguard Workerart_cc_library { 70*795d594fSAndroid Build Coastguard Worker name: "libnativeloader", 71*795d594fSAndroid Build Coastguard Worker defaults: ["libnativeloader-defaults"], 72*795d594fSAndroid Build Coastguard Worker shared_libs: [ 73*795d594fSAndroid Build Coastguard Worker "libbase", 74*795d594fSAndroid Build Coastguard Worker "liblog", 75*795d594fSAndroid Build Coastguard Worker ], 76*795d594fSAndroid Build Coastguard Worker visibility: [ 77*795d594fSAndroid Build Coastguard Worker "//frameworks/base/cmds/app_process", 78*795d594fSAndroid Build Coastguard Worker // TODO(b/133140750): Clean this up. 79*795d594fSAndroid Build Coastguard Worker "//frameworks/base/native/webview/loader", 80*795d594fSAndroid Build Coastguard Worker ], 81*795d594fSAndroid Build Coastguard Worker apex_available: [ 82*795d594fSAndroid Build Coastguard Worker "com.android.art", 83*795d594fSAndroid Build Coastguard Worker "com.android.art.debug", 84*795d594fSAndroid Build Coastguard Worker "test_broken_com.android.art", 85*795d594fSAndroid Build Coastguard Worker ], 86*795d594fSAndroid Build Coastguard Worker stubs: { 87*795d594fSAndroid Build Coastguard Worker symbol_file: "libnativeloader.map.txt", 88*795d594fSAndroid Build Coastguard Worker versions: ["1"], 89*795d594fSAndroid Build Coastguard Worker }, 90*795d594fSAndroid Build Coastguard Worker} 91*795d594fSAndroid Build Coastguard Worker 92*795d594fSAndroid Build Coastguard Worker// Wrapper that loads nativeloader.so lazily, to be used to deal with layer 93*795d594fSAndroid Build Coastguard Worker// inversion in places like in early boot where libnativeloader and/or 94*795d594fSAndroid Build Coastguard Worker// libnativebridge aren't available. 95*795d594fSAndroid Build Coastguard Worker// TODO(b/124250621) eliminate the need for this library 96*795d594fSAndroid Build Coastguard Workercc_library_shared { 97*795d594fSAndroid Build Coastguard Worker name: "libnativeloader_lazy", 98*795d594fSAndroid Build Coastguard Worker defaults: ["art_defaults"], 99*795d594fSAndroid Build Coastguard Worker visibility: [ 100*795d594fSAndroid Build Coastguard Worker "//frameworks/base/core/jni", 101*795d594fSAndroid Build Coastguard Worker "//frameworks/native/opengl/libs", 102*795d594fSAndroid Build Coastguard Worker "//frameworks/native/vulkan/libvulkan", 103*795d594fSAndroid Build Coastguard Worker ], 104*795d594fSAndroid Build Coastguard Worker apex_available: [ 105*795d594fSAndroid Build Coastguard Worker "//apex_available:platform", 106*795d594fSAndroid Build Coastguard Worker "com.android.media", 107*795d594fSAndroid Build Coastguard Worker "com.android.media.swcodec", 108*795d594fSAndroid Build Coastguard Worker ], 109*795d594fSAndroid Build Coastguard Worker host_supported: false, 110*795d594fSAndroid Build Coastguard Worker srcs: ["native_loader_lazy.cpp"], 111*795d594fSAndroid Build Coastguard Worker runtime_libs: ["libnativeloader"], 112*795d594fSAndroid Build Coastguard Worker shared_libs: ["liblog"], 113*795d594fSAndroid Build Coastguard Worker header_libs: ["libnativeloader-headers"], 114*795d594fSAndroid Build Coastguard Worker export_header_lib_headers: ["libnativeloader-headers"], 115*795d594fSAndroid Build Coastguard Worker 116*795d594fSAndroid Build Coastguard Worker // Apply the libnativeloader stub symbol file to the exported symbols from 117*795d594fSAndroid Build Coastguard Worker // this shim library, to ensure that any symbols exposed here are also 118*795d594fSAndroid Build Coastguard Worker // available as an exported API. 119*795d594fSAndroid Build Coastguard Worker version_script: "libnativeloader.map.txt", 120*795d594fSAndroid Build Coastguard Worker} 121*795d594fSAndroid Build Coastguard Worker 122*795d594fSAndroid Build Coastguard Worker// native_loader_test.cpp mocks functions from libdl_android and 123*795d594fSAndroid Build Coastguard Worker// libnativebridge, so those have to be linked dynamically and this test binary 124*795d594fSAndroid Build Coastguard Worker// needs to export symbols to override them. 125*795d594fSAndroid Build Coastguard Workerart_cc_test { 126*795d594fSAndroid Build Coastguard Worker name: "libnativeloader_test", 127*795d594fSAndroid Build Coastguard Worker defaults: [ 128*795d594fSAndroid Build Coastguard Worker // Cannot use art_standalone_gtest_defaults because it makes us link 129*795d594fSAndroid Build Coastguard Worker // libnativebridge statically through libart-gtest. 130*795d594fSAndroid Build Coastguard Worker "art_standalone_test_defaults", 131*795d594fSAndroid Build Coastguard Worker "libnativeloader-defaults", 132*795d594fSAndroid Build Coastguard Worker ], 133*795d594fSAndroid Build Coastguard Worker host_supported: false, 134*795d594fSAndroid Build Coastguard Worker 135*795d594fSAndroid Build Coastguard Worker // Ordinarily, symbols are only exported if they are referenced by some 136*795d594fSAndroid Build Coastguard Worker // shared object dependency. Instead, export everything using 137*795d594fSAndroid Build Coastguard Worker // --export-dynamic, then restrict the visibility using the version script. 138*795d594fSAndroid Build Coastguard Worker ldflags: ["-Wl,--export-dynamic"], 139*795d594fSAndroid Build Coastguard Worker version_script: "libnativeloader_test.map", 140*795d594fSAndroid Build Coastguard Worker 141*795d594fSAndroid Build Coastguard Worker header_libs: [ 142*795d594fSAndroid Build Coastguard Worker "libnativebridge-headers", 143*795d594fSAndroid Build Coastguard Worker "libnativehelper_header_only", 144*795d594fSAndroid Build Coastguard Worker ], 145*795d594fSAndroid Build Coastguard Worker shared_libs: [ 146*795d594fSAndroid Build Coastguard Worker "liblog", // libbase dependency 147*795d594fSAndroid Build Coastguard Worker ], 148*795d594fSAndroid Build Coastguard Worker static_libs: [ 149*795d594fSAndroid Build Coastguard Worker "libbase", 150*795d594fSAndroid Build Coastguard Worker "libgmock", 151*795d594fSAndroid Build Coastguard Worker ], 152*795d594fSAndroid Build Coastguard Worker 153*795d594fSAndroid Build Coastguard Worker tidy_timeout_srcs: [ 154*795d594fSAndroid Build Coastguard Worker "native_loader_test.cpp", 155*795d594fSAndroid Build Coastguard Worker ], 156*795d594fSAndroid Build Coastguard Worker srcs: [ 157*795d594fSAndroid Build Coastguard Worker "library_namespaces_test.cpp", 158*795d594fSAndroid Build Coastguard Worker "native_loader_api_test.c", 159*795d594fSAndroid Build Coastguard Worker "native_loader_test.cpp", 160*795d594fSAndroid Build Coastguard Worker ], 161*795d594fSAndroid Build Coastguard Worker 162*795d594fSAndroid Build Coastguard Worker test_suites: [ 163*795d594fSAndroid Build Coastguard Worker "general-tests", 164*795d594fSAndroid Build Coastguard Worker "mts-art", 165*795d594fSAndroid Build Coastguard Worker ], 166*795d594fSAndroid Build Coastguard Worker} 167*795d594fSAndroid Build Coastguard Worker 168*795d594fSAndroid Build Coastguard Workercc_defaults { 169*795d594fSAndroid Build Coastguard Worker name: "libnativeloader_api_test_defaults", 170*795d594fSAndroid Build Coastguard Worker defaults: ["art_standalone_test_defaults"], 171*795d594fSAndroid Build Coastguard Worker 172*795d594fSAndroid Build Coastguard Worker srcs: ["native_loader_api_test.cpp"], 173*795d594fSAndroid Build Coastguard Worker header_libs: [ 174*795d594fSAndroid Build Coastguard Worker "libnativebridge-headers", 175*795d594fSAndroid Build Coastguard Worker "libnativehelper_header_only", 176*795d594fSAndroid Build Coastguard Worker ], 177*795d594fSAndroid Build Coastguard Worker static_libs: [ 178*795d594fSAndroid Build Coastguard Worker "libbase", 179*795d594fSAndroid Build Coastguard Worker "libgmock", 180*795d594fSAndroid Build Coastguard Worker ], 181*795d594fSAndroid Build Coastguard Worker} 182*795d594fSAndroid Build Coastguard Worker 183*795d594fSAndroid Build Coastguard Workerart_cc_test { 184*795d594fSAndroid Build Coastguard Worker name: "art_libnativeloader_cts_test", 185*795d594fSAndroid Build Coastguard Worker defaults: ["libnativeloader_api_test_defaults"], 186*795d594fSAndroid Build Coastguard Worker shared_libs: [ 187*795d594fSAndroid Build Coastguard Worker "libnativeloader", 188*795d594fSAndroid Build Coastguard Worker ], 189*795d594fSAndroid Build Coastguard Worker test_config_template: ":art-gtests-target-standalone-cts-template", 190*795d594fSAndroid Build Coastguard Worker test_suites: [ 191*795d594fSAndroid Build Coastguard Worker "cts", 192*795d594fSAndroid Build Coastguard Worker "mcts-art", 193*795d594fSAndroid Build Coastguard Worker ], 194*795d594fSAndroid Build Coastguard Worker} 195*795d594fSAndroid Build Coastguard Worker 196*795d594fSAndroid Build Coastguard Workerart_cc_test { 197*795d594fSAndroid Build Coastguard Worker name: "libnativeloader_lazy_test", 198*795d594fSAndroid Build Coastguard Worker defaults: ["libnativeloader_api_test_defaults"], 199*795d594fSAndroid Build Coastguard Worker shared_libs: ["libnativeloader_lazy"], 200*795d594fSAndroid Build Coastguard Worker data_libs: ["libnativeloader_lazy"], 201*795d594fSAndroid Build Coastguard Worker test_suites: [ 202*795d594fSAndroid Build Coastguard Worker "general-tests", 203*795d594fSAndroid Build Coastguard Worker "mts-art", 204*795d594fSAndroid Build Coastguard Worker ], 205*795d594fSAndroid Build Coastguard Worker} 206