/*
 * Copyright (C) 2014 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: ["Android-Apache-2.0"],
}

cc_defaults {
    name: "libberberis_ndk_tests_defaults",
    sdk_version: "current",
    cflags: [
        "-fexceptions",
        "-Wunused",
        "-Wextra",
        "-Wall",
        "-Werror",
        "-Wno-deprecated-declarations",
    ],
    stl: "libc++_static",
}

cc_library_shared {
    name: "libberberis_ndk_tests_shared_lib",
    defaults: ["libberberis_ndk_tests_defaults"],
    srcs: ["jni/shared_lib.cc"],
}

cc_library_shared {
    name: "libberberis_ndk_tests",
    defaults: ["libberberis_ndk_tests_defaults"],
    srcs: [
        "jni/shared_library_test.cc",
        "jni/user_apk_test.cc",
        "jni/jni_test.cc",
        "jni/jni_test_main.cc",
    ],
    cflags: ["-DTMPFILE_TEMPLATE=\"/data/data/com.example.ndk_tests/cache/ndk-tests-XXXXXX\""],
    header_libs: ["jni_headers"],
    shared_libs: [
        "liblog",
        "libberberis_ndk_tests_shared_lib",
        "libz",
    ],
    static_libs: [
        "cpufeatures",
        "libgtest_ndk_c++",
    ],
}

android_test {
    name: "ndk_tests_apk",
    sdk_version: "current",

    srcs: ["src/**/*.java"],
    libs: [
        "android.test.runner.stubs",
        "android.test.base.stubs",
    ],
    jni_libs: [
        "libberberis_ndk_tests",
        "libberberis_ndk_tests_shared_lib",
    ],
    dex_preopt: {
        enabled: false,
    },
}
