import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter

ext.moduleName = 'stroom.util'

dependencies {
    implementation project(':stroom-docref')
    implementation project(':stroom-util-shared')

    implementation libs.assertj.core // needed for DiffUtil
    implementation libs.commons.codec
    implementation libs.commons.compress
    implementation libs.commons.csv
    implementation libs.dropwizard.client
    implementation libs.dropwizard.core
    implementation libs.dropwizard.metrics.healthchecks
    implementation libs.dropwizard.validation
    implementation libs.guava
    implementation libs.guice
    implementation libs.jackson.annotations
    implementation libs.jackson.core
    implementation libs.jackson.databind
    implementation libs.jackson.dataformat.yaml
    implementation libs.jakarta.servlet.api
    implementation libs.jakarta.validation.api
    implementation libs.javassist
    implementation libs.jakarta.inject
    implementation libs.quartz
    implementation libs.saxon.he
    implementation libs.slf4j.api
    implementation libs.ws.rs.api
    implementation libs.xerces

    testImplementation project(':stroom-test-common')
    testImplementation libs.classgraph
    testImplementation libs.commons.lang
    testImplementation libs.dropwizard.validation
    testImplementation libs.guice.extension
    testImplementation libs.vavr

    testImplementation libs.bundles.common.test.implementation
    testRuntimeOnly libs.bundles.common.test.runtime
}

tasks.register('writeBuildProperties') {
    def propertyFile = file "${project.rootDir}/stroom-util/src/main/resources/META-INF/stroom-util-build.properties"
    def props = new Properties()

    props.setProperty("buildVersion", versions.stroom)
    props.setProperty("buildDate", ZonedDateTime.now().format(DateTimeFormatter.ISO_INSTANT))

    props.store(propertyFile.newWriter(), null)
}

tasks.compileJava.dependsOn writeBuildProperties
