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 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 "android.security.authorization-rust", 32 "libanyhow", 33 "libbinder_rs", 34 "libcxx", 35 "libkeystore2_selinux", 36 "liblog_rust", 37 "libnix", 38 "librand", 39 "librustutils", 40 "libserde", 41 "libserde_cbor", 42 "libthiserror", 43 ], 44 static_libs: [ 45 "libcppbor", 46 "libkeymaster_portable", 47 "libkeymint_support", 48 "libkeystore-engine", 49 "libkeystore2_ffi_test_utils", 50 ], 51 shared_libs: [ 52 "libbase", 53 "libcrypto", 54 ], 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 static_libs: [ 63 // Also include static_libs for the NDK variants so that they are available 64 // for dependencies. 65 "android.system.keystore2-V5-ndk", 66 "android.hardware.security.keymint-V4-ndk", 67 ], 68} 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: [ 84 "keymint_use_latest_hal_aidl_ndk_static", 85 "keystore2_use_latest_aidl_ndk_static", 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"], 92 static_libs: [ 93 "libkeymaster_portable", 94 "libkeymint_support", 95 "libkeystore-engine", 96 ], 97 shared_libs: [ 98 "libbase", 99 "libcrypto", 100 ], 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} 118