// Copyright 2022, The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package {
    default_applicable_licenses: ["system_keymint_license"],
}

rust_defaults {
    name: "kmr_tests_defaults",
    edition: "2021",
    lints: "android",
    rustlibs: [
        "libciborium",
        "libenv_logger",
        "libhex",
        "libkmr_common",
        "libkmr_ta",
        "libkmr_wire",
        "liblog_rust",
        "libx509_cert"
    ],
    proc_macros: [
        "libkmr_derive",
    ],
    cfgs: [
        "soong",
    ],
}

rust_library_host {
    name: "libkmr_tests",
    crate_name: "kmr_tests",
    srcs: ["src/lib.rs"],
    vendor_available: true,
    defaults: [
        "kmr_tests_defaults",
    ],
}

rust_test_host {
    name: "libkmr_keyblob_test",
    srcs: ["tests/keyblob_test.rs"],
    defaults: [
        "kmr_tests_defaults",
    ],
    rustlibs: [
        "libkmr_crypto_boring",
    ],
    test_suites: ["general-tests"],
}

rust_binary_host {
    name: "kmr_auth_keyblob_parse",
    crate_name: "kmr_auth_keyblob_parse",
    srcs: ["src/bin/auth-keyblob-parse.rs"],
    defaults: [
        "kmr_tests_defaults",
    ],
    rustlibs: [
        "libkmr_crypto_boring",
    ],
}

rust_binary_host {
    name: "kmr_encrypted_keyblob_parse",
    crate_name: "kmr_encrypted_keyblob_parse",
    srcs: ["src/bin/encrypted-keyblob-parse.rs"],
    defaults: [
        "kmr_tests_defaults",
    ],
}
