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


import androidx.build.LibraryType

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

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

    annotationProcessor(libs.autoValue)

    // TODO(leohuang): We need this for assertThrows. Point back to the AndroidX shared version if
    //  it is ever upgraded.
    testImplementation(libs.junit)
    testImplementation(libs.kotlinStdlib)
    testImplementation(libs.testCore)
    testImplementation(libs.testRunner)
    testImplementation(libs.junit)
    testImplementation(libs.truth)
    testImplementation(libs.robolectric)
    testImplementation(libs.mockitoCore4)
    testImplementation("androidx.core:core-ktx:1.1.0")
    testImplementation(project(":camera:camera-testing"), {
        exclude group: "androidx.camera", module: "camera-core"
    })

    androidTestImplementation(project(":camera:camera-camera2"))
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.truth)
    androidTestImplementation(libs.mockitoCore)
    androidTestImplementation(libs.dexmakerMockito)
    androidTestImplementation(libs.autoValueAnnotations)
    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(libs.kotlinStdlib)
    androidTestImplementation(libs.kotlinCoroutinesAndroid)
    androidTestImplementation(libs.atomicFu)
    androidTestImplementation(project(":concurrent:concurrent-futures-ktx"))
    androidTestImplementation(project(":internal-testutils-truth"))
    androidTestImplementation(project(":camera:camera-camera2-pipe-integration"))
    androidTestImplementation libs.mockitoKotlin, {
        exclude group: 'org.mockito' // to keep control on the mockito version
    }
    androidTestAnnotationProcessor(libs.autoValue)
}

android {
    compileSdk = 35

    lintOptions {
        enable 'CameraXQuirksClassDetector'
    }

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

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