blob: eb04209afd96a927fa4a123562ed4cef35849b19 [file] [log] [blame]
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +00001// Copyright 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 // 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_defaults {
25 name: "libkeystore2_test_utils_defaults",
26 defaults: [
27 "keymint_use_latest_hal_aidl_rust",
28 "keystore2_use_latest_aidl_rust",
29 ],
30 rustlibs: [
31 "libanyhow",
32 "libbinder_rs",
33 "libcxx",
34 "libkeystore2_selinux",
35 "liblog_rust",
36 "libnix",
37 "librand",
38 "libserde",
39 "libserde_cbor",
40 "libthiserror",
41 ],
42 static_libs: [
43 "libgtest",
44 "libkeymint_vts_test_utils",
45 "libkeystore2_ffi_test_utils",
46 ],
47 shared_libs: [
48 // libkeymint_vts_test_utils needs to be static for atest,
49 // and that pulls in keymint shared lib dependency
50 "android.hardware.security.keymint-V3-ndk",
51 "libbase",
52 "libbinder",
53 "libbinder_ndk",
54 "libcppbor_external",
55 "libcppcose_rkp",
56 "libcrypto",
57 "libcutils",
58 "libkeymaster_messages",
59 "libkeymaster_portable",
60 "libkeymint_remote_prov_support",
61 "libkeymint_support",
62 "libkeystore-engine",
63 "libutils",
64 "packagemanager_aidl-cpp",
65 ],
66}
67
68rust_library {
69 name: "libkeystore2_test_utils",
70 crate_name: "keystore2_test_utils",
71 srcs: ["lib.rs"],
72 defaults: ["libkeystore2_test_utils_defaults"],
73}
74
75rust_test {
76 name: "keystore2_test_utils_test",
77 srcs: ["lib.rs"],
78 defaults: ["libkeystore2_test_utils_defaults"],
79 test_suites: ["general-tests"],
80 require_root: true,
81 auto_gen_config: true,
82 compile_multilib: "first",
83}
84
85cc_library_static {
86 name: "libkeystore2_ffi_test_utils",
87 srcs: ["ffi_test_utils.cpp"],
88 defaults: [
89 "keymint_vts_defaults",
90 "hidl_defaults",
91 ],
92 generated_headers: [
93 "cxx-bridge-header",
94 "libkeystore2_ffi_test_utils_bridge_header",
95 ],
96 generated_sources: ["libkeystore2_ffi_test_utils_bridge_code"],
97 static_libs: [
98 "libkeymint_vts_test_utils",
99 ],
100 shared_libs: [
101 "libcppbor_external",
102 "libkeymaster_messages",
103 "libkeymaster_portable",
104 "libkeystore-engine",
105 ],
106}
107
108genrule {
109 name: "libkeystore2_ffi_test_utils_bridge_code",
110 tools: ["cxxbridge"],
111 cmd: "$(location cxxbridge) $(in) >> $(out)",
112 srcs: ["ffi_test_utils.rs"],
113 out: ["libkeystore2_test_utils_cxx_generated.cc"],
114}
115
116genrule {
117 name: "libkeystore2_ffi_test_utils_bridge_header",
118 tools: ["cxxbridge"],
119 cmd: "$(location cxxbridge) $(in) --header >> $(out)",
120 srcs: ["ffi_test_utils.rs"],
121 out: ["ffi_test_utils.rs.h"],
122}