blob: 5b7cc2d4326b36a04f16e3d07fd1d41ce4fe27ff [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.
Ronish Kalia821a4fd2024-02-14 14:26:03 +000016package {
17 default_team: "trendy_team_input_framework",
18}
19
Prabir Pradhan44e6e832023-06-06 00:03:25 +000020genrule {
21 name: "inputflinger_rs_bootstrap_bridge_code",
22 tools: ["cxxbridge"],
23 cmd: "$(location cxxbridge) $(in) >> $(out)",
24 srcs: ["lib.rs"],
25 out: ["inputflinger_rs_bootstrap_cxx_generated.cc"],
26}
27
28// Generate a C++ header containing the C++ bindings
29// to the Rust exported functions in lib.rs.
30genrule {
31 name: "inputflinger_rs_bootstrap_bridge_header",
32 tools: ["cxxbridge"],
33 cmd: "$(location cxxbridge) $(in) --header >> $(out)",
34 srcs: ["lib.rs"],
35 out: ["inputflinger_bootstrap.rs.h"],
36}
37
Vaibhav Devmurari5766aee2023-11-03 17:21:25 +000038rust_defaults {
39 name: "libinputflinger_rs_defaults",
Prabir Pradhan44e6e832023-06-06 00:03:25 +000040 crate_name: "inputflinger",
41 srcs: ["lib.rs"],
42 rustlibs: [
43 "libcxx",
44 "com.android.server.inputflinger-rust",
Vaibhav Devmurari953e6a42023-11-21 18:24:19 +000045 "android.hardware.input.common-V1-rust",
Prabir Pradhan44e6e832023-06-06 00:03:25 +000046 "libbinder_rs",
47 "liblog_rust",
48 "liblogger",
Vaibhav Devmurari3935e6f2024-01-19 14:44:47 +000049 "libnix",
Vaibhav Devmurari770b6e42024-06-10 10:29:26 +000050 "libinput_rust",
Prabir Pradhan44e6e832023-06-06 00:03:25 +000051 ],
52 host_supported: true,
53}
54
Vaibhav Devmurari5766aee2023-11-03 17:21:25 +000055rust_ffi_static {
56 name: "libinputflinger_rs",
57 defaults: ["libinputflinger_rs_defaults"],
58}
59
60rust_test {
61 name: "libinputflinger_rs_test",
62 defaults: ["libinputflinger_rs_defaults"],
63 test_options: {
64 unit_test: true,
65 },
66 test_suites: ["device_tests"],
67 sanitize: {
68 address: true,
69 hwaddress: true,
70 },
71}
72
Prabir Pradhan44e6e832023-06-06 00:03:25 +000073cc_library_headers {
74 name: "inputflinger_rs_bootstrap_cxx_headers",
75 host_supported: true,
76 export_include_dirs: ["ffi"],
77}