1// Copyright 2021, 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    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "system_security_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["system_security_license"],
22}
23
24rust_library {
25    name: "libkeystore2_vintf_rust",
26    crate_name: "keystore2_vintf",
27    srcs: ["lib.rs"],
28    rustlibs: [
29        "libkeystore2_vintf_bindgen",
30    ],
31    shared_libs: [
32        "libkeystore2_vintf_cpp",
33        "libvintf",
34    ],
35}
36
37cc_library {
38    name: "libkeystore2_vintf_cpp",
39    srcs: [
40        "vintf.cpp",
41    ],
42    shared_libs: [
43        "libvintf",
44    ],
45}
46
47rust_bindgen {
48    name: "libkeystore2_vintf_bindgen",
49    wrapper_src: "vintf.hpp",
50    crate_name: "keystore2_vintf_bindgen",
51    source_stem: "bindings",
52    host_supported: true,
53    shared_libs: ["libvintf"],
54    bindgen_flags: [
55        "--size_t-is-usize",
56        "--allowlist-function", "getHalNames",
57        "--allowlist-function", "getHalNamesAndVersions",
58        "--allowlist-function", "getHidlInstances",
59        "--allowlist-function", "getAidlInstances",
60        "--allowlist-function", "freeNames",
61    ],
62}
63
64rust_test {
65    name: "keystore2_vintf_test",
66    crate_name: "keystore2_vintf_test",
67    srcs: ["lib.rs"],
68    test_suites: ["general-tests"],
69    auto_gen_config: true,
70    rustlibs: [
71        "libkeystore2_vintf_bindgen",
72    ],
73    static_libs: [
74        "libkeystore2_vintf_cpp",
75    ],
76    shared_libs: [
77        "libc++",
78        "libvintf",
79    ],
80}
81