import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

def currentOS = DefaultNativePlatform.currentOperatingSystem
def platform = null
if (currentOS.isWindows()) {
    platform = 'win'
} else if (currentOS.isMacOsX()) {
    platform = 'mac'
} else {
    platform = 'linux'
}

if (System.getProperty ("os.arch") == 'aarch64') {
    platform += '-aarch64'
}

configurations {
    javafx
}

if (customJavaFxLibsPath != null) {
    repositories {
        flatDir {
            dirs customJavaFxLibsPath
        }
    }
    dependencies {
        javafx files("$customJavaFxLibsPath/javafx.base.jar")
        javafx files("$customJavaFxLibsPath/javafx.controls.jar")
        javafx files("$customJavaFxLibsPath/javafx.graphics.jar")
        javafx files("$customJavaFxLibsPath/javafx.media.jar")
        javafx files("$customJavaFxLibsPath/javafx.web.jar")
    }
} else if (!bundledJdkJavaFx) {
    // Always use maven version for development
    // The jpackage script uses the jmod sdk files for JavaFX
    dependencies {
        javafx "org.openjfx:javafx-base:${devJavafxVersion}:${platform}"
        javafx "org.openjfx:javafx-controls:${devJavafxVersion}:${platform}"
        javafx "org.openjfx:javafx-graphics:${devJavafxVersion}:${platform}"
        javafx "org.openjfx:javafx-media:${devJavafxVersion}:${platform}"
        javafx "org.openjfx:javafx-web:${devJavafxVersion}:${platform}"
    }
}
