1//
2// Copyright (C) 2019 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17package {
18    // See: http://go/android-license-faq
19    default_applicable_licenses: ["Android-Apache-2.0"],
20}
21
22cc_library_shared {
23    name: "libfuse_jni",
24
25    srcs: [
26        "jni_init.cpp",
27        "com_android_providers_media_FuseDaemon.cpp",
28        "FuseDaemon.cpp",
29        "FuseUtils.cpp",
30        "MediaProviderWrapper.cpp",
31        "ReaddirHelper.cpp",
32        "RedactionInfo.cpp",
33        "node.cpp",
34    ],
35
36    header_libs: [
37        "bpf_syscall_wrappers",
38        "libnativehelper_header_only",
39    ],
40
41    export_include_dirs: ["include"],
42
43    shared_libs: [
44        "leveldb",
45        "liblog",
46        "libfuse",
47        "libandroid",
48    ],
49
50    static_libs: [
51        "libbase_ndk",
52    ],
53
54    cflags: [
55        "-Wall",
56        "-Werror",
57        "-Wno-unused-parameter",
58        "-Wno-unused-variable",
59        "-Wthread-safety",
60
61        "-D_FILE_OFFSET_BITS=64",
62        "-DFUSE_USE_VERSION=34",
63    ],
64
65    tidy: true,
66    tidy_checks: [
67        "-google-runtime-int",
68        "-performance-no-int-to-ptr",
69    ],
70
71    sdk_version: "current",
72    stl: "c++_static",
73    min_sdk_version: "30",
74    apex_available: [
75        "com.android.mediaprovider",
76    ],
77}
78
79cc_library_shared {
80    name: "libleveldb_jni",
81
82    srcs: [
83        "com_android_providers_media_leveldb_LevelDBInstance.cpp",
84    ],
85
86    header_libs: [
87        "libnativehelper_header_only",
88    ],
89
90    apex_available: ["com.android.mediaprovider"],
91
92    shared_libs: [
93        "leveldb",
94        "liblog",
95        "libandroid",
96    ],
97
98    cflags: [
99        "-Wall",
100        "-Werror",
101        "-Wno-unused-parameter",
102        "-Wno-unused-variable",
103        "-Wthread-safety",
104    ],
105
106    tidy: true,
107    tidy_checks: [
108        "-google-runtime-int",
109        "-performance-no-int-to-ptr",
110    ],
111
112    sdk_version: "current",
113    stl: "c++_static",
114    min_sdk_version: "30",
115}
116
117filegroup {
118    name: "fuse_test_default_map",
119    srcs: ["fuse_test_default.map"],
120}
121
122cc_defaults {
123    name: "fuse_test_defaults",
124    // These tests run on older platform versions, so many libraries (such as libbase and libc++)
125    // need to be linked statically. The tests also need to be linked with a version script to
126    // ensure that the statically-linked library isn't exported from the executable, where it
127    // would override the shared libraries that the platform itself uses.
128    // See http://b/333438055 for an example of what goes wrong when libc++ is partially exported
129    // from an executable.
130    version_script: ":fuse_test_default_map",
131    stl: "c++_static",
132}
133
134cc_test {
135    name: "fuse_node_test",
136    test_suites: [
137        "device-tests",
138        "mts-mediaprovider",
139    ],
140    test_config: "fuse_node_test.xml",
141
142    defaults: [
143        "fuse_test_defaults",
144    ],
145
146    compile_multilib: "both",
147    multilib: {
148        lib32: {
149            suffix: "32",
150        },
151        lib64: {
152            suffix: "64",
153        },
154    },
155
156    srcs: [
157        "node_test.cpp",
158        "node.cpp",
159        "ReaddirHelper.cpp",
160        "RedactionInfo.cpp",
161    ],
162
163    local_include_dirs: ["include"],
164
165    static_libs: [
166        "libbase_ndk",
167    ],
168
169    shared_libs: [
170        "liblog",
171    ],
172
173    tidy: true,
174    tidy_checks: [
175        "-performance-no-int-to-ptr",
176    ],
177
178    sdk_version: "current",
179}
180
181cc_test {
182    name: "RedactionInfoTest",
183    test_suites: [
184        "device-tests",
185        "mts-mediaprovider",
186    ],
187    test_config: "RedactionInfoTest.xml",
188
189    defaults: [
190        "fuse_test_defaults",
191    ],
192
193    compile_multilib: "both",
194    multilib: {
195        lib32: {
196            suffix: "32",
197        },
198        lib64: {
199            suffix: "64",
200        },
201    },
202
203    srcs: [
204        "RedactionInfoTest.cpp",
205        "RedactionInfo.cpp",
206    ],
207
208    local_include_dirs: ["include"],
209
210    static_libs: [
211        "libbase_ndk",
212    ],
213
214    shared_libs: [
215        "liblog",
216    ],
217
218    tidy: true,
219
220    sdk_version: "current",
221}
222
223cc_test {
224    name: "FuseUtilsTest",
225    test_suites: [
226        "device-tests",
227        "mts-mediaprovider",
228    ],
229    test_config: "FuseUtilsTest.xml",
230
231    defaults: [
232        "fuse_test_defaults",
233    ],
234
235    compile_multilib: "both",
236    multilib: {
237        lib32: {
238            suffix: "32",
239        },
240        lib64: {
241            suffix: "64",
242        },
243    },
244
245    srcs: [
246        "FuseUtilsTest.cpp",
247        "FuseUtils.cpp",
248    ],
249
250    header_libs: [
251        "libnativehelper_header_only",
252    ],
253
254    local_include_dirs: ["include"],
255
256    static_libs: [
257        "libbase_ndk",
258    ],
259
260    shared_libs: [
261        "liblog",
262    ],
263
264    tidy: true,
265
266    sdk_version: "current",
267}
268