import java.time.Instant

plugins {
    id 'java'
    id 'application'
}

group projectGroup
version projectVersion

jar.archiveFileName = "analytics.jar"

application {
    mainClass = 'cz.senslog.analytics.app.Main'
}

repositories {
    mavenLocal()
    mavenCentral()
}

java {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}

build {
    doLast {
        ant.propertyfile(file: "gradle.properties") {
            entry( key: "buildVersion", value: Instant.now().getEpochSecond())
        }
    }
}

jar {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    manifest {
        attributes 'Implementation-Title': 'SensLog Analytics',
                'Implementation-Version': version,
                'Main-Class': 'cz.senslog.analytics.app.Main'
    }
    from {
        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

test {
    useJUnitPlatform()
}

dependencies {
    implementation 'org.apache.logging.log4j:log4j-api:2.22.0'
    implementation 'org.apache.logging.log4j:log4j-core:2.22.0'

    implementation 'io.vertx:vertx-core:4.5.7'
    implementation 'io.vertx:vertx-web:4.5.7'
    implementation 'io.vertx:vertx-web-openapi:4.5.7'
    implementation 'io.vertx:vertx-auth-jwt:4.5.7'
    implementation 'io.vertx:vertx-pg-client:4.5.7'
    implementation 'org.postgresql:postgresql:42.7.3'
    implementation 'com.ongres.scram:client:2.1'

    testImplementation platform('org.junit:junit-bom:5.9.2')
    testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
}

