plugins {
    kotlin("jvm") version "2.0.10"
    application
}

group = "net.sergeych"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
    maven("https://maven.universablockchain.com")
}

application {
    mainClass.set("net.sergeych.MainKt")
}

dependencies {
    implementation("com.icodici:universa_core:3.14.7")
    implementation("net.sergeych:unikrypto:1.2.5-SNAPSHOT")

    testImplementation(kotlin("test"))
}

tasks.test {
    useJUnitPlatform()
}

kotlin {
    jvmToolchain(17)
}

tasks.register<Jar>("fatJar") {
    archiveBaseName.set("my-console-app") // Change to your desired JAR name
    manifest {
        attributes["Main-Class"] = application.mainClass.get() // Set the main class
    }
    from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }) // Include dependencies
    with(tasks.jar.get() as CopySpec) // Include the default jar contents
}

tasks.build {
    dependsOn(tasks.named("fatJar")) // Ensure fatJar is built with the build task
}
