blob: d68d6ba1afe1f297ed38feb10c6cde60d23dab6d [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 Walbran9487efd2024-08-20 18:37:59 +010032 "--allowlist-file=.*/include/cutils/.*\\.h",
33 "--allowlist-file=.*/include_outside_system/cutils/.*\\.h",
Andrew Walbran43bddb62023-09-01 16:43:09 +010034 "--blocklist-type",
35 "AParcel",
36 "--raw-line",
37 "use binder::unstable_api::AParcel;",
Jim Shargo7df9f752023-07-18 20:33:45 +000038
39 "--with-derive-eq",
40 "--with-derive-partialeq",
41 ],
42 shared_libs: [
Andrew Walbran43bddb62023-09-01 16:43:09 +010043 "libbinder_ndk",
Andrew Walbran9487efd2024-08-20 18:37:59 +010044 "libcutils",
Jim Shargo7df9f752023-07-18 20:33:45 +000045 "libnativewindow",
46 ],
Andrew Walbran43bddb62023-09-01 16:43:09 +010047 rustlibs: [
48 "libbinder_rs",
49 ],
Jim Shargo7df9f752023-07-18 20:33:45 +000050
51 // Currently necessary for host builds
52 // TODO(b/31559095): bionic on host should define this
53 target: {
54 darwin: {
55 enabled: false,
56 },
57 },
58 min_sdk_version: "VanillaIceCream",
Andrew Walbran43bddb62023-09-01 16:43:09 +010059 vendor_available: true,
Jiyong Park30cfde32024-04-01 16:31:38 +090060 apex_available: [
61 "//apex_available:platform",
62 "com.android.virt",
63 ],
Andrew Walbran43bddb62023-09-01 16:43:09 +010064}
65
66rust_library {
67 name: "libnativewindow_bindgen",
68 crate_name: "nativewindow_bindgen",
69 srcs: [":libnativewindow_bindgen_internal"],
70 shared_libs: [
71 "libbinder_ndk",
Andrew Walbran9487efd2024-08-20 18:37:59 +010072 "libcutils",
Andrew Walbran43bddb62023-09-01 16:43:09 +010073 "libnativewindow",
74 ],
75 rustlibs: [
76 "libbinder_rs",
77 ],
78 lints: "none",
79 clippy_lints: "none",
80 // Currently necessary for host builds
81 // TODO(b/31559095): bionic on host should define this
82 target: {
83 darwin: {
84 enabled: false,
85 },
86 },
87 min_sdk_version: "VanillaIceCream",
88 vendor_available: true,
Jiyong Park30cfde32024-04-01 16:31:38 +090089 apex_available: [
90 "//apex_available:platform",
91 "com.android.virt",
92 ],
Jim Shargo7df9f752023-07-18 20:33:45 +000093}
94
95rust_test {
96 name: "libnativewindow_bindgen_test",
Andrew Walbran43bddb62023-09-01 16:43:09 +010097 srcs: [":libnativewindow_bindgen_internal"],
Jim Shargo7df9f752023-07-18 20:33:45 +000098 crate_name: "nativewindow_bindgen_test",
Andrew Walbran43bddb62023-09-01 16:43:09 +010099 rustlibs: [
100 "libbinder_rs",
101 ],
Jim Shargo7df9f752023-07-18 20:33:45 +0000102 test_suites: ["general-tests"],
103 auto_gen_config: true,
104 clippy_lints: "none",
105 lints: "none",
106}
107
108rust_defaults {
109 name: "libnativewindow_defaults",
110 srcs: ["src/lib.rs"],
111 rustlibs: [
Andrew Walbran43bddb62023-09-01 16:43:09 +0100112 "libbinder_rs",
Jim Shargo7df9f752023-07-18 20:33:45 +0000113 "libnativewindow_bindgen",
114 ],
115}
116
117rust_library {
118 name: "libnativewindow_rs",
119 crate_name: "nativewindow",
120 defaults: ["libnativewindow_defaults"],
121
122 // Currently necessary for host builds
123 // TODO(b/31559095): bionic on host should define this
124 target: {
125 darwin: {
126 enabled: false,
127 },
128 },
129 min_sdk_version: "VanillaIceCream",
Andrew Walbran43bddb62023-09-01 16:43:09 +0100130 vendor_available: true,
Jiyong Park30cfde32024-04-01 16:31:38 +0900131 apex_available: [
132 "//apex_available:platform",
133 "com.android.virt",
134 ],
Jim Shargo7df9f752023-07-18 20:33:45 +0000135}
136
137rust_test {
138 name: "libnativewindow_rs-internal_test",
139 crate_name: "nativewindow",
140 defaults: ["libnativewindow_defaults"],
141 test_suites: ["general-tests"],
142}