blob: 9e6dbe432d9d6ea00930998cceefa940e017682b [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",
Vaibhav Devmurari3935e6f2024-01-19 14:44:47 +000045 "libnix",
Prabir Pradhan44e6e832023-06-06 00:03:25 +000046 ],
47 host_supported: true,
48}
49
Vaibhav Devmurari5766aee2023-11-03 17:21:25 +000050rust_ffi_static {
51 name: "libinputflinger_rs",
52 defaults: ["libinputflinger_rs_defaults"],
53}
54
55rust_test {
56 name: "libinputflinger_rs_test",
57 defaults: ["libinputflinger_rs_defaults"],
58 test_options: {
59 unit_test: true,
60 },
61 test_suites: ["device_tests"],
62 sanitize: {
63 address: true,
64 hwaddress: true,
65 },
66}
67
Prabir Pradhan44e6e832023-06-06 00:03:25 +000068cc_library_headers {
69 name: "inputflinger_rs_bootstrap_cxx_headers",
70 host_supported: true,
71 export_include_dirs: ["ffi"],
72}