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