blob: 90d0a8e400752ad4bf12e3ae332d6f04ca8057aa [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 ],
19}
20
21rust_bindgen {
Andrew Walbran43bddb62023-09-01 16:43:09 +010022 name: "libnativewindow_bindgen_internal",
Jim Shargo7df9f752023-07-18 20:33:45 +000023 crate_name: "nativewindow_bindgen",
24 wrapper_src: "sys/nativewindow_bindings.h",
25 source_stem: "bindings",
26 bindgen_flags: [
27 "--constified-enum-module=AHardwareBuffer_Format",
28 "--bitfield-enum=AHardwareBuffer_UsageFlags",
29
30 "--allowlist-file=.*/nativewindow/include/.*\\.h",
Andrew Walbran43bddb62023-09-01 16:43:09 +010031 "--blocklist-type",
32 "AParcel",
33 "--raw-line",
34 "use binder::unstable_api::AParcel;",
Jim Shargo7df9f752023-07-18 20:33:45 +000035
36 "--with-derive-eq",
37 "--with-derive-partialeq",
38 ],
39 shared_libs: [
Andrew Walbran43bddb62023-09-01 16:43:09 +010040 "libbinder_ndk",
Jim Shargo7df9f752023-07-18 20:33:45 +000041 "libnativewindow",
42 ],
Andrew Walbran43bddb62023-09-01 16:43:09 +010043 rustlibs: [
44 "libbinder_rs",
45 ],
Jim Shargo7df9f752023-07-18 20:33:45 +000046
47 // Currently necessary for host builds
48 // TODO(b/31559095): bionic on host should define this
49 target: {
50 darwin: {
51 enabled: false,
52 },
53 },
54 min_sdk_version: "VanillaIceCream",
Andrew Walbran43bddb62023-09-01 16:43:09 +010055 vendor_available: true,
56}
57
58rust_library {
59 name: "libnativewindow_bindgen",
60 crate_name: "nativewindow_bindgen",
61 srcs: [":libnativewindow_bindgen_internal"],
62 shared_libs: [
63 "libbinder_ndk",
64 "libnativewindow",
65 ],
66 rustlibs: [
67 "libbinder_rs",
68 ],
69 lints: "none",
70 clippy_lints: "none",
71 // Currently necessary for host builds
72 // TODO(b/31559095): bionic on host should define this
73 target: {
74 darwin: {
75 enabled: false,
76 },
77 },
78 min_sdk_version: "VanillaIceCream",
79 vendor_available: true,
Jim Shargo7df9f752023-07-18 20:33:45 +000080}
81
82rust_test {
83 name: "libnativewindow_bindgen_test",
Andrew Walbran43bddb62023-09-01 16:43:09 +010084 srcs: [":libnativewindow_bindgen_internal"],
Jim Shargo7df9f752023-07-18 20:33:45 +000085 crate_name: "nativewindow_bindgen_test",
Andrew Walbran43bddb62023-09-01 16:43:09 +010086 rustlibs: [
87 "libbinder_rs",
88 ],
Jim Shargo7df9f752023-07-18 20:33:45 +000089 test_suites: ["general-tests"],
90 auto_gen_config: true,
91 clippy_lints: "none",
92 lints: "none",
93}
94
95rust_defaults {
96 name: "libnativewindow_defaults",
97 srcs: ["src/lib.rs"],
98 rustlibs: [
Andrew Walbran43bddb62023-09-01 16:43:09 +010099 "libbinder_rs",
Jim Shargo7df9f752023-07-18 20:33:45 +0000100 "libnativewindow_bindgen",
101 ],
102}
103
104rust_library {
105 name: "libnativewindow_rs",
106 crate_name: "nativewindow",
107 defaults: ["libnativewindow_defaults"],
108
109 // Currently necessary for host builds
110 // TODO(b/31559095): bionic on host should define this
111 target: {
112 darwin: {
113 enabled: false,
114 },
115 },
116 min_sdk_version: "VanillaIceCream",
Andrew Walbran43bddb62023-09-01 16:43:09 +0100117 vendor_available: true,
Jim Shargo7df9f752023-07-18 20:33:45 +0000118}
119
120rust_test {
121 name: "libnativewindow_rs-internal_test",
122 crate_name: "nativewindow",
123 defaults: ["libnativewindow_defaults"],
124 test_suites: ["general-tests"],
125}