group 'com.budilov.cognito'
version '1.0-SNAPSHOT'

buildscript {
    ext.kotlin_version = '1.2.10'
    ext.aws_version = '2.0.0-preview-2'
    ext.jest_version = '2.0.4'
    ext.gradle_deps = '0.6.0.RELEASE'
    ext.lucene_version = '6.4.0'
    ext.spark_version = '2.6.0'
    ext.gson_version = '2.8.1'

    repositories {
        mavenCentral()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "io.spring.gradle:dependency-management-plugin:$gradle_deps"
        classpath 'se.transmode.gradle:gradle-docker:1.2'
    }
}

apply plugin: 'kotlin'
apply plugin: 'application'
apply plugin: "io.spring.dependency-management"

mainClassName = 'com.budilov.cognito.resource.ServiceEndpointsKt'

defaultTasks 'run'

compileKotlin {
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

repositories {
    mavenCentral()
}

jar {
    manifest {
        attributes 'Main-Class': 'com.budilov.cognito.resource.ServiceEndpointsKt'
    }

    // This line of code recursively collects and copies all of a project's files
    // and adds them to the JAR itself. One can extend this task, to skip certain
    // files or particular types at will
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
    exclude('**/*.DSA')
}

task listJars << {
    configurations.compile.each { File file -> println file.name }
}

dependencyManagement {
    imports {
        mavenBom "software.amazon.awssdk:bom:$aws_version"
    }
}

dependencies {
    // Kotlin
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    // AWS SDK
    compile "software.amazon.awssdk:lambda:$aws_version"
    compile "software.amazon.awssdk:cognitoidp:$aws_version"
    compile "software.amazon.awssdk:cognitoidentity:$aws_version"
    compile "com.amazonaws:aws-lambda-java-events:1.3.0"
    compile "com.amazonaws:aws-lambda-java-core:1.1.0"

    //JWT
    compile "com.auth0:java-jwt:3.3.0"
    compile 'com.auth0:jwks-rsa:0.1.0'

    compile 'org.slf4j:slf4j-simple:1.7.21'

    // GSON
    compile 'com.google.code.gson:gson:2.8.0'

    compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'

    testCompile 'junit:junit:4.11'
    testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
}
