plugins {
    java
    kotlin("jvm") version "1.9.21"
    id("com.github.johnrengelman.shadow") version "8.1.1"
    id("edu.sc.seis.launch4j") version "3.0.6"
}

group = "tech.nevets"
version = "0.3.1"

repositories {
    mavenCentral()
    maven {
        url = uri("https://git.nevets.tech/api/packages/Steven/maven")
    }
}

dependencies {
    implementation("com.miglayout:miglayout-swing:11.4.2")
    implementation("com.miglayout:miglayout-core:11.4.2")
    implementation("com.formdev:flatlaf:3.5.1")
    implementation("com.google.code.gson:gson:2.11.0")
    implementation("tech.nevets:JConf:0.1.0:no-deps")
}

kotlin {
    jvmToolchain(21)
}

//tasks.withType(JavaCompile).configureEach {
//    options.encoding = "UTF-8"
//}

tasks.jar {
    manifest {
        attributes["Main-Class"] = "tech.nevets.tvpn.Main"
    }
    configurations["compileClasspath"].forEach { file: File ->
        from(zipTree(file.absoluteFile))
    }
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

launch4j {
    mainClassName.set("tech.nevets.tvpn.Main")
    outfile.set("TVPN.exe")
    setJarTask(project.tasks["shadowJar"])
    fileDescription.set("TVPN Client")
    icon.set("$projectDir/src/main/resources/icon.ico")
    productName.set("TVPN")
    version.set("$this.version")
    textVersion.set("$this.version")
    bundledJrePath.set("./jre")
    manifest.set("$projectDir/TVPN.exe.manifest")
}