apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'

android {
    compileSdkVersion 30
    buildToolsVersion '30.0.3'

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 30

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles "consumer-rules.pro"

        buildConfigField("String", "SDK_VERSION_STRING", "\"${version}\"")
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
        }
    }

    testOptions {
        unitTests.includeAndroidResources = true
    }

    lintOptions {
        enable "Interoperability"
    }

    packagingOptions {
        pickFirst 'META-INF/AL2.0'
        pickFirst 'META-INF/LGPL2.1'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }

    aaptOptions {
        noCompress "tflite"
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])

    implementation "androidx.core:core-ktx:[1.3.1,1.6.0]"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:[1.4.0,1.5.1]"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:[1.4.0,1.5.1]"
    implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:[1.1.0,1.2.2]"

    // Allow the user to specify their own version of Tensorflow Lite to include
    runtimeOnly project(":tensorflow-lite")
    compileOnly "org.tensorflow:tensorflow-lite:2.4.0"
}

dependencies {
    testImplementation "androidx.test:core:1.4.0"
    testImplementation "androidx.test:runner:1.4.0"
    testImplementation "junit:junit:4.13.2"
    testImplementation "org.jetbrains.kotlin:kotlin-test:1.5.30"
    testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1"
}

dependencies {
    androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
    androidTestImplementation "androidx.test.ext:junit:1.1.3"
    androidTestImplementation "org.jetbrains.kotlin:kotlin-test:1.5.30"
    androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1"
}

apply from: "deploy.gradle"
