1// Shared library for target
2// ========================================================
3cc_defaults {
4    name: "libnativeloader-defaults",
5    defaults: ["art_defaults"],
6    cppflags: [
7        "-fvisibility=hidden",
8    ],
9    header_libs: ["libnativeloader-headers"],
10    export_header_lib_headers: ["libnativeloader-headers"],
11}
12
13art_cc_library {
14    name: "libnativeloader",
15    defaults: ["libnativeloader-defaults"],
16    visibility: [
17        "//frameworks/base/cmds/app_process",
18        // TODO(b/133140750): Clean this up.
19        "//frameworks/base/native/webview/loader",
20    ],
21    apex_available: [
22        "com.android.art.release",
23        "com.android.art.debug",
24    ],
25    host_supported: true,
26    srcs: [
27        "native_loader.cpp",
28    ],
29    header_libs: [
30        "libnativehelper_header_only",
31    ],
32    shared_libs: [
33        "liblog",
34        "libnativebridge",
35        "libbase",
36    ],
37    target: {
38        // Library search path needed for running host tests remotely (from testcases directory).
39        linux_glibc_x86: {
40            ldflags: [
41                "-Wl,-rpath,$ORIGIN/../art_common/out/host/linux-x86/lib",
42                "-Wl,--enable-new-dtags",
43            ],
44        },
45        linux_glibc_x86_64: {
46            ldflags: [
47                "-Wl,-rpath,$ORIGIN/../art_common/out/host/linux-x86/lib64",
48                "-Wl,--enable-new-dtags",
49            ],
50        },
51        android: {
52            srcs: [
53                "library_namespaces.cpp",
54                "native_loader_namespace.cpp",
55                "public_libraries.cpp",
56            ],
57            shared_libs: [
58                "libdl_android",
59            ],
60            whole_static_libs: [
61                "PlatformProperties",
62            ],
63        },
64    },
65    stubs: {
66        symbol_file: "libnativeloader.map.txt",
67        versions: ["1"],
68    },
69}
70
71// TODO(b/124250621) eliminate the need for this library
72cc_library {
73    name: "libnativeloader_lazy",
74    defaults: ["libnativeloader-defaults"],
75    visibility: [
76        "//frameworks/base/core/jni",
77        "//frameworks/native/opengl/libs",
78        "//frameworks/native/vulkan/libvulkan",
79    ],
80    host_supported: false,
81    srcs: ["native_loader_lazy.cpp"],
82    required: ["libnativeloader"],
83    shared_libs: ["liblog"],
84}
85
86cc_library_headers {
87    name: "libnativeloader-headers",
88    apex_available: [
89        "//apex_available:platform",
90        "com.android.art.debug",
91        "com.android.art.release",
92    ],
93    visibility: [
94        "//art:__subpackages__",
95        // TODO(b/133140750): Clean this up.
96        "//frameworks/av/media/libstagefright",
97        "//frameworks/native/libs/graphicsenv",
98        "//frameworks/native/vulkan/libvulkan",
99    ],
100    host_supported: true,
101    export_include_dirs: ["include"],
102    header_libs: ["jni_headers"],
103    export_header_lib_headers: ["jni_headers"],
104}
105
106cc_test {
107    name: "libnativeloader_test",
108    srcs: [
109        "native_loader_test.cpp",
110        "native_loader.cpp",
111        "library_namespaces.cpp",
112        "native_loader_namespace.cpp",
113        "public_libraries.cpp",
114    ],
115    cflags: ["-DANDROID"],
116    static_libs: [
117        "libbase",
118        "liblog",
119        "libgmock",
120        "PlatformProperties",
121    ],
122    header_libs: [
123        "libnativebridge-headers",
124        "libnativehelper_header_only",
125        "libnativeloader-headers",
126    ],
127    // native_loader_test.cpp mocks libdl APIs so system_shared_libs
128    // are used to include C libraries without libdl.
129    system_shared_libs: [
130        "libc",
131        "libm",
132    ],
133    test_suites: ["device-tests"],
134}
135