apply plugin: 'java'
apply plugin: 'maven'

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

description = """spark-rest-service"""


sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

buildscript {
    ext.aws_version = '1.11.63'
    ext.gradle_deps = '0.6.0.RELEASE'

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71"
        classpath "io.spring.gradle:dependency-management-plugin:1.0.7.RELEASE"
    }


}

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

mainClassName = 'com.budilov.AddPhotoHandler'

defaultTasks 'run'

repositories {
    mavenCentral()
    flatDir {
        dirs 'libs'
    }
}

jar {
    // Not really needed here
    manifest {
        attributes 'Main-Class': 'com.budilov.AddPhotoHandler'
    }

    // 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) } }
}

dependencyManagement {
    imports {
        mavenBom "com.amazonaws:aws-java-sdk-bom:$aws_version"
    }
}

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

    // AWS SDK
    compile "com.amazonaws:aws-java-sdk-lambda"
    compile "com.amazonaws:aws-java-sdk-s3"
    compile "com.amazonaws:aws-java-sdk-rekognition"
    compile "com.amazonaws:aws-lambda-java-events:1.3.0"
    compile "com.amazonaws:aws-lambda-java-core:1.1.0"
    compile "commons-io:commons-io:2.5"

    // ElasticSearch
    compile "io.searchbox:jest:6.3.1"
    // Required for Sig4 signing on the Jest requests
    compile "vc.inreach.aws:aws-signing-request-interceptor:0.0.22"

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