
plugins {
    id 'java'
}

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    testImplementation "junit:junit:4.13.1"
    // testImplementation = "io.quarkus:quarkus-junit5:${quarkusPlatformVersion}"
}

group = 'dmo.fs.quarkus'
version = '3.17.1'

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

def usr = System.getProperty("user.home")
def OS = System.getProperty("os.name").toLowerCase()
def dir = System.getProperty("user.dir")

compileJava {
    options.encoding = "UTF-8"
}

tasks.register('run', Exec) {
//   workingDir dir
    if ("firebase" == System.getenv("DEFAULT_DB") && System.getenv("GOOGLE_APPLICATION_CREDENTIALS") == null) {
        environment "GOOGLE_APPLICATION_CREDENTIALS", "$usr/auth/service-account-key.json"
    }
    //on windows:
    if (OS.indexOf("win") >= 0) {
        commandLine "cmd", "/c", ".\\gradlew", "quarkusDev"
    } else {
        //on linux
        commandLine "./gradlew", "quarkusDev"
    }
}
jar {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
compileTestJava {
    options.encoding = 'UTF-8'
}

test {
    useJUnitPlatform()
    testLogging {
        events = ["PASSED", "FAILED", "SKIPPED"]
    }
}
