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_subscription.cpp",
28        "stats_provider.cpp",
29        "stats_pull_atom_callback.cpp",
30    ],
31    cflags: [
32        "-Wall",
33        "-Werror",
34        "-Wthread-safety",
35    ],
36    export_include_dirs: ["include"],
37    shared_libs: [
38        "libbinder_ndk",
39        "liblog",
40        "libstatssocket",
41    ],
42    static_libs: [
43        "libutils",
44        "statsd-aidl-ndk",
45    ],
46}
47
48cc_library_shared {
49    name: "libstatspull",
50    defaults: [
51        "libstatspull_defaults",
52    ],
53    host_supported: true,
54    target: {
55        darwin: {
56            enabled: false,
57        },
58    },
59    // enumerate stable entry points for APEX use
60    stubs: {
61        symbol_file: "libstatspull.map.txt",
62        versions: [
63            "30",
64        ],
65    },
66    apex_available: [
67        "com.android.os.statsd",
68        "test_com.android.os.statsd",
69    ],
70    min_sdk_version: "30",
71
72    stl: "libc++_static",
73}
74
75cc_library_headers {
76    name: "libstatspull_headers",
77    export_include_dirs: ["include"],
78}
79
80// Note: These unit tests only test PullAtomMetadata and subscriptions
81// For full E2E tests of pullers, use LibStatsPullTests
82cc_test {
83    name: "libstatspull_test",
84    srcs: [
85        ":libprotobuf-internal-descriptor-proto",
86        ":libstats_log_protos",
87        ":libstats_subscription_protos",
88        "tests/pull_atom_metadata_test.cpp",
89        "tests/stats_subscription_test.cpp",
90    ],
91    proto: {
92        type: "lite",
93        include_dirs: [
94            "external/protobuf/src",
95        ],
96        static: true,
97    },
98    shared_libs: [
99        "libstatspull",
100        "libstatssocket",
101        "libbase",
102        "libbinder",
103        "libutils",
104        "liblog",
105    ],
106    static_libs: [
107        "libgmock",
108        "libstatsgtestmatchers",
109        "libstatslog_statsdtest",
110        "libprotobuf-cpp-lite",
111    ],
112    test_suites: [
113        "general-tests",
114        "mts-statsd",
115    ],
116    test_config: "libstatspull_test.xml",
117
118    //TODO(b/153588990): Remove when the build system properly separates
119    //32bit and 64bit architectures.
120    compile_multilib: "both",
121    multilib: {
122        lib64: {
123            suffix: "64",
124        },
125        lib32: {
126            suffix: "32",
127        },
128    },
129    cflags: [
130        "-Wall",
131        "-Werror",
132        "-Wno-missing-field-initializers",
133        "-Wno-unused-variable",
134        "-Wno-unused-function",
135        "-Wno-unused-parameter",
136        "-Wno-deprecated-declarations",
137        "-Wthread-safety",
138    ],
139    require_root: true,
140    min_sdk_version: "30",
141    test_for: ["com.android.os.statsd"],
142}
143