Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 1 | // 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 | |
| 15 | package { |
| 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 | |
| 24 | rust_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: [ |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 43 | "libkeystore2_ffi_test_utils", |
| 44 | ], |
| 45 | shared_libs: [ |
Rajesh Nyamagoud | 19fe29a | 2023-10-04 18:36:55 +0000 | [diff] [blame^] | 46 | "libbase", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 47 | "libcrypto", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 48 | "libkeymaster_portable", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 49 | "libkeymint_support", |
| 50 | "libkeystore-engine", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 51 | ], |
| 52 | } |
| 53 | |
| 54 | rust_library { |
| 55 | name: "libkeystore2_test_utils", |
| 56 | crate_name: "keystore2_test_utils", |
| 57 | srcs: ["lib.rs"], |
| 58 | defaults: ["libkeystore2_test_utils_defaults"], |
| 59 | } |
| 60 | |
| 61 | rust_test { |
| 62 | name: "keystore2_test_utils_test", |
| 63 | srcs: ["lib.rs"], |
| 64 | defaults: ["libkeystore2_test_utils_defaults"], |
| 65 | test_suites: ["general-tests"], |
| 66 | require_root: true, |
| 67 | auto_gen_config: true, |
| 68 | compile_multilib: "first", |
| 69 | } |
| 70 | |
| 71 | cc_library_static { |
| 72 | name: "libkeystore2_ffi_test_utils", |
| 73 | srcs: ["ffi_test_utils.cpp"], |
| 74 | defaults: [ |
Rajesh Nyamagoud | 19fe29a | 2023-10-04 18:36:55 +0000 | [diff] [blame^] | 75 | "keymint_use_latest_hal_aidl_ndk_shared", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 76 | ], |
| 77 | generated_headers: [ |
| 78 | "cxx-bridge-header", |
| 79 | "libkeystore2_ffi_test_utils_bridge_header", |
| 80 | ], |
| 81 | generated_sources: ["libkeystore2_ffi_test_utils_bridge_code"], |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 82 | shared_libs: [ |
Rajesh Nyamagoud | 19fe29a | 2023-10-04 18:36:55 +0000 | [diff] [blame^] | 83 | "libbase", |
| 84 | "libcrypto", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 85 | "libcppbor_external", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 86 | "libkeymaster_portable", |
| 87 | "libkeystore-engine", |
Rajesh Nyamagoud | 19fe29a | 2023-10-04 18:36:55 +0000 | [diff] [blame^] | 88 | "libkeymint_support", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 89 | ], |
| 90 | } |
| 91 | |
| 92 | genrule { |
| 93 | name: "libkeystore2_ffi_test_utils_bridge_code", |
| 94 | tools: ["cxxbridge"], |
| 95 | cmd: "$(location cxxbridge) $(in) >> $(out)", |
| 96 | srcs: ["ffi_test_utils.rs"], |
| 97 | out: ["libkeystore2_test_utils_cxx_generated.cc"], |
| 98 | } |
| 99 | |
| 100 | genrule { |
| 101 | name: "libkeystore2_ffi_test_utils_bridge_header", |
| 102 | tools: ["cxxbridge"], |
| 103 | cmd: "$(location cxxbridge) $(in) --header >> $(out)", |
| 104 | srcs: ["ffi_test_utils.rs"], |
| 105 | out: ["ffi_test_utils.rs.h"], |
| 106 | } |