blob: a3df4820ba3b8006b6796e9f61ae4f1e21975816 [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",
29 "--bitfield-enum=AHardwareBuffer_UsageFlags",
30
31 "--allowlist-file=.*/nativewindow/include/.*\\.h",
Andrew Walbran43bddb62023-09-01 16:43:09 +010032 "--blocklist-type",
33 "AParcel",
34 "--raw-line",
35 "use binder::unstable_api::AParcel;",
Jim Shargo7df9f752023-07-18 20:33:45 +000036
37 "--with-derive-eq",
38 "--with-derive-partialeq",
39 ],
40 shared_libs: [
Andrew Walbran43bddb62023-09-01 16:43:09 +010041 "libbinder_ndk",
Jim Shargo7df9f752023-07-18 20:33:45 +000042 "libnativewindow",
43 ],
Andrew Walbran43bddb62023-09-01 16:43:09 +010044 rustlibs: [
45 "libbinder_rs",
46 ],
Jim Shargo7df9f752023-07-18 20:33:45 +000047
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 Walbran43bddb62023-09-01 16:43:09 +010056 vendor_available: true,
57}
58
59rust_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 Shargo7df9f752023-07-18 20:33:45 +000081}
82
83rust_test {
84 name: "libnativewindow_bindgen_test",
Andrew Walbran43bddb62023-09-01 16:43:09 +010085 srcs: [":libnativewindow_bindgen_internal"],
Jim Shargo7df9f752023-07-18 20:33:45 +000086 crate_name: "nativewindow_bindgen_test",
Andrew Walbran43bddb62023-09-01 16:43:09 +010087 rustlibs: [
88 "libbinder_rs",
89 ],
Jim Shargo7df9f752023-07-18 20:33:45 +000090 test_suites: ["general-tests"],
91 auto_gen_config: true,
92 clippy_lints: "none",
93 lints: "none",
94}
95
96rust_defaults {
97 name: "libnativewindow_defaults",
98 srcs: ["src/lib.rs"],
99 rustlibs: [
Andrew Walbran43bddb62023-09-01 16:43:09 +0100100 "libbinder_rs",
Jim Shargo7df9f752023-07-18 20:33:45 +0000101 "libnativewindow_bindgen",
102 ],
103}
104
105rust_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 Walbran43bddb62023-09-01 16:43:09 +0100118 vendor_available: true,
Jim Shargo7df9f752023-07-18 20:33:45 +0000119}
120
121rust_test {
122 name: "libnativewindow_rs-internal_test",
123 crate_name: "nativewindow",
124 defaults: ["libnativewindow_defaults"],
125 test_suites: ["general-tests"],
126}