/*
 * Copyright 2019 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")
}

dependencies {
    api(libs.jspecify)
    api(project(":camera:camera-core"))
    api("androidx.annotation:annotation:1.8.1")
    implementation("androidx.core:core:1.1.0")
    implementation("androidx.concurrent:concurrent-futures:1.0.0")
    implementation("androidx.tracing:tracing:1.2.0")
    implementation(libs.guavaListenableFuture)
    implementation(libs.autoValueAnnotations)

    annotationProcessor(libs.autoValue)

    testImplementation(libs.testCore)
    testImplementation(libs.testRunner)
    testImplementation(libs.junit)
    testImplementation(libs.truth)
    testImplementation(libs.robolectric)
    testImplementation(libs.mockitoCore4)
    testImplementation(libs.kotlinCoroutinesTest)
    testImplementation("androidx.annotation:annotation-experimental:1.4.1")
    testImplementation("androidx.concurrent:concurrent-futures-ktx:1.1.0")
    testImplementation("androidx.lifecycle:lifecycle-runtime-testing:2.3.1")
    testImplementation(project(":camera:camera-video"))
    testImplementation(project(":camera:camera-testing"))
    testImplementation(project(":internal-testutils-truth"))
    testImplementation("androidx.arch.core:core-testing:2.2.0")
    testImplementation(libs.junit) // Needed for Assert.assertThrows
    testImplementation("org.codehaus.plexus:plexus-utils:3.4.1")

    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.truth)
    androidTestImplementation(libs.testUiautomator)
    androidTestImplementation(libs.mockitoCore)
    androidTestImplementation(libs.dexmakerMockito)
    androidTestImplementation("androidx.appcompat:appcompat:1.1.0")
    androidTestImplementation(project(":camera:camera-testing")) {
        // Ensure camera-testing does not pull in androidx.test dependencies
        exclude(group:"androidx.test")
    }
    androidTestImplementation(libs.kotlinStdlib)
    androidTestImplementation(libs.kotlinCoroutinesAndroid)
    androidTestImplementation("androidx.annotation:annotation-experimental:1.4.1")
    androidTestImplementation(project(":internal-testutils-truth"))
    androidTestImplementation("org.jetbrains.kotlinx:atomicfu:0.13.1")
    androidTestImplementation("androidx.exifinterface:exifinterface:1.0.0")
    androidTestImplementation("androidx.concurrent:concurrent-futures-ktx:1.1.0")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
}
android {
    compileSdk = 35

    buildTypes.configureEach {
        consumerProguardFiles("proguard-rules.pro")
    }

    lintOptions {
        enable("CameraXQuirksClassDetector")
    }

    // Use Robolectric 4.+
    testOptions.unitTests.includeAndroidResources = true
    namespace = "androidx.camera.camera2"
}

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

androidx {
    name = "Camera2"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2019"
    description = "Camera2 implementation and extensions for the Jetpack Camera Library, a " +
            "library providing a consistent and reliable camera foundation that enables great " +
            "camera driven experiences across all of Android."
}
