blob: 280380561939d2a320ac5e7d77bd39eb51e54398 [file] [log] [blame]
Prabir Pradhan44e6e832023-06-06 00:03:25 +00001// 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
15// Generate the C++ code that Rust calls into.
16genrule {
17 name: "inputflinger_rs_bootstrap_bridge_code",
18 tools: ["cxxbridge"],
19 cmd: "$(location cxxbridge) $(in) >> $(out)",
20 srcs: ["lib.rs"],
21 out: ["inputflinger_rs_bootstrap_cxx_generated.cc"],
22}
23
24// Generate a C++ header containing the C++ bindings
25// to the Rust exported functions in lib.rs.
26genrule {
27 name: "inputflinger_rs_bootstrap_bridge_header",
28 tools: ["cxxbridge"],
29 cmd: "$(location cxxbridge) $(in) --header >> $(out)",
30 srcs: ["lib.rs"],
31 out: ["inputflinger_bootstrap.rs.h"],
32}
33
Vaibhav Devmurari5766aee2023-11-03 17:21:25 +000034rust_defaults {
35 name: "libinputflinger_rs_defaults",
Prabir Pradhan44e6e832023-06-06 00:03:25 +000036 crate_name: "inputflinger",
37 srcs: ["lib.rs"],
38 rustlibs: [
39 "libcxx",
40 "com.android.server.inputflinger-rust",
Vaibhav Devmurari953e6a42023-11-21 18:24:19 +000041 "android.hardware.input.common-V1-rust",
Prabir Pradhan44e6e832023-06-06 00:03:25 +000042 "libbinder_rs",
43 "liblog_rust",
44 "liblogger",
45 ],
46 host_supported: true,
47}
48
Vaibhav Devmurari5766aee2023-11-03 17:21:25 +000049rust_ffi_static {
50 name: "libinputflinger_rs",
51 defaults: ["libinputflinger_rs_defaults"],
52}
53
54rust_test {
55 name: "libinputflinger_rs_test",
56 defaults: ["libinputflinger_rs_defaults"],
57 test_options: {
58 unit_test: true,
59 },
60 test_suites: ["device_tests"],
61 sanitize: {
62 address: true,
63 hwaddress: true,
64 },
65}
66
Prabir Pradhan44e6e832023-06-06 00:03:25 +000067cc_library_headers {
68 name: "inputflinger_rs_bootstrap_cxx_headers",
69 host_supported: true,
70 export_include_dirs: ["ffi"],
71}