buildscript {
    ext.kotlin_version = '1.1.0'
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M3'
    }
}

apply plugin: 'kotlin'
apply plugin: 'application'
apply plugin: 'org.junit.platform.gradle.plugin'

configurations.all {
    resolutionStrategy {
        eachDependency { DependencyResolveDetails details ->
            if (details.requested.group == 'org.jetbrains.kotlin')
                details.useVersion kotlin_version
        }
    }
}

defaultTasks 'run'

junitPlatform {
    platformVersion = "1.0.0-M3"
    filters {
        engines {
            include 'spek'
        }
    }
}

test {
    testLogging {
        events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
        exceptionFormat 'full'
    }
}

repositories {
    mavenCentral()
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots/"
    }
    maven { url "http://dl.bintray.com/jetbrains/spek" }
    jcenter()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    testCompile 'junit:junit:4.11'
    testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
    testCompile 'org.jetbrains.spek:spek-api:1.1.0-beta3'
    testCompile 'io.kotlintest:kotlintest:1.3.5'
    testCompile 'com.github.nomisrev.rxassertj:rx2assertj:0.9.0'
    testCompile "com.nhaarman:mockito-kotlin:1.3.0"

    testRuntime 'org.junit.platform:junit-platform-launcher:1.0.0-M3'
    testRuntime 'org.jetbrains.spek:spek-junit-platform-engine:1.1.0-beta3'
}

task wrapper(type: Wrapper) {
    gradleVersion = "2.7"
}