summaryrefslogtreecommitdiff
path: root/libnativeloader/Android.bp
blob: 2db1f76eada5f7ed47008304911dd4d28813bf9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// Shared library for target
// ========================================================
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "art_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["art_license"],
}

cc_library_headers {
    name: "libnativeloader-headers",
    defaults: ["art_defaults"],
    apex_available: [
        "//apex_available:platform",
        "com.android.art",
        "com.android.art.debug",
        "com.android.media",
    ],
    visibility: [
        "//art:__subpackages__",
        // TODO(b/133140750): Clean this up.
        "//frameworks/av/media/libstagefright",
        "//frameworks/native/libs/graphicsenv",
        "//frameworks/native/vulkan/libvulkan",
    ],
    host_supported: true,
    export_include_dirs: ["include"],
    header_libs: ["jni_headers"],
    export_header_lib_headers: ["jni_headers"],
}

cc_defaults {
    name: "libnativeloader-defaults",
    defaults: ["art_defaults"],
    header_libs: ["libnativeloader-headers"],
    export_header_lib_headers: ["libnativeloader-headers"],
}

art_cc_library {
    name: "libnativeloader",
    defaults: ["libnativeloader-defaults"],
    visibility: [
        "//frameworks/base/cmds/app_process",
        // TODO(b/133140750): Clean this up.
        "//frameworks/base/native/webview/loader",
    ],
    apex_available: [
        "com.android.art",
        "com.android.art.debug",
        "test_broken_com.android.art",
    ],
    host_supported: true,
    srcs: [
        "native_loader.cpp",
    ],
    header_libs: [
        "libnativehelper_header_only",
    ],
    shared_libs: [
        "liblog",
        "libnativebridge",
        "libbase",
    ],
    target: {
        // Library search path needed for running host tests remotely (from testcases directory).
        linux_glibc_x86: {
            ldflags: [
                "-Wl,-rpath,$ORIGIN/../art_common/out/host/linux-x86/lib",
                "-Wl,--enable-new-dtags",
            ],
        },
        linux_glibc_x86_64: {
            ldflags: [
                "-Wl,-rpath,$ORIGIN/../art_common/out/host/linux-x86/lib64",
                "-Wl,--enable-new-dtags",
            ],
        },
        android: {
            srcs: [
                "library_namespaces.cpp",
                "native_loader_namespace.cpp",
                "public_libraries.cpp",
            ],
            shared_libs: [
                "libdl_android",
            ],
            static_libs: [
                "libPlatformProperties",
            ],
        },
    },
    stubs: {
        symbol_file: "libnativeloader.map.txt",
        versions: ["1"],
    },
}

// Wrapper that loads nativeloader.so lazily, to be used to deal with layer
// inversion in places like in early boot where libnativeloader and/or
// libnativebridge aren't available.
// TODO(b/124250621) eliminate the need for this library
cc_library {
    name: "libnativeloader_lazy",
    defaults: ["libnativeloader-defaults"],
    visibility: [
        "//frameworks/base/core/jni",
        "//frameworks/native/opengl/libs",
        "//frameworks/native/vulkan/libvulkan",
    ],
    apex_available: [
        "//apex_available:platform",
        "com.android.media",
        "com.android.media.swcodec",
    ],
    host_supported: false,
    srcs: ["native_loader_lazy.cpp"],
    runtime_libs: ["libnativeloader"],
    shared_libs: ["liblog"],
}

cc_defaults {
    name: "libnativeloader-test-defaults",
    defaults: [
        "art_module_source_build_defaults",
        // Cannot use art_standalone_gtest_defaults because it makes us link
        // libnativebridge statically through libart-gtest, but we need to mock
        // its symbols here.
        "art_standalone_test_defaults",
    ],
    host_supported: false,

    cflags: ["-DANDROID"],

    // The tests mock libdl_android and libnativebridge symbols, so export them
    // to override the ones loaded from their libs.
    ldflags: [
        "-Wl,--export-dynamic-symbol=android_*",
        "-Wl,--export-dynamic-symbol=NativeBridge*",
    ],

    header_libs: [
        "libnativebridge-headers",
        "libnativehelper_header_only",
    ],
    static_libs: [
        "libgmock",
    ],
    shared_libs: [
        "libbase",
    ],

    test_for: [
        "com.android.art",
        "com.android.art.debug",
    ],
    test_suites: ["device-tests"],
}

art_cc_test {
    name: "libnativeloader_test",
    defaults: [
        "libnativeloader-test-defaults",
    ],
    tidy_timeout_srcs: [
        "native_loader_test.cpp",
    ],
    srcs: [
        "native_loader_api_test.c",
        "native_loader_test.cpp",
    ],
    shared_libs: [
        "libnativeloader",
    ],
    test_suites: [
        "mts-art",
    ],
}

art_cc_test {
    name: "libnativeloader_lazy_test",
    defaults: ["libnativeloader-test-defaults"],
    srcs: [
        "native_loader_lazy_test.cpp",
    ],
    static_libs: [
        "libnativeloader_lazy",
    ],
}