summaryrefslogtreecommitdiff
path: root/libnativeloader/Android.bp
blob: 50d243095c8a116ac8af2b7b3e1160052533b12c (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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// 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"],
    default_team: "trendy_team_art_mainline",
}

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: [
        "art_libartbase_headers",
        "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",
                "libmodules-utils-build",
            ],
        },
    },
    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"],
}

art_cc_test {
    name: "libnativeloader_test",
    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,

    // Ordinarily, symbols are only exported if they are referenced by some
    // shared object dependency. Instead, export everything using
    // --export-dynamic, then restrict the visibility using the version script.
    ldflags: ["-Wl,--export-dynamic"],
    version_script: "libnativeloader_test.map",

    header_libs: [
        "libnativebridge-headers",
        "libnativehelper_header_only",
    ],
    shared_libs: [
        "liblog", // libbase dependency
        "libnativeloader",
    ],
    static_libs: [
        "libbase",
        "libgmock",
    ],

    tidy_timeout_srcs: [
        "native_loader_test.cpp",
    ],
    srcs: [
        "library_namespaces_test.cpp",
        "native_loader_api_test.c",
        "native_loader_test.cpp",
    ],

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

cc_defaults {
    name: "libnativeloader_api_test_defaults",
    defaults: ["art_standalone_test_defaults"],

    srcs: ["native_loader_api_test.cpp"],
    header_libs: [
        "libnativebridge-headers",
        "libnativehelper_header_only",
    ],
    static_libs: [
        "libbase",
        "libgmock",
    ],
}

art_cc_test {
    name: "art_libnativeloader_cts_test",
    defaults: ["libnativeloader_api_test_defaults"],
    shared_libs: [
        "libnativeloader",
    ],
    test_config_template: ":art-gtests-target-standalone-cts-template",
    test_suites: [
        "cts",
        "mcts-art",
    ],
}

art_cc_test {
    name: "libnativeloader_lazy_test",
    defaults: ["libnativeloader_api_test_defaults"],
    static_libs: [
        "libnativeloader_lazy",
    ],
    test_suites: [
        "general-tests",
        "mts-art",
    ],
}