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 15package { 16 default_applicable_licenses: [ 17 "frameworks_native_libs_nativewindow_license", 18 ], 19 default_team: "trendy_team_android_core_graphics_stack", 20} 21 22rust_bindgen { 23 name: "libnativewindow_bindgen_internal", 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=ADataSpace", 30 "--bitfield-enum=AHardwareBuffer_UsageFlags", 31 32 "--allowlist-file=.*/nativewindow/include/.*\\.h", 33 "--allowlist-file=.*/include/cutils/.*\\.h", 34 "--allowlist-file=.*/include_outside_system/cutils/.*\\.h", 35 "--blocklist-type", 36 "AParcel", 37 "--raw-line", 38 "use binder::unstable_api::AParcel;", 39 40 "--with-derive-eq", 41 "--with-derive-partialeq", 42 ], 43 shared_libs: [ 44 "libbinder_ndk", 45 "libcutils", 46 "libnativewindow", 47 ], 48 rustlibs: [ 49 "libbinder_rs", 50 ], 51 52 // Currently necessary for host builds 53 // TODO(b/31559095): bionic on host should define this 54 target: { 55 darwin: { 56 enabled: false, 57 }, 58 }, 59 min_sdk_version: "VanillaIceCream", 60 vendor_available: true, 61 apex_available: [ 62 "//apex_available:platform", 63 "com.android.virt", 64 ], 65} 66 67rust_library { 68 name: "libnativewindow_bindgen", 69 crate_name: "nativewindow_bindgen", 70 srcs: [":libnativewindow_bindgen_internal"], 71 shared_libs: [ 72 "libbinder_ndk", 73 "libcutils", 74 "libnativewindow", 75 ], 76 rustlibs: [ 77 "libbinder_rs", 78 ], 79 lints: "none", 80 clippy_lints: "none", 81 // Currently necessary for host builds 82 // TODO(b/31559095): bionic on host should define this 83 target: { 84 darwin: { 85 enabled: false, 86 }, 87 }, 88 min_sdk_version: "VanillaIceCream", 89 vendor_available: true, 90 apex_available: [ 91 "//apex_available:platform", 92 "com.android.virt", 93 ], 94} 95 96rust_test { 97 name: "libnativewindow_bindgen_test", 98 srcs: [":libnativewindow_bindgen_internal"], 99 crate_name: "nativewindow_bindgen_test", 100 rustlibs: [ 101 "libbinder_rs", 102 ], 103 test_suites: ["general-tests"], 104 auto_gen_config: true, 105 clippy_lints: "none", 106 lints: "none", 107} 108 109rust_defaults { 110 name: "libnativewindow_defaults", 111 srcs: ["src/lib.rs"], 112 rustlibs: [ 113 "android.hardware.common-V2-rust", 114 "libbinder_rs", 115 "libbitflags", 116 "libnativewindow_bindgen", 117 ], 118} 119 120rust_library { 121 name: "libnativewindow_rs", 122 crate_name: "nativewindow", 123 defaults: ["libnativewindow_defaults"], 124 125 // Currently necessary for host builds 126 // TODO(b/31559095): bionic on host should define this 127 target: { 128 darwin: { 129 enabled: false, 130 }, 131 }, 132 min_sdk_version: "VanillaIceCream", 133 vendor_available: true, 134 apex_available: [ 135 "//apex_available:platform", 136 "com.android.virt", 137 ], 138} 139 140rust_test { 141 name: "libnativewindow_rs-internal_test", 142 crate_name: "nativewindow", 143 defaults: ["libnativewindow_defaults"], 144 test_suites: ["general-tests"], 145} 146