1//
2// Copyright (C) 2023 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: "libpdfclient",
24    srcs: [
25        "*.cc",
26        "utils/*.cc",
27    ],
28
29    exclude_srcs: [
30        "*_test.cc",
31    ],
32
33    shared_libs: [
34        "liblog",
35        "libjnigraphics",
36        "libdl",
37        "libft2",
38        "libicu",
39        "libjpeg",
40        "libz",
41    ],
42
43    static_libs: [
44        "libbase_ndk",
45        "libpdfium_static",
46    ],
47
48    cflags: [
49        "-Werror",
50        "-Wno-unused-parameter",
51    ],
52
53    ldflags: [
54        // Matches libpdfium flags.
55        "-Wl,-icf=all",
56    ],
57
58    version_script: "jni.lds",
59
60    sdk_version: "current",
61    min_sdk_version: "apex_inherit",
62    apex_available: ["com.android.mediaprovider"],
63    stl: "c++_static",
64    header_libs: ["jni_headers"],
65}
66
67filegroup {
68    name: "pdfClient_test_default_map",
69    srcs: ["pdfClient_test_default.map"],
70}
71
72cc_test {
73    name: "pdfClient_test",
74    compile_multilib: "both",
75    multilib: {
76        lib32: {
77            suffix: "32",
78        },
79        lib64: {
80            suffix: "64",
81        },
82    },
83
84    srcs: [
85        "*.cc",
86        "utils/*.cc",
87        "testing/*.cc",
88    ],
89
90    test_config: "pdfClient_test_config.xml",
91
92    // These tests run on older platform versions, so many libraries (such as libbase and libc++)
93    // need to be linked statically. The tests also need to be linked with a version script to
94    // ensure that the statically-linked library isn't exported from the executable, where it
95    // would override the shared libraries that the platform itself uses.
96    // See http://b/333438055 for an example of what goes wrong when libc++ is partially exported
97    // from an executable.
98    version_script: ":pdfClient_test_default_map",
99
100    data: [
101        "testdata/**/*.pdf",
102    ],
103
104    test_suites: [
105        "device-tests",
106        "mts-mediaprovider",
107    ],
108
109    static_libs: [
110        "libbase_ndk",
111    ],
112
113    shared_libs: [
114        "libpdfium",
115        "liblog",
116    ],
117
118    cflags: [
119        "-Werror",
120        "-Wno-unused-parameter",
121        "-Wmacro-redefined",
122    ],
123
124    sdk_version: "current",
125    stl: "c++_static",
126    header_libs: ["jni_headers"],
127}
128