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        "libonce_cell",
27        "libcxx",
28    ],
29    shared_libs: ["libutils"],
30    edition: "2021",
31}
32
33rust_ffi_static {
34    name: "libdebugstore_rust_ffi",
35    crate_name: "debugstore",
36    defaults: ["libdebugstore_defaults"],
37}
38
39cc_library {
40    name: "libdebugstore_cxx",
41    generated_headers: ["libdebugstore_cxx_bridge_header"],
42    generated_sources: ["libdebugstore_cxx_bridge_code"],
43    export_generated_headers: ["libdebugstore_cxx_bridge_header"],
44    shared_libs: ["libutils"],
45    whole_static_libs: ["libdebugstore_rust_ffi"],
46}
47
48rust_test {
49    name: "libdebugstore_tests",
50    defaults: ["libdebugstore_defaults"],
51    test_options: {
52        unit_test: true,
53    },
54    shared_libs: ["libdebugstore_cxx"],
55}
56
57genrule {
58    name: "libdebugstore_cxx_bridge_header",
59    tools: ["cxxbridge"],
60    cmd: "$(location cxxbridge) $(in) --header >> $(out)",
61    srcs: ["src/lib.rs"],
62    out: ["debugstore/debugstore_cxx_bridge.rs.h"],
63}
64
65genrule {
66    name: "libdebugstore_cxx_bridge_code",
67    tools: ["cxxbridge"],
68    cmd: "$(location cxxbridge) $(in) >> $(out)",
69    srcs: ["src/lib.rs"],
70    out: ["debugstore/debugstore_cxx_bridge.rs.cpp"],
71}
72