• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Shared library for target
2// ========================================================
3package {
4    // See: http://go/android-license-faq
5    // A large-scale-change added 'default_applicable_licenses' to import
6    // all of the 'license_kinds' from "art_license"
7    // to get the below license kinds:
8    //   SPDX-license-identifier-Apache-2.0
9    default_applicable_licenses: ["art_license"],
10}
11
12cc_defaults {
13    name: "libnativeloader-defaults",
14    defaults: ["art_defaults"],
15    header_libs: ["libnativeloader-headers"],
16    export_header_lib_headers: ["libnativeloader-headers"],
17}
18
19art_cc_library {
20    name: "libnativeloader",
21    defaults: ["libnativeloader-defaults"],
22    visibility: [
23        "//frameworks/base/cmds/app_process",
24        // TODO(b/133140750): Clean this up.
25        "//frameworks/base/native/webview/loader",
26    ],
27    apex_available: [
28        "com.android.art",
29        "com.android.art.debug",
30    ],
31    host_supported: true,
32    srcs: [
33        "native_loader.cpp",
34    ],
35    header_libs: [
36        "libnativehelper_header_only",
37    ],
38    shared_libs: [
39        "liblog",
40        "libnativebridge",
41        "libbase",
42    ],
43    target: {
44        // Library search path needed for running host tests remotely (from testcases directory).
45        linux_glibc_x86: {
46            ldflags: [
47                "-Wl,-rpath,$ORIGIN/../art_common/out/host/linux-x86/lib",
48                "-Wl,--enable-new-dtags",
49            ],
50        },
51        linux_glibc_x86_64: {
52            ldflags: [
53                "-Wl,-rpath,$ORIGIN/../art_common/out/host/linux-x86/lib64",
54                "-Wl,--enable-new-dtags",
55            ],
56        },
57        android: {
58            srcs: [
59                "library_namespaces.cpp",
60                "native_loader_namespace.cpp",
61                "public_libraries.cpp",
62            ],
63            shared_libs: [
64                "libdl_android",
65            ],
66            static_libs: [
67                "PlatformProperties",
68            ],
69        },
70    },
71    stubs: {
72        symbol_file: "libnativeloader.map.txt",
73        versions: ["1"],
74    },
75}
76
77// TODO(b/124250621) eliminate the need for this library
78cc_library {
79    name: "libnativeloader_lazy",
80    defaults: ["libnativeloader-defaults"],
81    visibility: [
82        "//frameworks/base/core/jni",
83        "//frameworks/native/opengl/libs",
84        "//frameworks/native/vulkan/libvulkan",
85    ],
86    apex_available: [
87        "//apex_available:platform",
88        "com.android.media",
89        "com.android.media.swcodec",
90    ],
91    host_supported: false,
92    srcs: ["native_loader_lazy.cpp"],
93    runtime_libs: ["libnativeloader"],
94    shared_libs: ["liblog"],
95}
96
97cc_library_headers {
98    name: "libnativeloader-headers",
99    defaults: ["art_defaults"],
100    apex_available: [
101        "//apex_available:platform",
102        "com.android.art",
103        "com.android.art.debug",
104        "com.android.media",
105    ],
106    visibility: [
107        "//art:__subpackages__",
108        // TODO(b/133140750): Clean this up.
109        "//frameworks/av/media/libstagefright",
110        "//frameworks/native/libs/graphicsenv",
111        "//frameworks/native/vulkan/libvulkan",
112    ],
113    host_supported: true,
114    export_include_dirs: ["include"],
115    header_libs: ["jni_headers"],
116    export_header_lib_headers: ["jni_headers"],
117}
118
119cc_defaults {
120    name: "libnativeloader-test-defaults",
121    defaults: [
122        "art_module_source_build_defaults",
123        "art_test_defaults",
124    ],
125    host_supported: false,
126
127    cflags: ["-DANDROID"],
128
129    // The tests mock libdl_android and libnativebridge symbols, so export them
130    // to override the ones loaded from their libs.
131    ldflags: [
132        "-Wl,--export-dynamic-symbol=android_*",
133        "-Wl,--export-dynamic-symbol=NativeBridge*",
134    ],
135
136    header_libs: [
137        "libnativebridge-headers",
138        "libnativehelper_header_only",
139    ],
140    static_libs: [
141        "libgmock",
142    ],
143    shared_libs: [
144        "libbase",
145    ],
146
147    test_suites: ["device-tests"],
148}
149
150art_cc_test {
151    name: "libnativeloader_test",
152    defaults: [
153        "art_standalone_test_defaults",
154        "libnativeloader-test-defaults",
155    ],
156    tidy_timeout_srcs: [
157        "native_loader_test.cpp",
158    ],
159    srcs: [
160        "native_loader_api_test.c",
161        "native_loader_test.cpp",
162    ],
163    shared_libs: [
164        "libnativeloader",
165    ],
166
167    // Support multilib variants (using different suffix per sub-architecture), which is needed on
168    // build targets with secondary architectures, as the CTS test suite packaging logic flattens
169    // all test artifacts into a single `testcases` directory.
170    compile_multilib: "both",
171    multilib: {
172        lib32: {
173            suffix: "32",
174        },
175        lib64: {
176            suffix: "64",
177        },
178    },
179
180    // Added to CTS for API coverage of libnativeloader which is backed by the
181    // ART module.
182    test_config_template: ":art-gtests-target-standalone-cts-template",
183    test_suites: [
184        "cts",
185        "mts-art",
186    ],
187}
188
189art_cc_test {
190    name: "libnativeloader_lazy_test",
191    defaults: ["libnativeloader-test-defaults"],
192    srcs: [
193        "native_loader_lazy_test.cpp",
194    ],
195    static_libs: [
196        "libnativeloader_lazy",
197    ],
198}
199