apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.simplemobiletools.clock"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 19
        versionName "5.2.2"
        setProperty("archivesBaseName", "clock")
        vectorDrawables.useSupportLibrary = true
    }

    signingConfigs {
        if (keystorePropertiesFile.exists()) {
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile file(keystoreProperties['storeFile'])
                storePassword keystoreProperties['storePassword']
            }
        }
    }

    buildTypes {
        debug {
            applicationIdSuffix ".debug"
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            if (keystorePropertiesFile.exists()) {
                signingConfig signingConfigs.release
            }
        }
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }

    kotlinOptions {
        jvmTarget = "1.8"
        freeCompilerArgs = ["-XXLanguage:+NewInference"]
    }
}

dependencies {
    implementation 'com.simplemobiletools:commons:5.28.24'
    implementation 'com.facebook.stetho:stetho:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
    implementation 'com.shawnlin:number-picker:2.4.6'
    implementation "androidx.preference:preference:1.1.0"
    implementation "androidx.work:work-runtime-ktx:2.3.2"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0'
    implementation 'org.greenrobot:eventbus:3.2.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
}
