apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply from: "../ktlint.gradle"

def keystorePropertiesFile = rootProject.file("keystore.properties")

if (keystorePropertiesFile.exists()) {

    def key = new Properties()

    key.load(new FileInputStream(keystorePropertiesFile))

    android.signingConfigs {
        debug {
            storeFile file("debug.keystore")
        }
        config {
            keyAlias key['alias']
            keyPassword key['key']
            storePassword key['store']
            storeFile file(key['file'])
        }
    }

}

android {
    compileSdkVersion 33
    defaultConfig {
        signingConfig signingConfigs.debug
        applicationId "com.github.drjacky.imagepicker.sample"
        minSdkVersion 19
        targetSdkVersion 33
        multiDexEnabled true
        versionCode rootProject.ext.versionCode
        versionName rootProject.ext.versionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            debuggable true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            if (keystorePropertiesFile.exists()) {
                signingConfig signingConfigs.config
            }
        }
        debug {
            debuggable true
            signingConfig signingConfigs.debug
        }
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11
    }
    lintOptions{
        disable 'MissingTranslation'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'androidx.browser:browser:1.4.0'
    implementation 'com.google.android.material:material:1.7.0'

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test:core:1.5.0'

    // Image Loading Lib
    implementation 'com.github.bumptech.glide:glide:4.14.2'

    // Leakcanary
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'

    implementation project(':imagepicker')

    androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
    androidTestImplementation 'androidx.test:rules:1.5.0'
    androidTestImplementation 'androidx.test:runner:1.5.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
}
