plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    compileSdk 31

    defaultConfig {
        applicationId "com.hhvvg.anytext"
        minSdk 23
        targetSdk 31
        versionCode 3
        versionName "1.0.2"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            debuggable false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled true
            shrinkResources true
            debuggable true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }

    viewBinding {
        enabled = true
    }

    applicationVariants.all { variant ->
        variant.outputs.all {
            def fileName = 'AnyText.apk'
            if (variant.buildType.name == 'release') {
                fileName = "AnyText-${variant.mergedFlavor.versionName}-release.apk"
            } else if (variant.buildType.name == 'debug'){
                fileName = "AnyText-${variant.mergedFlavor.versionName}-debug.apk"
            }
            outputFileName = fileName
        }
    }
}

dependencies {
    // Include libs as compile-only
    compileOnly fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}