apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.erm.artists"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation":
                                     "$projectDir/schemas".toString()]
            }
        }
    }
    buildTypes {
        debug {
            buildConfigField 'String', "BandsInTownApiKey", AndroidBaseKotlinMVVM_BandsInTownApiKey
            buildConfigField("String", "BandsInTownUrl", "\"https://rest.bandsintown.com/\"")
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField 'String', "BandsInTownApiKey", AndroidBaseKotlinMVVM_BandsInTownApiKey
            buildConfigField("String", "BandsInTownUrl", "\"https://rest.bandsintown.com/\"")
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/atomicfu.kotlin_module'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

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

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

    // Various UI
    implementation "androidx.appcompat:appcompat:$appcompatVersion"
    implementation "androidx.constraintlayout:constraintlayout:$constraintlayoutVersion"
    implementation "androidx.recyclerview:recyclerview:$recyclerviewVersion"
    implementation "com.google.android.material:material:$materialVersion"

    // Logging
    implementation "com.jakewharton.timber:timber:$timberVersion"

    // core extensions
    implementation "androidx.core:core-ktx:$coreKtxVersion"

    // Fragment Extensions (maily for by viewModels)
    implementation "androidx.fragment:fragment-ktx:$fragmentKtxVersion"

    // View Model
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"

    // Room Database
    implementation "androidx.room:room-ktx:$roomVersion"
    implementation "androidx.room:room-runtime:$roomVersion"
    kapt "androidx.room:room-compiler:$roomVersion"

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

    // Dagger dependency injection
    implementation "com.google.dagger:dagger:$daggerVersion"
    implementation "com.google.dagger:dagger-android:$daggerVersion"
    implementation "com.google.dagger:dagger-android-support:$daggerVersion"
    kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
    kapt "com.google.dagger:dagger-compiler:$daggerVersion"

    //Threeten ABP (DateTime support)
    implementation "com.jakewharton.threetenabp:threetenabp:$jwThreetenABP"
    testImplementation "org.threeten:threetenbp:$orgThreetenbp"

    //Retrofit (Network layer)
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
    implementation "com.squareup.retrofit2:retrofit-mock:$retrofitVersion"

    //okhttp (network middleware)
    implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
    implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"

    //Picasso (image processing)
    implementation "com.squareup.picasso:picasso:$picassoVersion"

    //gson
    implementation "com.google.code.gson:gson:$gsonVersion"

    //debug tool
    debugImplementation "com.facebook.flipper:flipper:$flipperVersion"
    debugImplementation "com.facebook.soloader:soloader:$soLoaderVersion"
    releaseImplementation "com.facebook.flipper:flipper-noop:$flipperVersion"
    debugImplementation "com.facebook.flipper:flipper-network-plugin:$flipperVersion"

    //material serach bar
    implementation "com.github.mancj:MaterialSearchBar:$materialSearchbarVersion"

    //testing
    testImplementation "androidx.test:core:$testCoreVersion"
    androidTestImplementation "androidx.test.ext:junit:$junitVersion"
    androidTestImplementation "androidx.test:runner:$runnerVersion"
    androidTestImplementation "androidx.test.espresso:espresso-core:$espressoCoreVersion"
    testImplementation "org.mockito:mockito-core:$mockitoVersion"
    testImplementation 'androidx.arch.core:core-testing:' + architectureComponentsVersion
    testImplementation "org.robolectric:robolectric:$robolectricVersion"
    testImplementation('androidx.arch.core:core-testing:' + architectureComponentsVersion, {
        exclude group: 'com.android.support', module: 'support-compat'
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude group: 'com.android.support', module: 'support-core-utils'
    })
    androidTestImplementation 'androidx.test:runner:' + testRuleVersion
    androidTestImplementation 'androidx.test:rules:' + testRuleVersion
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:' + espressoVersion
    androidTestImplementation 'androidx.test.espresso:espresso-intents:' + espressoVersion
    androidTestImplementation 'androidx.test.espresso:espresso-accessibility:' + espressoVersion
    androidTestImplementation 'androidx.test.espresso:espresso-web:' + espressoVersion
    androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:' + espressoVersion
    androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:' + espressoVersion
    androidTestImplementation('androidx.test.espresso:espresso-core:' + espressoVersion, {
        exclude group: "com.android.support", module: "support-annotations"
    })
}