blob: c16aa124497ace42811505d762bcfb71e1f7111e [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",
46 ],
47 shared_libs: [
Rajesh Nyamagoud19fe29a2023-10-04 18:36:55 +000048 "libbase",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000049 "libcrypto",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000050 "libkeymaster_portable",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000051 "libkeymint_support",
52 "libkeystore-engine",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000053 ],
54}
55
56rust_library {
57 name: "libkeystore2_test_utils",
58 crate_name: "keystore2_test_utils",
59 srcs: ["lib.rs"],
60 defaults: ["libkeystore2_test_utils_defaults"],
61}
62
63rust_test {
64 name: "keystore2_test_utils_test",
65 srcs: ["lib.rs"],
66 defaults: ["libkeystore2_test_utils_defaults"],
67 test_suites: ["general-tests"],
68 require_root: true,
69 auto_gen_config: true,
70 compile_multilib: "first",
71}
72
73cc_library_static {
74 name: "libkeystore2_ffi_test_utils",
75 srcs: ["ffi_test_utils.cpp"],
76 defaults: [
Rajesh Nyamagoud19fe29a2023-10-04 18:36:55 +000077 "keymint_use_latest_hal_aidl_ndk_shared",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000078 ],
79 generated_headers: [
80 "cxx-bridge-header",
81 "libkeystore2_ffi_test_utils_bridge_header",
82 ],
83 generated_sources: ["libkeystore2_ffi_test_utils_bridge_code"],
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000084 shared_libs: [
Rajesh Nyamagoud19fe29a2023-10-04 18:36:55 +000085 "libbase",
86 "libcrypto",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000087 "libkeymaster_portable",
88 "libkeystore-engine",
Rajesh Nyamagoud19fe29a2023-10-04 18:36:55 +000089 "libkeymint_support",
Rajesh Nyamagoud10f02e72023-08-17 22:27:40 +000090 ],
91}
92
93genrule {
94 name: "libkeystore2_ffi_test_utils_bridge_code",
95 tools: ["cxxbridge"],
96 cmd: "$(location cxxbridge) $(in) >> $(out)",
97 srcs: ["ffi_test_utils.rs"],
98 out: ["libkeystore2_test_utils_cxx_generated.cc"],
99}
100
101genrule {
102 name: "libkeystore2_ffi_test_utils_bridge_header",
103 tools: ["cxxbridge"],
104 cmd: "$(location cxxbridge) $(in) --header >> $(out)",
105 srcs: ["ffi_test_utils.rs"],
106 out: ["ffi_test_utils.rs.h"],
107}