Files
photophetch/build.gradle.kts
Kyle Bolen 3c2ec07bdb Fix JavaFX media: extract native libs from jar to temp dir
The 'media type not supported' error occurs because the JavaFX native
codec .dylib files aren't extracted when loading from classpath.
extractJavafxNativeLibs() finds the javafx-media jar, extracts the
.dylib files to a temp dir, and adds it to java.library.path.

Also remove --add-modules JVM args (caused boot layer init failure).
2026-07-30 06:20:03 +00:00

74 lines
2.5 KiB
Plaintext

import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.compose.multiplatform)
}
group = "com.bolenpad.photophetch"
version = "1.0.0"
kotlin {
jvmToolchain(21)
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
dependencies {
implementation(compose.desktop.currentOs)
implementation(compose.material3)
implementation(compose.materialIconsExtended)
implementation(libs.coroutines.core)
implementation(libs.coroutines.swing)
implementation(libs.serialization.json)
implementation(libs.slf4j.api)
implementation(libs.logback.classic)
// JavaFX media for Live Photo video playback in preview dialog
val javafxVersion = "21.0.3"
// Detect platform: mac-aarch64 for Apple Silicon, mac for Intel
val osArch = System.getProperty("os.arch") ?: "x86_64"
val javafxPlatform = when {
System.getProperty("os.name").contains("Mac", ignoreCase = true) && osArch.contains("aarch64") -> "mac-aarch64"
System.getProperty("os.name").contains("Mac", ignoreCase = true) -> "mac"
System.getProperty("os.name").contains("Win", ignoreCase = true) -> "win"
else -> "linux"
}
implementation("org.openjfx:javafx-media:$javafxVersion:$javafxPlatform")
implementation("org.openjfx:javafx-swing:$javafxVersion:$javafxPlatform")
implementation("org.openjfx:javafx-graphics:$javafxVersion:$javafxPlatform")
implementation("org.openjfx:javafx-base:$javafxVersion:$javafxPlatform")
implementation("org.openjfx:javafx-controls:$javafxVersion:$javafxPlatform")
}
compose.desktop {
application {
mainClass = "com.bolenpad.photophetch.MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "PhotoPhetch"
packageVersion = "1.0.0"
description = "Import photos from phones into PhotoPhile"
vendor = "bolenpad"
macOS {
bundleID = "com.bolenpad.photophetch"
iconFile.set(project.file("src/main/resources/icon.icns"))
}
}
// Fat JAR for quick distribution
buildTypes.release.proguard {
isEnabled = false
}
}
}