plugins {
    id "io.spring.dependency-management" version "1.0.6.RELEASE"
    id "com.github.johnrengelman.shadow" version "4.0.0"
    id "org.jetbrains.kotlin.jvm" version "1.2.61"
    id "org.jetbrains.kotlin.kapt" version "1.2.61"
    id "org.jetbrains.kotlin.plugin.allopen" version "1.2.61"	
}

apply plugin:"application"

version "0.1"
group "com.rosskerr"

repositories {
    mavenLocal()
    mavenCentral()
    maven { url "https://jcenter.bintray.com" }
}

dependencyManagement {
    imports {
        mavenBom 'io.micronaut:bom:1.0.0.RC1'
    }
}

dependencies {
    implementation "io.micronaut:http-client"
    implementation "io.micronaut:http-server-netty"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}"
    implementation "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
    implementation "io.micronaut:runtime"
    kapt "io.micronaut:inject-java"
    kapt "io.micronaut:validation"
    kaptTest "io.micronaut:inject-java"
    runtimeOnly "ch.qos.logback:logback-classic:1.2.3"
    runtimeOnly "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.4.1"
    testImplementation "org.junit.jupiter:junit-jupiter-api:5.1.0"
    testImplementation "org.jetbrains.spek:spek-api:1.1.5"
    testRuntime "org.junit.jupiter:junit-jupiter-engine:5.1.0"
    testRuntime "org.jetbrains.spek:spek-junit-platform-engine:1.1.5"

    compile "io.micronaut.configuration:hibernate-jpa"
    compile "com.oracle:ojdbc8:12.2.0.1"
    compile "io.micronaut.configuration:jdbc-hikari"

    implementation "org.jsoup:jsoup:1.11.3"
}

shadowJar {
    mergeServiceFiles()
}

run.jvmArgs('-noverify', '-XX:TieredStopAtLevel=1')
mainClassName = "com.rosskerr.ServiceApplication"

task opinionServices (type: JavaExec) {
    classpath = sourceSets.main.runtimeClasspath
    main = 'com.rosskerr.ServiceApplication'
}
task opinionTasks (type: JavaExec) {
    classpath = sourceSets.main.runtimeClasspath
    main = 'com.rosskerr.TaskApplication'
}


test {
    useJUnitPlatform()
}

allOpen {
	annotation("io.micronaut.aop.Around")
}

compileKotlin {
	kotlinOptions {
	    jvmTarget = '1.8' 
	    //Will retain parameter names for Java reflection
	    javaParameters = true 
	}
}

compileTestKotlin {
	kotlinOptions {
	    jvmTarget = '1.8' 
	    javaParameters = true 
	}
}

