blob: 602c98c0d9b749b979a7db761f0bbf8d6a7201bf [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",
Rajesh Nyamagoud75dfa0c2023-05-11 00:31:40 +000038 "librustutils",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000039 "libserde",
40 "libserde_cbor",
41 "libthiserror",
James Willcoxd215da82023-10-03 21:31:31 +000042 "android.security.authorization-rust",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000043 ],
44 static_libs: [
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000045 "libkeystore2_ffi_test_utils",
Rajesh Nyamagoud43473572024-01-03 01:01:17 +000046 "libkeystore-engine",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000047 ],
48 shared_libs: [
Shaquille Johnsonac3c2cd2024-01-03 18:30:11 +000049 "android.system.keystore2-V4-ndk",
Rajesh Nyamagoud19fe29a2023-10-04 18:36:55 +000050 "libbase",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000051 "libcrypto",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000052 "libkeymaster_portable",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000053 "libkeymint_support",
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"],
62}
63
64rust_test {
65 name: "keystore2_test_utils_test",
66 srcs: ["lib.rs"],
67 defaults: ["libkeystore2_test_utils_defaults"],
68 test_suites: ["general-tests"],
69 require_root: true,
70 auto_gen_config: true,
71 compile_multilib: "first",
72}
73
74cc_library_static {
75 name: "libkeystore2_ffi_test_utils",
76 srcs: ["ffi_test_utils.cpp"],
77 defaults: [
Rajesh Nyamagoud19fe29a2023-10-04 18:36:55 +000078 "keymint_use_latest_hal_aidl_ndk_shared",
Rajesh Nyamagoud43473572024-01-03 01:01:17 +000079 "keystore2_use_latest_aidl_ndk_shared",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000080 ],
81 generated_headers: [
82 "cxx-bridge-header",
83 "libkeystore2_ffi_test_utils_bridge_header",
84 ],
85 generated_sources: ["libkeystore2_ffi_test_utils_bridge_code"],
Rajesh Nyamagoud43473572024-01-03 01:01:17 +000086 static_libs: ["libkeystore-engine"],
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000087 shared_libs: [
Rajesh Nyamagoud19fe29a2023-10-04 18:36:55 +000088 "libbase",
89 "libcrypto",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000090 "libkeymaster_portable",
Rajesh Nyamagoud19fe29a2023-10-04 18:36:55 +000091 "libkeymint_support",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000092 ],
93}
94
95genrule {
96 name: "libkeystore2_ffi_test_utils_bridge_code",
97 tools: ["cxxbridge"],
98 cmd: "$(location cxxbridge) $(in) >> $(out)",
99 srcs: ["ffi_test_utils.rs"],
100 out: ["libkeystore2_test_utils_cxx_generated.cc"],
101}
102
103genrule {
104 name: "libkeystore2_ffi_test_utils_bridge_header",
105 tools: ["cxxbridge"],
106 cmd: "$(location cxxbridge) $(in) --header >> $(out)",
107 srcs: ["ffi_test_utils.rs"],
108 out: ["ffi_test_utils.rs.h"],
109}