plugins {
    id 'java'
    id 'maven-publish'
    id 'idea'
    id 'com.github.dreamhead.style'
    id 'com.github.dreamhead.coverage'
}

repositories {
    mavenLocal()
    mavenCentral()
    maven {
        url = uri('https://repo.maven.apache.org/maven2/')
    }
}

dependencies {
    implementation("com.google.guava:guava:$guavaVersion")
    compileOnly("org.projectlombok:lombok:$lombokVersion")
    annotationProcessor("org.projectlombok:lombok:$lombokVersion")
    implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
    implementation("jakarta.persistence:jakarta.persistence-api:$persistenceVersion")
    implementation("org.springframework:spring-context:$springVersion")
    implementation("org.springframework.data:spring-data-commons:$springDataVersion")

    testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
    testImplementation("org.junit.jupiter:junit-jupiter-params:$junitVersion")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
    testImplementation("org.assertj:assertj-core:$assertJVersion")
    testImplementation("org.mockito:mockito-core:$mockitoVersion")
}

test {
    useJUnitPlatform()
}

test {
    testLogging {
        afterSuite { desc, result ->
            if (!desc.parent) {
                println "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
            }
        }
    }
}

group = 'com.github.dreamhead'
version = '1.0-SNAPSHOT'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

publishing {
    publications {
        maven(MavenPublication) {
            from(components.java)
        }
    }
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
    options.compilerArgs << "-Xlint:unchecked"
    options.compilerArgs << "-Xlint:deprecation"
}