buildscript {
    ext.travisBuild = System.getenv("TRAVIS") == "true"
    // allows for -Dpre-dex=false to be set
    ext.preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))

    ext.kotlinVersion = '1.2.40'
    ext.ankoVersion = '0.10.4'
    ext.supportVersion = '27.1.1'

    repositories {
        jcenter()
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

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

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

android {
    compileSdkVersion 27

    defaultConfig {
        applicationId 'com.ferencboldog.ankomaterial'
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName '1.0'
    }

    dexOptions {
        if (travisBuild) {
            preDexLibraries = preDexEnabled && !travisBuild
        } else {
            preDexLibraries = true
        }
    }

//     testOptions {
//         unitTests.returnDefaultValues = true
//     }

    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

    def support = ['appcompat-v7', 'design', 'support-v4', 'recyclerview-v7', 'percent', 'cardview-v7']
    support.each { name ->
        implementation "com.android.support:$name:$supportVersion"
    }

    def anko = ['sdk15', 'sdk15-listeners', 'support-v4', 'design', 'appcompat-v7', 'recyclerview-v7', 'percent', 'cardview-v7']

    anko.each { name ->
        implementation "org.jetbrains.anko:anko-$name:$ankoVersion"
    }

    // testCompile 'junit:junit:4.12'
    // testCompile 'org.assertj:assertj-core:2.4.0'
    // testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion"
}

task wrapper(type: Wrapper) {
    distributionUrl = 'https://services.gradle.org/distributions/gradle-4.7-all.zip'
}
