xref: /aosp_15_r20/system/nfc/tools/casimir/Android.bp (revision 7eba2f3b06c51ae21384f6a4f14577b668a869b3)
1// Copyright 2023, 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_fwk_nfc",
17}
18
19genrule {
20    name: "casimir_nci_packets_rust_gen",
21    defaults: ["pdl_rust_legacy_generator_defaults"],
22    srcs: ["src/nci_packets.pdl"],
23    out: ["nci_packets.rs"],
24}
25
26genrule {
27    name: "casimir_rf_packets_rust_gen",
28    defaults: ["pdl_rust_legacy_generator_defaults"],
29    srcs: ["src/rf_packets.pdl"],
30    out: ["rf_packets.rs"],
31}
32
33rust_binary_host {
34    name: "casimir",
35    crate_name: "casimir",
36    edition: "2021",
37    srcs: [
38        "src/main.rs",
39        ":casimir_nci_packets_rust_gen",
40        ":casimir_rf_packets_rust_gen",
41    ],
42    rustlibs: [
43        "libanyhow",
44        "libargh",
45        "libbytes",
46        "libenv_logger",
47        "libfutures",
48        "liblog_rust",
49        "libpdl_runtime",
50        "librustutils",
51        "libtokio",
52    ],
53}
54
55genrule {
56    name: "casimir_rf_packets_cxx_gen",
57    tools: [
58        ":pdl_cxx_generator",
59        ":pdlc",
60    ],
61    cmd: "set -o pipefail;" +
62        " $(location :pdlc) $(in) |" +
63        " $(location :pdl_cxx_generator)" +
64        " --namespace casimir::rf" +
65        " --output $(out)",
66    srcs: [
67        "src/rf_packets.pdl",
68    ],
69    out: [
70        "rf_packets.h",
71    ],
72}
73
74cc_library_headers {
75    name: "casimir_rf_packets_cxx",
76    generated_headers: ["casimir_rf_packets_cxx_gen"],
77    header_libs: ["pdl_cxx_packet_runtime"],
78    export_generated_headers: ["casimir_rf_packets_cxx_gen"],
79    export_header_lib_headers: ["pdl_cxx_packet_runtime"],
80    host_supported: true,
81}
82