apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'com.jfrog.artifactory'

description 'Corda node web server'

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 project(':core')
    compile project(':client:rpc')
    compile project(':client:jackson')
    compile project(':tools:cliutils')
    compile project(":common-logging")

    // Web stuff: for HTTP[S] servlets
    compile "org.eclipse.jetty:jetty-servlet:$jetty_version"
    compile "org.eclipse.jetty:jetty-webapp:$jetty_version"
    compile "javax.servlet:javax.servlet-api:${servlet_version}"
    compile "commons-fileupload:commons-fileupload:$fileupload_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"

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

    // Jersey for JAX-RS implementation for use in Jetty
    // TODO: remove force upgrade when jersey catches up
    compile "org.eclipse.jetty:jetty-continuation:${jetty_version}"

    compile "org.glassfish.jersey.core:jersey-server:$jersey_version"
    compile "org.glassfish.jersey.containers:jersey-container-servlet:$jersey_version"
    compile "org.glassfish.jersey.containers:jersey-container-jetty-http:$jersey_version"
    compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version"

    // For rendering the index page.
    compile "org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.12"

    // Capsule is a library for building independently executable fat JARs.
    // We only need this dependency to compile our Caplet against.
    compileOnly "co.paralleluniverse:capsule:$capsule_version"

    integrationTestCompile project(':node-driver')

    testImplementation "org.junit.jupiter:junit-jupiter-api:${junit_jupiter_version}"
    testImplementation "junit:junit:$junit_version"

    testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junit_vintage_version}"
    testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junit_jupiter_version}"
    testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junit_platform_version}"
}

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

jar {
    baseName 'corda-testserver-impl'
}

publish {
    name jar.baseName
}
