Prabir Pradhan | 44e6e83 | 2023-06-06 00:03:25 +0000 | [diff] [blame] | 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 | |
| 15 | // Generate the C++ code that Rust calls into. |
Ronish Kalia | 821a4fd | 2024-02-14 14:26:03 +0000 | [diff] [blame] | 16 | package { |
| 17 | default_team: "trendy_team_input_framework", |
| 18 | } |
| 19 | |
Prabir Pradhan | 44e6e83 | 2023-06-06 00:03:25 +0000 | [diff] [blame] | 20 | genrule { |
| 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. |
| 30 | genrule { |
| 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 Devmurari | 5766aee | 2023-11-03 17:21:25 +0000 | [diff] [blame] | 38 | rust_defaults { |
| 39 | name: "libinputflinger_rs_defaults", |
Prabir Pradhan | 44e6e83 | 2023-06-06 00:03:25 +0000 | [diff] [blame] | 40 | crate_name: "inputflinger", |
| 41 | srcs: ["lib.rs"], |
| 42 | rustlibs: [ |
| 43 | "libcxx", |
| 44 | "com.android.server.inputflinger-rust", |
Vaibhav Devmurari | 953e6a4 | 2023-11-21 18:24:19 +0000 | [diff] [blame] | 45 | "android.hardware.input.common-V1-rust", |
Prabir Pradhan | 44e6e83 | 2023-06-06 00:03:25 +0000 | [diff] [blame] | 46 | "libbinder_rs", |
| 47 | "liblog_rust", |
| 48 | "liblogger", |
Vaibhav Devmurari | 3935e6f | 2024-01-19 14:44:47 +0000 | [diff] [blame] | 49 | "libnix", |
Vaibhav Devmurari | 770b6e4 | 2024-06-10 10:29:26 +0000 | [diff] [blame] | 50 | "libinput_rust", |
Prabir Pradhan | 44e6e83 | 2023-06-06 00:03:25 +0000 | [diff] [blame] | 51 | ], |
| 52 | host_supported: true, |
| 53 | } |
| 54 | |
Vaibhav Devmurari | 5766aee | 2023-11-03 17:21:25 +0000 | [diff] [blame] | 55 | rust_ffi_static { |
| 56 | name: "libinputflinger_rs", |
| 57 | defaults: ["libinputflinger_rs_defaults"], |
| 58 | } |
| 59 | |
| 60 | rust_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 Pradhan | 44e6e83 | 2023-06-06 00:03:25 +0000 | [diff] [blame] | 73 | cc_library_headers { |
| 74 | name: "inputflinger_rs_bootstrap_cxx_headers", |
| 75 | host_supported: true, |
| 76 | export_include_dirs: ["ffi"], |
| 77 | } |