/*
 * Copyright 2020 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.LibraryType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

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

dependencies {
    // Classes and types that are needed at compile & runtime
    api("androidx.annotation:annotation:1.8.1")

    // Classes and types that are only needed at runtime
    implementation(libs.atomicFu)
    implementation(libs.kotlinStdlib)
    implementation(libs.kotlinCoroutinesGuava)
    implementation(libs.kotlinCoroutinesTest)
    implementation(project(":camera:camera-camera2-pipe"))

    testImplementation(libs.testCore)
    testImplementation(libs.testRunner)
    testImplementation(libs.junit)
    testImplementation(libs.robolectric)
    testImplementation(libs.truth)
    testImplementation(libs.kotlinCoroutinesTest)
}

android {
    lintOptions {
        enable 'CameraXQuirksClassDetector'
    }
    // Use Robolectric 4.+
    testOptions.unitTests.includeAndroidResources = true
    namespace = "androidx.camera.camera2.pipe.testing"
}

// Allow usage of Kotlin's @OptIn.
tasks.withType(KotlinCompile).configureEach {
    kotlinOptions {
        freeCompilerArgs += ["-opt-in=kotlin.RequiresOptIn"]
    }
}

androidx {
    name = "Camera2 Pipe Testing"
    type = LibraryType.PUBLISHED_LIBRARY
    mavenVersion = LibraryVersions.CAMERA_PIPE
    inceptionYear = "2020"
    description = "Testing components for the Camera2 Pipe Library, a library providing a " +
            "consistent and reliable camera foundation that enables great camera driven " +
            "experiences across all of Android."
    doNotDocumentReason = "Not shipped externally"
}
