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 {
    google()
    jetbrainsCompose()
}

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

compose {
    kotlinCompilerPlugin.set(COMPOSE_COMPILER_PLUGIN_PLACEHOLDER)

    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)
        }
    }
}
