/*
 * Copyright 2022 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(project(":camera:camera-core"))
    api(project(":camera:camera-view"))
    api("androidx.annotation:annotation:1.8.1")
    api("com.google.mlkit:vision-interfaces:16.0.0") {
        version {
            prefer '16.0.0'
        }
    }

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

android {
    compileSdk = 35

    lintOptions {
        enable 'CameraXQuirksClassDetector'
    }

    testOptions.unitTests.includeAndroidResources = true
    namespace = "androidx.camera.mlkit.vision"
}

androidx {
    name = "Camera MLKit Vision"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2022"
    description = "MLKit vision components for the Jetpack Camera Library, a library providing a " +
            "seamless integration that enables camera driven computer vision features " +
            "across all of Android."
}
