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: [ |
Luca Stefani | 481b5d6 | 2024-01-17 11:42:06 +0100 | [diff] [blame] | 31 | "android.security.authorization-rust", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 32 | "libanyhow", |
| 33 | "libbinder_rs", |
| 34 | "libcxx", |
| 35 | "libkeystore2_selinux", |
| 36 | "liblog_rust", |
| 37 | "libnix", |
| 38 | "librand", |
Rajesh Nyamagoud | 75dfa0c | 2023-05-11 00:31:40 +0000 | [diff] [blame] | 39 | "librustutils", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 40 | "libserde", |
| 41 | "libserde_cbor", |
| 42 | "libthiserror", |
| 43 | ], |
| 44 | static_libs: [ |
Rajesh Nyamagoud | 76311aa | 2024-08-29 22:28:27 +0000 | [diff] [blame] | 45 | "libcppbor", |
| 46 | "libkeymaster_portable", |
| 47 | "libkeymint_support", |
Rajesh Nyamagoud | 4347357 | 2024-01-03 01:01:17 +0000 | [diff] [blame] | 48 | "libkeystore-engine", |
Luca Stefani | 481b5d6 | 2024-01-17 11:42:06 +0100 | [diff] [blame] | 49 | "libkeystore2_ffi_test_utils", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 50 | ], |
| 51 | shared_libs: [ |
Rajesh Nyamagoud | 19fe29a | 2023-10-04 18:36:55 +0000 | [diff] [blame] | 52 | "libbase", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 53 | "libcrypto", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 54 | ], |
| 55 | } |
| 56 | |
| 57 | rust_library { |
| 58 | name: "libkeystore2_test_utils", |
| 59 | crate_name: "keystore2_test_utils", |
| 60 | srcs: ["lib.rs"], |
| 61 | defaults: ["libkeystore2_test_utils_defaults"], |
Rajesh Nyamagoud | 76311aa | 2024-08-29 22:28:27 +0000 | [diff] [blame] | 62 | static_libs: [ |
| 63 | // Also include static_libs for the NDK variants so that they are available |
| 64 | // for dependencies. |
Karuna Wadhera | 542212b | 2024-11-01 21:23:50 +0000 | [diff] [blame] | 65 | "android.system.keystore2-V5-ndk", |
| 66 | "android.hardware.security.keymint-V4-ndk", |
Rajesh Nyamagoud | 76311aa | 2024-08-29 22:28:27 +0000 | [diff] [blame] | 67 | ], |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | rust_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 | |
| 80 | cc_library_static { |
| 81 | name: "libkeystore2_ffi_test_utils", |
| 82 | srcs: ["ffi_test_utils.cpp"], |
| 83 | defaults: [ |
Rajesh Nyamagoud | 76311aa | 2024-08-29 22:28:27 +0000 | [diff] [blame] | 84 | "keymint_use_latest_hal_aidl_ndk_static", |
| 85 | "keystore2_use_latest_aidl_ndk_static", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 86 | ], |
| 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 Nyamagoud | 76311aa | 2024-08-29 22:28:27 +0000 | [diff] [blame] | 92 | static_libs: [ |
| 93 | "libkeymaster_portable", |
| 94 | "libkeymint_support", |
| 95 | "libkeystore-engine", |
| 96 | ], |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 97 | shared_libs: [ |
Rajesh Nyamagoud | 19fe29a | 2023-10-04 18:36:55 +0000 | [diff] [blame] | 98 | "libbase", |
| 99 | "libcrypto", |
Rajesh Nyamagoud | 10f02e7 | 2023-08-17 22:27:40 +0000 | [diff] [blame] | 100 | ], |
| 101 | } |
| 102 | |
| 103 | genrule { |
| 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 | |
| 111 | genrule { |
| 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 | } |