/*
 * 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("androidx.lifecycle:lifecycle-common:2.0.0")
    api("androidx.annotation:annotation:1.8.1")
    api(project(":camera:camera-core"))
    api(project(":camera:camera-video"))

    implementation(project(":camera:camera-lifecycle"))
    implementation("androidx.annotation:annotation-experimental:1.4.1")
    implementation(libs.guavaListenableFuture)
    implementation("androidx.core:core:1.3.2")
    implementation("androidx.concurrent:concurrent-futures:1.0.0")
    implementation(libs.autoValueAnnotations)
    implementation("androidx.appcompat:appcompat:1.1.0")

    annotationProcessor(libs.autoValue)

    testImplementation(libs.testRunner)
    testImplementation(libs.mockitoCore4)
    testImplementation(libs.robolectric)
    testImplementation(libs.kotlinStdlib)
    testImplementation(libs.truth)
    testImplementation(libs.testRules)
    testImplementation(libs.testCore)
    testImplementation(project(":camera:camera-camera2"))
    testImplementation(project(":camera:camera-testing"))

    androidTestImplementation(libs.mockitoCore)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.testUiautomator)
    androidTestImplementation(libs.kotlinStdlib)
    androidTestImplementation(libs.truth)
    androidTestImplementation(project(":camera:camera-camera2"))
    androidTestImplementation(project(":camera:camera-testing")) {
        // Ensure camera-testing does not pull in androidx.test dependencies
        exclude(group:"androidx.test")
    }
    androidTestImplementation(project(":camera:camera-camera2-pipe-integration"))
    androidTestImplementation(project(":internal-testutils-truth"))
    androidTestImplementation(libs.mockitoCore)
    androidTestImplementation(libs.dexmakerMockito)
    androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
}
android {
    compileSdk = 35

    lintOptions {
        enable 'CameraXQuirksClassDetector'
    }

    testOptions.unitTests.includeAndroidResources = true
    namespace = "androidx.camera.view"
}
androidx {
    name = "Camera View"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2019"
    description = "UI tools for the Jetpack Camera Library, a library providing a consistent and " +
            "reliable camera foundation that enables great camera driven experiences across all " +
            "of Android."
}
