plugins {
    kotlin("jvm")
    kotlin("plugin.spring")
    kotlin("plugin.lombok")
    id("org.springframework.boot")
    id("io.spring.dependency-management")
    //id("org.sonarqube")
    jacoco
}

group = "space.nstart.pcp"
version = "1.0.0"

kotlin {
    jvmToolchain((property("versions.java") as String).toInt())
    compilerOptions {
        freeCompilerArgs.addAll("-Xjsr305=strict")
        jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.fromTarget(property("versions.java") as String))
    }
}

configurations {
    compileOnly {
        extendsFrom(configurations.annotationProcessor.get())
    }
}

dependencies {
//	implementation(project(":libs:java-lib"))
//  implementation(project(":libs:kotlin-lib"))
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("${property("dep.spring.actuator")}")
    implementation("org.springframework.boot:spring-boot-starter-logging")
    implementation("org.springframework.boot:spring-boot-starter-validation")
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("jakarta.validation:jakarta.validation-api")

    implementation("io.github.classgraph:classgraph:${property("versions.classgraph")}")

    implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:${property("versions.open-api")}")

    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("org.locationtech.jts:jts-core:1.19.0")

    testImplementation("junit:junit")
    testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
    testImplementation("org.springframework.security:spring-security-test")
    testImplementation("org.testcontainers:junit-jupiter")
    implementation("io.projectreactor:reactor-core:3.6.2")
    testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

dependencyManagement {
    imports {
        mavenBom("org.testcontainers:testcontainers-bom:${property("versions.testcontainers")}")
    }
}

kotlin {
    compilerOptions {
        freeCompilerArgs.addAll("-Xjsr305=strict", "-Xannotation-default-target=param-property")
        jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.fromTarget(property("versions.java") as String))
    }
}

tasks.withType<Test> {
    useJUnitPlatform()
}

tasks.named("bootJar") {
    enabled = false
}

tasks.named("jar") {
    enabled = true
}
