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