plugins { `java-library` `maven-publish` } group = "dev.jlibghostty" version = "0.1.0-SNAPSHOT" java { toolchain { languageVersion.set(JavaLanguageVersion.of(25)) } withSourcesJar() } tasks.withType().configureEach { options.release.set(22) } tasks.test { jvmArgs("--enable-native-access=ALL-UNNAMED") } fun currentPlatform(): String { val os = System.getProperty("os.name").lowercase() val arch = System.getProperty("os.arch").lowercase() val normalizedOs = when { os.contains("linux") -> "linux" os.contains("mac") || os.contains("darwin") -> "macos" else -> error("Unsupported operating system for bundled libghostty-vt: $os") } val normalizedArch = when (arch) { "amd64", "x86_64" -> "x86_64" "aarch64", "arm64" -> "aarch64" else -> error("Unsupported architecture for bundled libghostty-vt: $arch") } return "$normalizedOs-$normalizedArch" } val ghosttyNativeLib = providers .gradleProperty("ghosttyNativeLib") .orElse(providers.environmentVariable("JLIBGHOSTTY_LIBRARY")) tasks.processResources { ghosttyNativeLib.orNull?.let { nativeLib -> from(nativeLib) { into("dev/jlibghostty/native/${currentPlatform()}") rename { System.mapLibraryName("ghostty-vt") } } } } publishing { publications { create("mavenJava") { from(components["java"]) pom { name.set("jlibghostty") description.set("Java FFM bindings for libghostty-vt") } } } }