/*
 * 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 {
    implementation("androidx.core:core:1.3.2")

    // Classes and types that are needed at compile & runtime
    api("androidx.annotation:annotation:1.8.1")
    api(project(":camera:camera-core"))

    // Classes and types that are only needed at runtime
    implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.3.1")
    implementation(libs.atomicFu)
    implementation(libs.dagger)
    implementation(libs.kotlinStdlib)
    implementation(libs.kotlinCoroutinesAndroid)
    implementation(project(":camera:camera-camera2-pipe"))
    implementation(project(":concurrent:concurrent-futures-ktx"))

    ksp(libs.daggerCompiler)

    testImplementation(libs.testCore)
    testImplementation(libs.testRunner)
    testImplementation(libs.junit)
    testImplementation(libs.truth)
    testImplementation(libs.mockitoCore4)
    testImplementation(libs.mockitoKotlin4)
    testImplementation(libs.byteBuddy)
    testImplementation(libs.robolectric)
    testImplementation(libs.kotlinCoroutinesTest)
    testImplementation(libs.kotlinTestJunit)
    testImplementation(project(":camera:camera-camera2-pipe-testing"))
    testImplementation(project(":camera:camera-testing"))
    testImplementation(project(":internal-testutils-ktx"))
    testImplementation(project(":internal-testutils-truth"))
    testImplementation("androidx.exifinterface:exifinterface:1.0.0")
    testImplementation("androidx.lifecycle:lifecycle-runtime-testing:2.3.1")
    testImplementation(project(":camera:camera-video"))

    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.kotlinCoroutinesAndroid)
    androidTestImplementation(libs.kotlinStdlib)
    androidTestImplementation(libs.truth)
    androidTestImplementation("androidx.annotation:annotation-experimental:1.4.1")
    androidTestImplementation(project(":camera:camera-lifecycle"))
    androidTestImplementation(project(":camera:camera-testing")) {
        // Ensure camera-testing does not pull in androidx.test dependencies
        exclude(group:"androidx.test")
    }
    androidTestImplementation(project(":camera:camera-video"))
    androidTestImplementation(project(":concurrent:concurrent-futures-ktx"))
    androidTestImplementation(project(":internal-testutils-truth"))
    androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
}

android {
    compileSdk = 35

    lintOptions {
        enable("CameraXQuirksClassDetector")
    }
    namespace = "androidx.camera.camera2.pipe.integration"
}

tasks.withType(Test).configureEach { test ->
    test.maxParallelForks = 2
}

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

androidx {
    name = "Camera2 Pipe Integration"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2020"
    description = "A Camera2 Pipe implementation of CameraX, a library providing a consistent " +
            "and reliable camera foundation that enables great camera driven experiences across " +
            "all of Android."
    doNotDocumentReason = "Not shipped externally"
}
