blob: dc1575ca3357c40cfd9ba1b96570e397079e7807 [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 {
22 name: "libnativewindow_bindgen",
23 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",
31
32 "--with-derive-eq",
33 "--with-derive-partialeq",
34 ],
35 shared_libs: [
36 "libnativewindow",
37 ],
38
39 // Currently necessary for host builds
40 // TODO(b/31559095): bionic on host should define this
41 target: {
42 darwin: {
43 enabled: false,
44 },
45 },
46 min_sdk_version: "VanillaIceCream",
47}
48
49rust_test {
50 name: "libnativewindow_bindgen_test",
51 srcs: [":libnativewindow_bindgen"],
52 crate_name: "nativewindow_bindgen_test",
53 test_suites: ["general-tests"],
54 auto_gen_config: true,
55 clippy_lints: "none",
56 lints: "none",
57}
58
59rust_defaults {
60 name: "libnativewindow_defaults",
61 srcs: ["src/lib.rs"],
62 rustlibs: [
63 "libnativewindow_bindgen",
64 ],
65}
66
67rust_library {
68 name: "libnativewindow_rs",
69 crate_name: "nativewindow",
70 defaults: ["libnativewindow_defaults"],
71
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}
81
82rust_test {
83 name: "libnativewindow_rs-internal_test",
84 crate_name: "nativewindow",
85 defaults: ["libnativewindow_defaults"],
86 test_suites: ["general-tests"],
87}