blob: 97740dbcd80584984650fbf5d98319702cd9953e [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,
Jiyong Park30cfde32024-04-01 16:31:38 +090057 apex_available: [
58 "//apex_available:platform",
59 "com.android.virt",
60 ],
Andrew Walbran43bddb62023-09-01 16:43:09 +010061}
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,
Jiyong Park30cfde32024-04-01 16:31:38 +090085 apex_available: [
86 "//apex_available:platform",
87 "com.android.virt",
88 ],
Jim Shargo7df9f752023-07-18 20:33:45 +000089}
90
91rust_test {
92 name: "libnativewindow_bindgen_test",
Andrew Walbran43bddb62023-09-01 16:43:09 +010093 srcs: [":libnativewindow_bindgen_internal"],
Jim Shargo7df9f752023-07-18 20:33:45 +000094 crate_name: "nativewindow_bindgen_test",
Andrew Walbran43bddb62023-09-01 16:43:09 +010095 rustlibs: [
96 "libbinder_rs",
97 ],
Jim Shargo7df9f752023-07-18 20:33:45 +000098 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: [
Andrew Walbran43bddb62023-09-01 16:43:09 +0100108 "libbinder_rs",
Jim Shargo7df9f752023-07-18 20:33:45 +0000109 "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",
Andrew Walbran43bddb62023-09-01 16:43:09 +0100126 vendor_available: true,
Jiyong Park30cfde32024-04-01 16:31:38 +0900127 apex_available: [
128 "//apex_available:platform",
129 "com.android.virt",
130 ],
Jim Shargo7df9f752023-07-18 20:33:45 +0000131}
132
133rust_test {
134 name: "libnativewindow_rs-internal_test",
135 crate_name: "nativewindow",
136 defaults: ["libnativewindow_defaults"],
137 test_suites: ["general-tests"],
138}