apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion rootProject.ext.android["compileSdkVersion"]
    buildToolsVersion rootProject.ext.android["buildToolsVersion"]
    useLibrary 'org.apache.http.legacy'

    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        versionCode rootProject.ext.android["versionCode"]
        versionName rootProject.ext.android["versionName"]

        //Room
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation":
                                     "$projectDir/schemas".toString()]
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    //DataBinding
    dataBinding {
        enabled true
    }
}

buildscript {
    repositories {
        jcenter()
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    //repository
    compile project(':repository')
    compile project(':lifecycle')

    //support
    compile(rootProject.ext.dependencies["support-v4"]) {
        exclude module: 'support-annotations'
    }
    compile(rootProject.ext.dependencies["appcompat-v7"]) {
        exclude module: 'support-annotations'
        exclude module: 'support-v4'
    }
    compile(rootProject.ext.dependencies["design"]) {
        exclude module: 'support-annotations'
        exclude module: 'appcompat-v7'
        exclude module: 'support-v4'
    }
    compile(rootProject.ext.dependencies["cardview-v7"]) {
        exclude module: 'support-annotations'
    }
    compile rootProject.ext.dependencies["annotations"]

    //view
    compile(rootProject.ext.dependencies["brvah"]) {
        exclude module: 'recyclerview-v7'
    }

    //mvvm(Lifecycles, LiveData, and ViewModel, Room)
    compile rootProject.ext.dependencies["lifecycle-runtime"]
    compile rootProject.ext.dependencies["lifecycle-extensions"]
    annotationProcessor rootProject.ext.dependencies["lifecycle-compiler"]
    compile rootProject.ext.dependencies["room-runtime"]
    annotationProcessor rootProject.ext.dependencies["room-compiler"]
    testCompile(rootProject.ext.dependencies["room-testing"]) {
        exclude module: 'support-compat'
        exclude module: 'support-annotations'
        exclude module: 'support-core-utils'
        exclude module: 'gson'
    }
    compile rootProject.ext.dependencies["room-rxjava2"]

    //tools
    provided rootProject.ext.dependencies["javax.annotation"]
    compile rootProject.ext.dependencies["dagger2"]
    annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
    compile(rootProject.ext.dependencies["dagger2-android"]) {
        exclude module: 'jsr305'
    }
    compile(rootProject.ext.dependencies["dagger2-android-support"]) {
        exclude module: 'jsr305'
        exclude module: 'appcompat-v7'
    }
    annotationProcessor(rootProject.ext.dependencies["dagger2-android-processor"]) {
        exclude module: 'jsr305'
    }
    compile rootProject.ext.dependencies["androideventbus"]
    annotationProcessor(rootProject.ext.dependencies["glide-compiler"]) {
        exclude module: 'jsr305'
    }

    //test
    compile rootProject.ext.dependencies["timber"]
    testCompile rootProject.ext.dependencies["junit"]
    androidTestCompile(rootProject.ext.dependencies["espresso-core"]) {
        exclude module: 'support-annotations'
    }

}
