plugins {
    {{#isTestSpock}}
    id("groovy")
    {{/isTestSpock}}
    id("com.github.johnrengelman.shadow") version "7.1.1"
    id("io.micronaut.application") version "3.1.1"
}

version = "{{artifactVersion}}"
group = "{{invokerPackage}}"

repositories {
    mavenCentral()
}

micronaut {
    runtime("netty")
    {{#isTestSpock}}
    testRuntime("spock2")
    {{/isTestSpock}}
    {{#isTestJunit}}
    testRuntime("junit5")
    {{/isTestJunit}}
    processing {
        incremental(true)
        annotations("{{invokerPackage}}.*")
    }
}


dependencies {
    annotationProcessor("io.micronaut:micronaut-http-validation")
    {{#useAuth}}
    annotationProcessor("io.micronaut.security:micronaut-security-annotations")
    {{/useAuth}}
    {{#micronaut_serde_jackson}}
    annotationProcessor("io.micronaut.serde:micronaut-serde-processor")
    implementation("io.micronaut.serde:micronaut-serde-jackson")
    {{/micronaut_serde_jackson}}
    implementation("io.micronaut:micronaut-http-client")
    implementation("io.micronaut:micronaut-runtime")
    implementation("io.micronaut:micronaut-validation")
    {{#useAuth}}
    implementation("io.micronaut.security:micronaut-security")
    implementation("io.micronaut.security:micronaut-security-oauth2")
    {{/useAuth}}
    {{#reactive}}
    implementation("io.micronaut.reactor:micronaut-reactor")
    {{/reactive}}
    {{#generateSwagger1Annotations}}
    implementation("io.swagger:swagger-annotations:1.6.5")
    {{/generateSwagger1Annotations}}
    {{#generateSwagger2Annotations}}
    implementation("io.swagger.core.v3:swagger-annotations:2.2.0")
    {{/generateSwagger2Annotations}}
    runtimeOnly("ch.qos.logback:logback-classic")
}
{{#micronaut_serde_jackson}}
// TODO Please, check the version of the serde, maybe it must be upgraded.
configurations.all {
    resolutionStrategy.dependencySubstitution {
        substitute(module("io.micronaut:micronaut-jackson-databind"))
            .using(module("io.micronaut.serde:micronaut-serde-jackson:1.3.3"))
    }
}
{{/micronaut_serde_jackson}}

// TODO Set the main class
application {
    mainClass.set("{{invokerPackage}}.Application")
}
java {
    sourceCompatibility = JavaVersion.toVersion("1.8")
    targetCompatibility = JavaVersion.toVersion("1.8")
}

graalvmNative.toolchainDetection = false
