buildscript {
    ext.kotlin_version = '1.2.51'
    ext.junit_version = '4.12'


    repositories {
        mavenCentral()
        jcenter()
        //maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases' }
        mavenLocal()

    }
    dependencies {

        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // for Spec - http://spekframework.org/docs/latest/
        classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0'
    }

}
plugins {
    id 'java'
    id "org.jetbrains.kotlin.jvm" version "1.2.51"
    id "application"
    //id "kr.motd.sphinx" version "2.2.3"
}

apply plugin: 'kotlin'
apply plugin: 'groovy'
apply plugin: 'org.junit.platform.gradle.plugin'


group 'net.corda.workbench'
version '0.0.1-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
    jcenter()
    maven { url "https://jitpack.io" }
    mavenLocal()
    //maven { url "https://oss.sonatype.org/content/repositories/snapshots"}
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

    // libraries for
    compile "io.javalin:javalin:1.6.1"
    //compile group: 'org.json', name: 'json', version: '20180130'
    compile ('khttp:khttp:0.1.0') {
        exclude group: 'org.json'
    }

    // need to add this manually for some reason, even though its part of javalin
    compile "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.2"

    compile "com.typesafe:config:1.3.2"


    compile "org.slf4j:jcl-over-slf4j:1.7.25"
    compile "org.slf4j:slf4j-api:1.7.25"



    testCompile group: 'com.natpryce', name: 'hamkrest', version: '1.4.2.2'
    testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"

    testCompile ('org.jetbrains.spek:spek-api:1.1.5') {
        exclude group: 'org.jetbrains.kotlin'
    }
    testRuntime ('org.jetbrains.spek:spek-junit-platform-engine:1.1.5') {
        exclude group: 'org.junit.platform'
        exclude group: 'org.jetbrains.kotlin'
    }
    testCompile group: 'junit', name: 'junit', version: '4.12'
    testCompile ('org.junit.platform:junit-platform-runner:1.0.0')


    testCompile group: 'junit', name: 'junit', version: '4.12'
    testCompile ('org.junit.platform:junit-platform-runner:1.0.0')

    //compile group: 'org.json', name: 'json', version: '20180130'
    compile 'com.azure:azure-messaging-servicebus:7.4.2'

    compile 'com.azure:azure-core:1.22.0'

    compile 'org.bouncycastle:bcpkix-jdk15on:1.53'

    compile 'com.github.spullara.mustache.java:compiler:0.9.5'

    compile files('../commons/lib/workbench-commons.jar')


}


mainClassName = "net.corda.workbench.serviceBus.AppKt"


compileKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
compileTestKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}


jar {

//    from {
//        configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
//    }

    from(configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }) {
        exclude "META-INF/*.SF"
        exclude "META-INF/*.DSA"
        exclude "META-INF/*.RSA"
    }
    archiveName = "service-bus-listener.jar"
    manifest {
        attributes 'Main-Class': "net.corda.workbench.serviceBus.AppKt"
    }
}

run {
    if (project.hasProperty("appArgs")) {
        args Eval.me(appArgs)
    }
}
