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

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.appttude.h_mal.easycc"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 2
        versionName "1.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    testOptions {
        unitTests.returnDefaultValues = true
    }
    dataBinding {
        enabled = true
    }

    viewBinding.enabled = true

    buildTypes.each {
        Properties properties = new Properties()
        properties.load(project.rootProject.file("local.properties").newDataInputStream())
        def ccApiKey = properties.getProperty("cc_api_key", "")

        it.buildConfigField 'String', "CC_API_KEY", ccApiKey

        it.resValue 'string', "api_key", ccApiKey

    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"

    //Retrofit and GSON
    implementation 'com.squareup.retrofit2:retrofit:2.6.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.6.0'

    //Kotlin Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0"

    // ViewModel and LiveData
    implementation "androidx.lifecycle:lifecycle-extensions:2.1.0"

    //New Material Design
    implementation 'com.google.android.material:material:1.1.0-alpha10'

    //Kodein Dependency Injection
    implementation "org.kodein.di:kodein-di-generic-jvm:6.2.1"
    implementation "org.kodein.di:kodein-di-framework-android-x:6.2.1"

    //mockito and livedata testing
    testImplementation 'org.mockito:mockito-inline:2.13.0'
    testImplementation 'androidx.arch.core:core-testing:2.1.0'

    //Android Room
    implementation "androidx.room:room-runtime:2.2.0-rc01"
    implementation "androidx.room:room-ktx:2.2.0-rc01"
    kapt "androidx.room:room-compiler:2.2.0-rc01"

    implementation "androidx.preference:preference-ktx:1.1.0"

    //mock websever for testing retrofit responses
    testImplementation "com.squareup.okhttp3:mockwebserver:4.6.0"
    testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
}
