blob: faab48b1ce5c618a42f4db8e5824e3f834203f89 [file] [log] [blame]
Jim Shargo7df9f752023-07-18 20:33:45 +00001// 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 ],
John Reck38bc8a82024-02-21 17:08:27 -050019 default_team: "trendy_team_android_core_graphics_stack",
Jim Shargo7df9f752023-07-18 20:33:45 +000020}
21
22rust_bindgen {
Andrew Walbran43bddb62023-09-01 16:43:09 +010023 name: "libnativewindow_bindgen_internal",
Jim Shargo7df9f752023-07-18 20:33:45 +000024 crate_name: "nativewindow_bindgen",
25 wrapper_src: "sys/nativewindow_bindings.h",
26 source_stem: "bindings",
27 bindgen_flags: [
28 "--constified-enum-module=AHardwareBuffer_Format",
Andrew Walbran78c65342024-09-27 14:52:38 +010029 "--bitfield-enum=ADataSpace",
Jim Shargo7df9f752023-07-18 20:33:45 +000030 "--bitfield-enum=AHardwareBuffer_UsageFlags",
31
32 "--allowlist-file=.*/nativewindow/include/.*\\.h",
Andrew Walbran9487efd2024-08-20 18:37:59 +010033 "--allowlist-file=.*/include/cutils/.*\\.h",
34 "--allowlist-file=.*/include_outside_system/cutils/.*\\.h",
Andrew Walbran43bddb62023-09-01 16:43:09 +010035 "--blocklist-type",
36 "AParcel",
37 "--raw-line",
38 "use binder::unstable_api::AParcel;",
Jim Shargo7df9f752023-07-18 20:33:45 +000039
40 "--with-derive-eq",
41 "--with-derive-partialeq",
42 ],
43 shared_libs: [
Andrew Walbran43bddb62023-09-01 16:43:09 +010044 "libbinder_ndk",
Andrew Walbran9487efd2024-08-20 18:37:59 +010045 "libcutils",
Jim Shargo7df9f752023-07-18 20:33:45 +000046 "libnativewindow",
47 ],
Andrew Walbran43bddb62023-09-01 16:43:09 +010048 rustlibs: [
49 "libbinder_rs",
50 ],
Jim Shargo7df9f752023-07-18 20:33:45 +000051
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",
Andrew Walbran43bddb62023-09-01 16:43:09 +010060 vendor_available: true,
Jiyong Park30cfde32024-04-01 16:31:38 +090061 apex_available: [
62 "//apex_available:platform",
63 "com.android.virt",
64 ],
Andrew Walbran43bddb62023-09-01 16:43:09 +010065}
66
67rust_library {
68 name: "libnativewindow_bindgen",
69 crate_name: "nativewindow_bindgen",
70 srcs: [":libnativewindow_bindgen_internal"],
71 shared_libs: [
72 "libbinder_ndk",
Andrew Walbran9487efd2024-08-20 18:37:59 +010073 "libcutils",
Andrew Walbran43bddb62023-09-01 16:43:09 +010074 "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,
Jiyong Park30cfde32024-04-01 16:31:38 +090090 apex_available: [
91 "//apex_available:platform",
92 "com.android.virt",
93 ],
Jim Shargo7df9f752023-07-18 20:33:45 +000094}
95
96rust_test {
97 name: "libnativewindow_bindgen_test",
Andrew Walbran43bddb62023-09-01 16:43:09 +010098 srcs: [":libnativewindow_bindgen_internal"],
Jim Shargo7df9f752023-07-18 20:33:45 +000099 crate_name: "nativewindow_bindgen_test",
Andrew Walbran43bddb62023-09-01 16:43:09 +0100100 rustlibs: [
101 "libbinder_rs",
102 ],
Jim Shargo7df9f752023-07-18 20:33:45 +0000103 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: [
Andrew Walbran9639e122024-10-22 18:27:38 +0100113 "android.hardware.common-V2-rust",
Andrew Walbran43bddb62023-09-01 16:43:09 +0100114 "libbinder_rs",
Andrew Walbran78c65342024-09-27 14:52:38 +0100115 "libbitflags",
Jim Shargo7df9f752023-07-18 20:33:45 +0000116 "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",
Andrew Walbran43bddb62023-09-01 16:43:09 +0100133 vendor_available: true,
Jiyong Park30cfde32024-04-01 16:31:38 +0900134 apex_available: [
135 "//apex_available:platform",
136 "com.android.virt",
137 ],
Jim Shargo7df9f752023-07-18 20:33:45 +0000138}
139
140rust_test {
141 name: "libnativewindow_rs-internal_test",
142 crate_name: "nativewindow",
143 defaults: ["libnativewindow_defaults"],
144 test_suites: ["general-tests"],
145}