blob: 57da27fc671a5a256b16ac467e965847ab2fb86f [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: [
Luca Stefani481b5d62024-01-17 11:42:06 +010031 "android.security.authorization-rust",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000032 "libanyhow",
33 "libbinder_rs",
34 "libcxx",
35 "libkeystore2_selinux",
36 "liblog_rust",
37 "libnix",
38 "librand",
Rajesh Nyamagoud75dfa0c2023-05-11 00:31:40 +000039 "librustutils",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000040 "libserde",
41 "libserde_cbor",
42 "libthiserror",
43 ],
44 static_libs: [
Rajesh Nyamagoud76311aa2024-08-29 22:28:27 +000045 "libcppbor",
46 "libkeymaster_portable",
47 "libkeymint_support",
Rajesh Nyamagoud43473572024-01-03 01:01:17 +000048 "libkeystore-engine",
Luca Stefani481b5d62024-01-17 11:42:06 +010049 "libkeystore2_ffi_test_utils",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000050 ],
51 shared_libs: [
Rajesh Nyamagoud19fe29a2023-10-04 18:36:55 +000052 "libbase",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000053 "libcrypto",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000054 ],
55}
56
57rust_library {
58 name: "libkeystore2_test_utils",
59 crate_name: "keystore2_test_utils",
60 srcs: ["lib.rs"],
61 defaults: ["libkeystore2_test_utils_defaults"],
Rajesh Nyamagoud76311aa2024-08-29 22:28:27 +000062 static_libs: [
63 // Also include static_libs for the NDK variants so that they are available
64 // for dependencies.
Karuna Wadhera542212b2024-11-01 21:23:50 +000065 "android.system.keystore2-V5-ndk",
66 "android.hardware.security.keymint-V4-ndk",
Rajesh Nyamagoud76311aa2024-08-29 22:28:27 +000067 ],
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000068}
69
70rust_test {
71 name: "keystore2_test_utils_test",
72 srcs: ["lib.rs"],
73 defaults: ["libkeystore2_test_utils_defaults"],
74 test_suites: ["general-tests"],
75 require_root: true,
76 auto_gen_config: true,
77 compile_multilib: "first",
78}
79
80cc_library_static {
81 name: "libkeystore2_ffi_test_utils",
82 srcs: ["ffi_test_utils.cpp"],
83 defaults: [
Rajesh Nyamagoud76311aa2024-08-29 22:28:27 +000084 "keymint_use_latest_hal_aidl_ndk_static",
85 "keystore2_use_latest_aidl_ndk_static",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000086 ],
87 generated_headers: [
88 "cxx-bridge-header",
89 "libkeystore2_ffi_test_utils_bridge_header",
90 ],
91 generated_sources: ["libkeystore2_ffi_test_utils_bridge_code"],
Rajesh Nyamagoud76311aa2024-08-29 22:28:27 +000092 static_libs: [
93 "libkeymaster_portable",
94 "libkeymint_support",
95 "libkeystore-engine",
96 ],
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000097 shared_libs: [
Rajesh Nyamagoud19fe29a2023-10-04 18:36:55 +000098 "libbase",
99 "libcrypto",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +0000100 ],
101}
102
103genrule {
104 name: "libkeystore2_ffi_test_utils_bridge_code",
105 tools: ["cxxbridge"],
106 cmd: "$(location cxxbridge) $(in) >> $(out)",
107 srcs: ["ffi_test_utils.rs"],
108 out: ["libkeystore2_test_utils_cxx_generated.cc"],
109}
110
111genrule {
112 name: "libkeystore2_ffi_test_utils_bridge_header",
113 tools: ["cxxbridge"],
114 cmd: "$(location cxxbridge) $(in) --header >> $(out)",
115 srcs: ["ffi_test_utils.rs"],
116 out: ["ffi_test_utils.rs.h"],
117}