def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
def kotlinVersion = safeExtGet("VisionCameraFaceDetector_kotlinVersion", "2.0.0")

apply plugin: "com.android.library"
apply plugin: "kotlin-android"

buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath "com.android.tools.build:gradle:7.4.2"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
    }
}

android {
    buildToolsVersion = safeExtGet("VisionCameraFaceDetector_buildToolsVersion", "34.0.0")
    ndkVersion safeExtGet("VisionCameraFaceDetector_ndkVersion", "25.1.8937393")
    defaultConfig {
        minSdkVersion safeExtGet("VisionCameraFaceDetector_minSdkVersion", 26)
        compileSdkVersion safeExtGet("VisionCameraFaceDetector_compileSdkVersion", 34)
        targetSdkVersion safeExtGet("VisionCameraFaceDetector_targetSdkVersion", 34)
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
        }
    }
    lintOptions {
        disable "GradleCompatible"
    }
}

repositories {
    mavenLocal()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url("$rootDir/../node_modules/react-native/android")
    }
    google()
    mavenCentral()
}

dependencies {
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
    api project(":react-native-vision-camera")
    implementation "androidx.annotation:annotation:1.8.0"
    implementation "androidx.camera:camera-core:1.3.4"
    implementation "com.google.mlkit:face-detection:16.1.6"
}
