blob: 23c1691b2848e4bf16a5b52482cd53888c1820d6 [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
34rust_ffi_static {
35 name: "libinputflinger_rs",
36 crate_name: "inputflinger",
37 srcs: ["lib.rs"],
38 rustlibs: [
39 "libcxx",
40 "com.android.server.inputflinger-rust",
41 "libbinder_rs",
42 "liblog_rust",
43 "liblogger",
44 ],
45 host_supported: true,
46}
47
48cc_library_headers {
49 name: "inputflinger_rs_bootstrap_cxx_headers",
50 host_supported: true,
51 export_include_dirs: ["ffi"],
52}