/*
 * Copyright (C) 2021 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.
 */

/**
 * This file was created using the `create_project.py` script located in the
 * `<AndroidX root>/development/project-creator` directory.
 *
 * Please use that script when creating a new project, rather than copying an existing project and
 * modifying its settings.
 */

import androidx.build.KotlinTarget
import androidx.build.LibraryType

plugins {
    id("AndroidXPlugin")
    id("com.android.library")
    id("org.jetbrains.kotlin.android")
}

android {
    namespace = "androidx.window.testing"
}

dependencies {
    api(libs.jspecify)
    api(libs.kotlinStdlib)
    api(project(":window:window"))
    api(libs.junit)
    implementation("androidx.core:core:1.8.0")
    implementation("androidx.annotation:annotation:1.8.1")

    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.kotlinCoroutinesTest)
    androidTestImplementation(libs.truth)

    testImplementation(libs.robolectric)
    testImplementation(libs.mockitoCore4)
    testImplementation(libs.mockitoKotlin4)
    testImplementation(libs.testCore)
    testImplementation(libs.testExtJunit)
    testImplementation(libs.testRunner)
    testImplementation(libs.testRules)
    testImplementation(libs.kotlinCoroutinesTest)
}

androidx {
    name = "WindowManager Testing Extensions"
    type = LibraryType.PUBLISHED_TEST_LIBRARY
    inceptionYear = "2021"
    description = "WindowManager Test Library"
    legacyDisableKotlinStrictApiMode = true
    kotlinTarget = KotlinTarget.KOTLIN_1_9
}
