/*
 * 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

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

dependencies {
    api("androidx.annotation:annotation:1.8.1")
    api(libs.kotlinStdlib)
    api(libs.kotlinCoroutinesAndroid)

    implementation(libs.atomicFu)
    implementation(libs.dagger)

    ksp(libs.daggerCompiler)

    testImplementation(libs.testCore)
    testImplementation(libs.testRunner)
    testImplementation(libs.junit)
    testImplementation(libs.truth)
    testImplementation(libs.robolectric)
    testImplementation(libs.kotlinTest)
    testImplementation(libs.kotlinCoroutinesTest)
    testImplementation(libs.mockitoCore4)
    testImplementation(libs.mockitoKotlin4)
    testImplementation(project(":camera:camera-camera2-pipe-testing"))
    testImplementation(project(":internal-testutils-truth"))

    kspTest(libs.daggerCompiler)

    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.truth)
}

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

ksp {
    arg("dagger.fastInit", "enabled")
    arg("dagger.fullBindingGraphValidation", "ERROR")
}

androidx {
    name = "Camera2 Pipe"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2020"
    description = "A set of opinionated camera interfaces and implementations on top of Camera2 " +
            "that will form a flexible shim layer to power Frameserver and CameraX."
    doNotDocumentReason = "Not shipped externally"
}
