
plugins {
    id 'org.jetbrains.kotlin.jvm' version '1.2.31'
}

apply from: "$gradleScripts/kotlin.gradle"
apply from: "$gradleScripts/service.gradle"

apply plugin: 'war'

defaultTasks 'installDist'

mainClassName = "com.hexagonkt.BenchmarkKt"
applicationDefaultJvmArgs = [
    '-Xms2G', '-Xmx2G', '-XX:+UseNUMA', '-XX:+UseParallelGC', '-XX:+AggressiveOpts'
]

war {
    archiveName = "ROOT.war"
}

installDist.dependsOn 'war'

dependencies {
    compile ("com.hexagonkt:hexagon_store:$hexagonVersion")
    compile ("com.hexagonkt:server_jetty:$hexagonVersion")
    compile ("com.hexagonkt:server_undertow:$hexagonVersion")
    compile ("com.hexagonkt:templates_pebble:$hexagonVersion")

    compile ("ch.qos.logback:logback-classic:$logbackVersion")
    compile ("org.mongodb:mongodb-driver:$mongodbVersion")
    compile ("com.zaxxer:HikariCP:$hikariVersion")
    compile ("org.postgresql:postgresql:$postgresqlVersion")

    // hexagon's UndertowEngine class depends on javax.activation.MimetypesFileTypeMap,
    // which is not available by default in Java 9.  Including this javax.activation
    // dependency fixes that issue with running on Java 9.
    compile ("com.sun.activation:javax.activation:$activationVersion")

    // providedCompile excludes the dependency only in the WAR, not in the distribution
    providedCompile ("org.eclipse.jetty:jetty-webapp:$jettyVersion") { exclude module: "slf4j-api" }

    testCompile ("org.testng:testng:$testngVersion")
    testCompile ("org.asynchttpclient:async-http-client:$ahcVersion") {
        exclude module: 'slf4j-api'
    }
}

test {
    useTestNG ()
}
