apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
    def globalConfiguration = rootProject.extensions.getByName("ext")

    compileSdkVersion globalConfiguration["androidCompileSdkVersion"]
    buildToolsVersion globalConfiguration["androidBuildToolsVersion"]

    defaultConfig {
        minSdkVersion globalConfiguration["androidMinSdkVersion"]
        targetSdkVersion globalConfiguration["androidTargetSdkVersion"]
        multiDexEnabled = true
    }

    dexOptions {
        preDexLibraries = false
        dexInProcess = false
        javaMaxHeapSize "4g"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    packagingOptions {
        exclude 'LICENSE.txt'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
    }

    lintOptions {
        quiet true
        abortOnError false
        ignoreWarnings true
        disable 'InvalidPackage'            //Some libraries have issues with this.
        disable 'OldTargetApi'              //Lint gives this warning but SDK 20 would be Android L Beta.
        disable 'IconDensities'             //For testing purpose. This is safe to remove.
        disable 'IconMissingDensityFolder'  //For testing purpose. This is safe to remove.
    }

}

dependencies {
    def cacheDependencies = rootProject.ext.cacheDependencies
    def cacheTestDependencies = rootProject.ext.cacheTestDependencies

    compileOnly cacheDependencies.javaxAnnotation

    implementation project(':data')

    implementation cacheDependencies.kotlin
    implementation cacheDependencies.javaxInject
    implementation cacheDependencies.rxKotlin
    implementation cacheDependencies.gson
    implementation cacheDependencies.roomRuntime
    kapt cacheDependencies.roomCompiler

    testImplementation cacheTestDependencies.junit
    testImplementation cacheTestDependencies.kotlinJUnit
    testImplementation cacheTestDependencies.mockito
    testImplementation cacheTestDependencies.assertj
    testImplementation cacheTestDependencies.robolectric
    testImplementation cacheTestDependencies.archTesting
    testImplementation cacheTestDependencies.roomTesting
}