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
15rust_defaults {
16    name: "libinput_rust_defaults",
17    crate_name: "input",
18    srcs: ["lib.rs"],
19    host_supported: true,
20    rustlibs: [
21        "libbitflags",
22        "libcxx",
23        "libinput_bindgen",
24        "liblogger",
25        "liblog_rust",
26        "inputconstants-rust",
27    ],
28    whole_static_libs: [
29        "libinput_from_rust_to_cpp",
30    ],
31    shared_libs: [
32        "libbase",
33    ],
34}
35
36rust_library {
37    name: "libinput_rust",
38    defaults: ["libinput_rust_defaults"],
39}
40
41rust_ffi_static {
42    name: "libinput_rust_ffi",
43    defaults: ["libinput_rust_defaults"],
44}
45
46rust_test {
47    name: "libinput_rust_test",
48    defaults: ["libinput_rust_defaults"],
49    test_options: {
50        unit_test: true,
51    },
52    test_suites: ["device_tests"],
53    sanitize: {
54        hwaddress: true,
55    },
56}
57
58genrule {
59    name: "libinput_cxx_bridge_code",
60    tools: ["cxxbridge"],
61    cmd: "$(location cxxbridge) $(in) >> $(out)",
62    srcs: ["lib.rs"],
63    out: ["input_cxx_bridge_generated.cpp"],
64}
65
66genrule {
67    name: "libinput_cxx_bridge_header",
68    tools: ["cxxbridge"],
69    cmd: "$(location cxxbridge) $(in) --header >> $(out)",
70    srcs: ["lib.rs"],
71    out: ["input_cxx_bridge.rs.h"],
72}
73