xref: /aosp_15_r20/frameworks/native/libs/debugstore/rust/Android.bp (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1// Copyright (C) 2024 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_team: "trendy_team_android_telemetry_infra",
17    default_applicable_licenses: ["frameworks_native_license"],
18}
19
20rust_defaults {
21    name: "libdebugstore_defaults",
22    srcs: ["src/lib.rs"],
23    rustlibs: [
24        "libcrossbeam_queue",
25        "libparking_lot",
26        "libcxx",
27    ],
28    shared_libs: ["libutils"],
29    edition: "2021",
30}
31
32rust_ffi_static {
33    name: "libdebugstore_rust_ffi",
34    crate_name: "debugstore",
35    defaults: ["libdebugstore_defaults"],
36}
37
38cc_library {
39    name: "libdebugstore_cxx",
40    generated_headers: ["libdebugstore_cxx_bridge_header"],
41    generated_sources: ["libdebugstore_cxx_bridge_code"],
42    export_generated_headers: ["libdebugstore_cxx_bridge_header"],
43    shared_libs: ["libutils"],
44    whole_static_libs: ["libdebugstore_rust_ffi"],
45}
46
47rust_test {
48    name: "libdebugstore_tests",
49    defaults: ["libdebugstore_defaults"],
50    test_options: {
51        unit_test: true,
52    },
53    shared_libs: ["libdebugstore_cxx"],
54}
55
56genrule {
57    name: "libdebugstore_cxx_bridge_header",
58    tools: ["cxxbridge"],
59    cmd: "$(location cxxbridge) $(in) --header >> $(out)",
60    srcs: ["src/lib.rs"],
61    out: ["debugstore/debugstore_cxx_bridge.rs.h"],
62}
63
64genrule {
65    name: "libdebugstore_cxx_bridge_code",
66    tools: ["cxxbridge"],
67    cmd: "$(location cxxbridge) $(in) >> $(out)",
68    srcs: ["src/lib.rs"],
69    out: ["debugstore/debugstore_cxx_bridge.rs.cpp"],
70}
71