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
17// ==========================================================
18// Native library to register a pull atom callback with statsd
19// ==========================================================
20package {
21    default_applicable_licenses: ["Android-Apache-2.0"],
22}
23
24cc_defaults {
25    name: "libstatspull_defaults",
26    srcs: [
27        "stats_pull_atom_callback.cpp",
28    ],
29    cflags: [
30        "-Wall",
31        "-Werror",
32    ],
33    export_include_dirs: ["include"],
34    shared_libs: [
35        "libbinder_ndk",
36        "liblog",
37    ],
38    static_libs: [
39        "libutils",
40        "statsd-aidl-ndk_platform",
41    ],
42    target: {
43        android: {
44            shared_libs: ["libstatssocket"],
45        },
46        host: {
47            static_libs: ["libstatssocket"],
48        },
49    },
50}
51cc_library {
52    name: "libstatspull",
53    defaults: [
54        "libstatspull_defaults",
55        "libbinder_ndk_host_user",
56    ],
57    host_supported: true,
58    target: {
59        android: {
60            static: {
61                enabled: false,
62            },
63        },
64        host: {
65            shared: {
66                enabled: false,
67            },
68        },
69    },
70    // enumerate stable entry points for APEX use
71    stubs: {
72        symbol_file: "libstatspull.map.txt",
73        versions: [
74            "30",
75        ],
76    },
77    apex_available: [
78        "com.android.os.statsd",
79        "test_com.android.os.statsd",
80    ],
81    min_sdk_version: "30",
82
83    stl: "libc++_static",
84
85    // TODO(b/151102177): Enable it when the build error is fixed.
86    header_abi_checker: {
87        enabled: false,
88    },
89}
90
91cc_library_headers {
92    name: "libstatspull_headers",
93    export_include_dirs: ["include"],
94}
95
96// ONLY USE IN TESTS.
97cc_library_static {
98    name: "libstatspull_private",
99    defaults: [
100        "libstatspull_defaults",
101    ],
102    cflags: [
103        "-DLIB_STATS_PULL_TESTS_FLAG",
104    ],
105    visibility: [
106        "//packages/modules/StatsD/apex/tests/libstatspull",
107    ],
108}
109
110// Note: These unit tests only test PullAtomMetadata.
111// For full E2E tests of libstatspull, use LibStatsPullTests
112cc_test {
113    name: "libstatspull_test",
114    srcs: [
115        "tests/pull_atom_metadata_test.cpp",
116    ],
117    shared_libs: [
118        "libstatspull",
119        "libstatssocket",
120    ],
121    test_suites: ["general-tests", "mts-statsd"],
122    test_config: "libstatspull_test.xml",
123
124    //TODO(b/153588990): Remove when the build system properly separates
125    //32bit and 64bit architectures.
126    compile_multilib: "both",
127    multilib: {
128        lib64: {
129            suffix: "64",
130        },
131        lib32: {
132            suffix: "32",
133        },
134    },
135    cflags: [
136        "-Wall",
137        "-Werror",
138        "-Wno-missing-field-initializers",
139        "-Wno-unused-variable",
140        "-Wno-unused-function",
141        "-Wno-unused-parameter",
142    ],
143    require_root: true,
144}
145