apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.quasar-utils'

description 'Corda peer bridging components'

configurations {
    integrationTestCompile.extendsFrom testCompile
    integrationTestRuntime.extendsFrom testRuntime
}

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

processResources {
    from file("$rootDir/config/dev/log4j2.xml")
}

dependencies {

    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"

    compile(project(':core')) {
        transitive = false // we control dependencies directly as the bridge is likely to be audited
    }

    compile(project(':node-api')) {
        transitive = false// we control dependencies directly as the bridge is likely to be audited
    }

    compile(project(':serialization')) {
        transitive = false// we control dependencies directly as the bridge is likely to be audited
    }

    // Here we pull in dependencies that would normally be pulled in transitively from :core and :node-api, but we need more fine grained control
    // For AMQP serialisation.
    compile "org.apache.qpid:proton-j:${protonj_version}"
    compile "com.google.guava:guava:$guava_version"
    // RxJava: observable streams of events.
    compile "io.reactivex:rxjava:$rxjava_version"
    compile("org.apache.activemq:artemis-core-client:${artemis_version}")
    compile "org.apache.activemq:artemis-commons:${artemis_version}"
    compile "io.netty:netty-handler-proxy:$netty_version"
    // TypeSafe Config: for simple and human friendly config files.
    compile "com.typesafe:config:$typesafe_config_version"

    // The following dependencies are required to load and deserialize network-info, or other static initializers that get triggered.
    // Java ed25519 implementation. See https://github.com/str4d/ed25519-java/ for deserializing our public keys and certs.
    compile "net.i2p.crypto:eddsa:$eddsa_version"
    // Bouncy castle support needed for X509 certificate manipulation
    compile "org.bouncycastle:bcprov-jdk15on:${bouncycastle_version}"
    compile "org.bouncycastle:bcpkix-jdk15on:${bouncycastle_version}"
    // Seems to be needed?
    compile "com.github.ben-manes.caffeine:caffeine:$caffeine_version"

    // Log4J: logging framework (with SLF4J bindings)
    compile "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
    compile "org.apache.logging.log4j:log4j-core:$log4j_version"
    compile "org.slf4j:jul-to-slf4j:$slf4j_version"
    compile "org.slf4j:jcl-over-slf4j:$slf4j_version"

    // JOpt: for command line flags.
    compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version"

    // Manifests: for reading stuff from the manifest file
    compile "com.jcabi:jcabi-manifests:1.1"

    integrationTestCompile project(':node-driver')
    integrationTestCompile "org.apache.curator:curator-test:${curator_version}"
    testCompile "junit:junit:$junit_version"
    testCompile "org.apache.curator:curator-test:${curator_version}"
    testCompile project(':test-utils')
}

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

jar {
    baseName 'corda-bridge-impl'
}

publish {
    name jar.baseName
}