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

configurations {
    ktlint
}

android {
    compileSdkVersion versions.compileSdk
    defaultConfig {
        applicationId "io.github.erikjhordanrey.livedata_databinding"
        minSdkVersion versions.minSdk
        targetSdkVersion versions.targetSdk
        versionCode 1
        versionName "1.0"
    }

    buildFeatures {
        dataBinding = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
}

dependencies {

    ktlint "com.github.shyiko:ktlint:${versions.ktlint}"
    
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
    implementation "androidx.appcompat:appcompat:${versions.androidxAppcompat}"
    implementation "androidx.recyclerview:recyclerview:${versions.androidx}"

    implementation "com.github.bumptech.glide:glide:${versions.glide}"
    kapt "com.github.bumptech.glide:compiler:${versions.glide}"

    implementation "androidx.lifecycle:lifecycle-extensions:${versions.lifecycle}"
    kapt "androidx.lifecycle:lifecycle-compiler:${versions.lifecycle}"
}

task ktlint(type: JavaExec) {
    main = "com.github.shyiko.ktlint.Main"
    classpath = configurations.ktlint
    args "src/**/*.kt"
}

check.dependsOn ktlint

task ktlintFormat(type: JavaExec) {
    main = "com.github.shyiko.ktlint.Main"
    classpath = configurations.ktlint
    args "-F", "src/**/*.kt"
}
