import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
    id "org.jetbrains.kotlin.jvm"
    id "org.jetbrains.compose"
}

repositories {
    jetbrainsCompose()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib"
    implementation compose.desktop.currentOs
}

compose.desktop {
    application {
        mainClass = "Main"
        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
        }

        def projectPath = project.projectDir.absolutePath
        if (DefaultNativePlatform.currentOperatingSystem.isWindows()) {
            projectPath = projectPath.replace("\\", "\\\\")
        }
        args(projectPath)

        buildTypes.release.proguard {
            configurationFiles.from("rules.pro")
        }
    }
}