
apply plugin: 'kotlin'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'net.corda.plugins.quasar-utils'

sourceSets {
    main {
        resources {
            srcDir "config/dev"
        }
    }
    test {
        resources {
            srcDir "config/test"
        }
    }
    integrationTest {
        kotlin {
            compileClasspath += main.output + test.output
            runtimeClasspath += main.output + test.output
            srcDir file('src/integration-test/kotlin')
        }
    }
}

configurations {
    integrationTestCompile.extendsFrom testCompile
    integrationTestRuntime.extendsFrom testRuntime
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
    compile group: 'org.json', name: 'json', version: '20180813'

    compile files('../../../service-bus-integration/corda-reflections/lib/corda-reflections.jar')

    testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
    testCompile "junit:junit:$junit_version"

    // Corda integration dependencies
    cordaCompile "$corda_release_group:corda-core:$corda_release_version"
    cordaCompile "$corda_release_group:corda-finance:$corda_release_version"
    cordaCompile "$corda_release_group:corda-jackson:$corda_release_version"
    cordaCompile "$corda_release_group:corda-rpc:$corda_release_version"
    cordaCompile "$corda_release_group:corda-node-api:$corda_release_version"
    cordaCompile "$corda_release_group:corda-webserver-impl:$corda_release_version"
    cordaRuntime "$corda_release_group:corda:$corda_release_version"
    cordaRuntime "$corda_release_group:corda-webserver:$corda_release_version"

    testCompile "$corda_release_group:corda-node-driver:$corda_release_version"
    testCompile "$corda_release_group:corda-test-utils:$corda_release_version"


}

task integrationTest(type: Test, dependsOn: []) {
    testClassesDirs = sourceSets.integrationTest.output.classesDirs
    classpath = sourceSets.integrationTest.runtimeClasspath
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        languageVersion = "1.1"
        apiVersion = "1.1"
        jvmTarget = "1.8"
        javaParameters = true   // Useful for reflection.
    }
}

jar {
    // keep the size of the final jar down
    //exclude('org/jolokia/**')
    //exclude('org/json/**')
    //exclude('net/corda/workbench/dsl/**')

    exclude('META-INF/maven/**')
}


