1//
2// Copyright (C) 2021 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    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21rust_bindgen {
22    name: "libstatspull_bindgen",
23    wrapper_src: "statslog.h",
24    crate_name: "statspull_bindgen",
25    visibility: [
26        "//frameworks/proto_logging/stats/stats_log_api_gen",
27        "//packages/modules/Virtualization/libs/statslog_virtualization",
28    ],
29    source_stem: "bindings",
30    bindgen_flags: [
31        "--size_t-is-usize",
32        "--allowlist-function=AStatsEventList_addStatsEvent",
33        "--allowlist-function=AStatsEvent_.*",
34        "--allowlist-function=AStatsManager_.*",
35        "--allowlist-var=AStatsManager_.*",
36    ],
37    target: {
38        android: {
39            shared_libs: [
40                "libstatspull",
41                "libstatssocket",
42            ],
43        },
44        host: {
45            static_libs: [
46                "libstatspull",
47                "libstatssocket",
48            ],
49        },
50    },
51    min_sdk_version: "apex_inherit",
52    apex_available: [
53        "//apex_available:platform",
54        "com.android.resolv",
55        "com.android.virt",
56    ],
57}
58
59rust_library {
60    name: "libstatspull_rust",
61    crate_name: "statspull_rust",
62    srcs: ["stats_pull.rs"],
63    rustlibs: [
64        "liblazy_static",
65        "liblog_rust",
66        "libstatslog_rust_header",
67        "libstatspull_bindgen",
68    ],
69}
70
71rust_test {
72    name: "libstatspull_bindgen_test",
73    srcs: [":libstatspull_bindgen"],
74    crate_name: "statspull_bindgen_test",
75    test_suites: ["general-tests"],
76    auto_gen_config: true,
77    clippy_lints: "none",
78    lints: "none",
79}
80