Jim Shargo | 7df9f75 | 2023-07-18 20:33:45 +0000 | [diff] [blame] | 1 | // Copyright (C) 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 | package { |
| 16 | default_applicable_licenses: [ |
| 17 | "frameworks_native_libs_nativewindow_license", |
| 18 | ], |
| 19 | } |
| 20 | |
| 21 | rust_bindgen { |
Andrew Walbran | 43bddb6 | 2023-09-01 16:43:09 +0100 | [diff] [blame^] | 22 | name: "libnativewindow_bindgen_internal", |
Jim Shargo | 7df9f75 | 2023-07-18 20:33:45 +0000 | [diff] [blame] | 23 | crate_name: "nativewindow_bindgen", |
| 24 | wrapper_src: "sys/nativewindow_bindings.h", |
| 25 | source_stem: "bindings", |
| 26 | bindgen_flags: [ |
| 27 | "--constified-enum-module=AHardwareBuffer_Format", |
| 28 | "--bitfield-enum=AHardwareBuffer_UsageFlags", |
| 29 | |
| 30 | "--allowlist-file=.*/nativewindow/include/.*\\.h", |
Andrew Walbran | 43bddb6 | 2023-09-01 16:43:09 +0100 | [diff] [blame^] | 31 | "--blocklist-type", |
| 32 | "AParcel", |
| 33 | "--raw-line", |
| 34 | "use binder::unstable_api::AParcel;", |
Jim Shargo | 7df9f75 | 2023-07-18 20:33:45 +0000 | [diff] [blame] | 35 | |
| 36 | "--with-derive-eq", |
| 37 | "--with-derive-partialeq", |
| 38 | ], |
| 39 | shared_libs: [ |
Andrew Walbran | 43bddb6 | 2023-09-01 16:43:09 +0100 | [diff] [blame^] | 40 | "libbinder_ndk", |
Jim Shargo | 7df9f75 | 2023-07-18 20:33:45 +0000 | [diff] [blame] | 41 | "libnativewindow", |
| 42 | ], |
Andrew Walbran | 43bddb6 | 2023-09-01 16:43:09 +0100 | [diff] [blame^] | 43 | rustlibs: [ |
| 44 | "libbinder_rs", |
| 45 | ], |
Jim Shargo | 7df9f75 | 2023-07-18 20:33:45 +0000 | [diff] [blame] | 46 | |
| 47 | // Currently necessary for host builds |
| 48 | // TODO(b/31559095): bionic on host should define this |
| 49 | target: { |
| 50 | darwin: { |
| 51 | enabled: false, |
| 52 | }, |
| 53 | }, |
| 54 | min_sdk_version: "VanillaIceCream", |
Andrew Walbran | 43bddb6 | 2023-09-01 16:43:09 +0100 | [diff] [blame^] | 55 | vendor_available: true, |
| 56 | } |
| 57 | |
| 58 | rust_library { |
| 59 | name: "libnativewindow_bindgen", |
| 60 | crate_name: "nativewindow_bindgen", |
| 61 | srcs: [":libnativewindow_bindgen_internal"], |
| 62 | shared_libs: [ |
| 63 | "libbinder_ndk", |
| 64 | "libnativewindow", |
| 65 | ], |
| 66 | rustlibs: [ |
| 67 | "libbinder_rs", |
| 68 | ], |
| 69 | lints: "none", |
| 70 | clippy_lints: "none", |
| 71 | // Currently necessary for host builds |
| 72 | // TODO(b/31559095): bionic on host should define this |
| 73 | target: { |
| 74 | darwin: { |
| 75 | enabled: false, |
| 76 | }, |
| 77 | }, |
| 78 | min_sdk_version: "VanillaIceCream", |
| 79 | vendor_available: true, |
Jim Shargo | 7df9f75 | 2023-07-18 20:33:45 +0000 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | rust_test { |
| 83 | name: "libnativewindow_bindgen_test", |
Andrew Walbran | 43bddb6 | 2023-09-01 16:43:09 +0100 | [diff] [blame^] | 84 | srcs: [":libnativewindow_bindgen_internal"], |
Jim Shargo | 7df9f75 | 2023-07-18 20:33:45 +0000 | [diff] [blame] | 85 | crate_name: "nativewindow_bindgen_test", |
Andrew Walbran | 43bddb6 | 2023-09-01 16:43:09 +0100 | [diff] [blame^] | 86 | rustlibs: [ |
| 87 | "libbinder_rs", |
| 88 | ], |
Jim Shargo | 7df9f75 | 2023-07-18 20:33:45 +0000 | [diff] [blame] | 89 | test_suites: ["general-tests"], |
| 90 | auto_gen_config: true, |
| 91 | clippy_lints: "none", |
| 92 | lints: "none", |
| 93 | } |
| 94 | |
| 95 | rust_defaults { |
| 96 | name: "libnativewindow_defaults", |
| 97 | srcs: ["src/lib.rs"], |
| 98 | rustlibs: [ |
Andrew Walbran | 43bddb6 | 2023-09-01 16:43:09 +0100 | [diff] [blame^] | 99 | "libbinder_rs", |
Jim Shargo | 7df9f75 | 2023-07-18 20:33:45 +0000 | [diff] [blame] | 100 | "libnativewindow_bindgen", |
| 101 | ], |
| 102 | } |
| 103 | |
| 104 | rust_library { |
| 105 | name: "libnativewindow_rs", |
| 106 | crate_name: "nativewindow", |
| 107 | defaults: ["libnativewindow_defaults"], |
| 108 | |
| 109 | // Currently necessary for host builds |
| 110 | // TODO(b/31559095): bionic on host should define this |
| 111 | target: { |
| 112 | darwin: { |
| 113 | enabled: false, |
| 114 | }, |
| 115 | }, |
| 116 | min_sdk_version: "VanillaIceCream", |
Andrew Walbran | 43bddb6 | 2023-09-01 16:43:09 +0100 | [diff] [blame^] | 117 | vendor_available: true, |
Jim Shargo | 7df9f75 | 2023-07-18 20:33:45 +0000 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | rust_test { |
| 121 | name: "libnativewindow_rs-internal_test", |
| 122 | crate_name: "nativewindow", |
| 123 | defaults: ["libnativewindow_defaults"], |
| 124 | test_suites: ["general-tests"], |
| 125 | } |